01: package ru.emdev.EmForge.web;
02:
03: import javax.faces.application.ViewHandler;
04: import javax.faces.context.FacesContext;
05:
06: import org.apache.commons.logging.Log;
07: import org.apache.commons.logging.LogFactory;
08:
09: import ru.emdev.EmForge.util.Helper;
10:
11: import com.sun.facelets.FaceletViewHandler;
12:
13: /** Our implementation of View Handler to correctly process resource links
14: *
15: */
16: public class ViewHandlerImpl extends FaceletViewHandler {
17: protected final Log logger = LogFactory.getLog(getClass());
18:
19: public ViewHandlerImpl(ViewHandler arg0) {
20: super (arg0);
21: }
22:
23: /** We overriding this method to check - is specified path is relative path -
24: * and add context path to make it absolute
25: */
26: @Override
27: public String getResourceURL(FacesContext i_context, String i_url) {
28: String url = i_url;
29: if (Helper.isRelativePath(url)) {
30: logger.debug("URL: " + url);
31:
32: url = Helper.getPath() + "/" + url;
33:
34: return url;
35: }
36:
37: return super.getResourceURL(i_context, url);
38: }
39: }
|