@Override public String getFilterPath() { return UrlUtils.normalizePath(filterPrefix); }
@Override public Iterable<?> getRenderTokens() { return Arrays.asList( "css-" + UrlUtils.rewriteToContextRelative(getUrl(), RequestCycle.get()) + "-" + media); }
/** * Rewrites a relative url to be context relative, leaves absolute urls same. * * @param url * @param requestCycle * @return rewritten url */ public static String rewriteToContextRelative(String url, IRequestCycle requestCycle) { if (isRelative(url)) { return requestCycle.getUrlRenderer().renderContextRelativeUrl(url); } else { return url; } }
@Override public Iterable<?> getRenderTokens() { return Arrays.asList( "css-" + UrlUtils.rewriteToContextRelative(getUrl(), RequestCycle.get()) + "-" + media); }
/** * Rewrites a relative url to be context relative, leaves absolute urls same. * * @param url * @param requestCycle * @return rewritten url */ public static String rewriteToContextRelative(String url, IRequestCycle requestCycle) { if (isRelative(url)) { return requestCycle.getUrlRenderer().renderContextRelativeUrl(url); } else { return url; } }
/** {@inheritDoc} **/ @Override public void onComponentTag(Component component, ComponentTag tag) { // get path final String path = contextRelativePath.getObject(); final String rewritten = UrlUtils.rewriteToContextRelative(path, RequestCycle.get()); tag.put("src", rewritten); }
/** * Imports the contents of the url of the model object. * * @return the imported contents */ protected String importAsString() { // gets the model object: should provide us with either an absolute or a // relative url String url = getModelObject(); if (UrlUtils.isRelative(url)) { return importRelativeUrl(url); } else { return importAbsoluteUrl(url); } }
@Override public String getFilterPath() { return UrlUtils.normalizePath(filterPath); }
/** {@inheritDoc} **/ @Override public void onComponentTag(Component component, ComponentTag tag) { // get path final String path = contextRelativePath.getObject(); final String rewritten = UrlUtils.rewriteToContextRelative(path, RequestCycle.get()); tag.put("src", rewritten); }
/** * Imports the contents of the url of the model object. * * @return the imported contents */ protected String importAsString() { // gets the model object: should provide us with either an absolute or a // relative url String url = getModelObject(); if (UrlUtils.isRelative(url)) { return importRelativeUrl(url); } else { return importAbsoluteUrl(url); } }
@Override public String getContextPath() { return UrlUtils.normalizePath(contextPath); }
/** * Should be c:url equivalent, but isn't yet (works for now). * * @param requestCycle Needed to encode url. * @param path * @param encodeUrl * @return path itself if not starts with '/' otherwise "/ProjectForge" + path with session id and params. */ public static String getUrl(final RequestCycle requestCycle, final String path, final boolean encodeUrl) { String url = UrlUtils.rewriteToContextRelative(path, requestCycle); if (encodeUrl == true) { url = requestCycle.getResponse().encodeURL(url); } return url; }
@Override public String getFilterPath() { return UrlUtils.normalizePath(filterPrefix); }
@Override public void onComponentTag(Component component, ComponentTag tag) { // Modify all relevant attributes for (String attrName : attributeNames) { String attrValue = tag.getAttributes().getString(attrName); if ((attrValue != null) && (attrValue.startsWith("/") == false) && (!attrValue.contains(":")) && !(attrValue.startsWith("#"))) { tag.getAttributes().put(attrName, UrlUtils.rewriteToContextRelative(attrValue, RequestCycle.get())); } } } };
@Override public String getContextPath() { return UrlUtils.normalizePath(contextPath); }
@Override public Iterable<?> getRenderTokens() { String url = UrlUtils.rewriteToContextRelative(getUrl(), RequestCycle.get()); if (Strings.isEmpty(getId())) return Collections.singletonList("javascript-" + url); else return Arrays.asList("javascript-" + getId(), "javascript-" + url); }
@Override public String getFilterPath() { return UrlUtils.normalizePath(filterPath); }
@Override public Iterable<?> getRenderTokens() { String url = UrlUtils.rewriteToContextRelative(getUrl(), RequestCycle.get()); if (Strings.isEmpty(getId())) return Collections.singletonList("javascript-" + url); else return Arrays.asList("javascript-" + getId(), "javascript-" + url); }
@Override public String getContextPath() { return UrlUtils.normalizePath(httpServletRequest.getContextPath()); }
@Override public void onComponentTag(Component component, ComponentTag tag) { // Modify all relevant attributes for (String attrName : attributeNames) { String attrValue = tag.getAttributes().getString(attrName); if ((attrValue != null) && (attrValue.startsWith("/") == false) && (!attrValue.contains(":")) && !(attrValue.startsWith("#"))) { tag.getAttributes().put(attrName, UrlUtils.rewriteToContextRelative(attrValue, RequestCycle.get())); } } } };