public void adjustAttributes(String tag, Map attributes) { String attrname = (String) tagToAttrName.get(tag); if (attrname == null) return; if (attributes.get(XMLLump.ID_ATTRIBUTE) != null) return; String url = (String) attributes.get(attrname); if (url == null || URLUtil.isAbsolute(url) || url.equals("") || url.charAt(0) == '/' || url.charAt(0) == '#') return; attributes.put(XMLLump.ID_ATTRIBUTE, XMLLump.SCR_PREFIX + URLRewriteSCR.NAME); }
public String encodeResourceURL(String resourcepath) { if (URLUtil.isAbsolute(resourcepath) || resourcepath.charAt(0) == '/') { return resourcepath; } else { return cup.getContextBaseURL() + resourcepath; } }
/** * relpath has leading slash removed. */ public String rewriteResourceURL(String path, String resourcebase) { String resourceURL = null; if (!URLUtil.isAbsolute(path) && (path.length() == 0 || path.charAt(0) != '/')) { if (isContextURL(path)) { resourceURL = rewriteContextURL(path); } else { resourceURL = viewstatehandler.encodeResourceURL(resourcebase + path); } resourceURL = StringUtils.cleanPath(resourceURL); } if (Logger.log.isDebugEnabled()) { Logger.log.debug("getResourceURL returning " + resourceURL + " for path " + path); } return resourceURL; } }