List of usage examples for org.apache.wicket.request Url isContextAbsolute
public boolean isContextAbsolute()
From source file:guru.mmp.application.web.WebSphereAbsoluteUrlRenderer.java
License:Apache License
/** * Overrides the normal relative URL rendering to render an absolute URL that is compatible with * WebSphere./*from w w w . j a v a2 s . c o m*/ * * @param url the URL to render * * @return the WebSphere compatible absolute URL */ @Override public String renderRelativeUrl(Url url) { if (url == null) { throw new WebApplicationException("Fail to render relative URL for null URL"); } // If this is already a context absolute or full URL then stop here if (url.isContextAbsolute() || url.isFull()) { return url.toString(); } else { return contextPath + "/" + url.toString(); } }
From source file:org.opensingular.lib.wicket.util.application.HttpsOnlyUrlRenderer.java
License:Apache License
@SuppressWarnings("deprecation") public String renderFullUrl(final Url url) { if (url instanceof IUrlRenderer) { IUrlRenderer renderer = (IUrlRenderer) url; return renderer.renderFullUrl(url, getBaseUrl()); }//from ww w.j a v a 2s . co m final String protocol = "https"; final String host = resolveHost(url); final String path; if (url.isContextAbsolute()) { path = url.toString(); } else { Url base = new Url(getBaseUrl()); base.resolveRelative(url); path = base.toString(); } StringBuilder render = new StringBuilder(); if (!Strings.isEmpty(protocol)) { render.append(protocol); render.append(':'); } if (!Strings.isEmpty(host)) { render.append("//"); render.append(host); } if (!url.isContextAbsolute()) { render.append(request.getContextPath()); render.append(request.getFilterPath()); } return Strings.join("/", render.toString(), path); }