01: package ru.emdev.EmForge.web.renderer;
02:
03: import javax.faces.component.UIComponent;
04:
05: import org.apache.commons.logging.Log;
06: import org.apache.commons.logging.LogFactory;
07:
08: import ru.emdev.EmForge.util.Helper;
09:
10: import com.sun.faces.renderkit.html_basic.OutputLinkRenderer;
11:
12: /** Extension for standard Link Renreder to correctly handle relative paths
13: *
14: * @author akakunin
15: *
16: */
17: public class HtmlLinkRenderer extends OutputLinkRenderer {
18: protected final Log logger = LogFactory.getLog(getClass());
19:
20: @Override
21: protected Object getValue(UIComponent i_component) {
22: String href = (String) super .getValue(i_component);
23:
24: if (Helper.isRelativePath(href)) {
25: logger.debug("URL " + href);
26: href = Helper.getPath() + "/" + href;
27: }
28:
29: return href;
30: }
31: }
|