Java Code Examples for org.apache.wicket.request.Url#isFull()
The following examples show how to use
org.apache.wicket.request.Url#isFull() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServletWebResponse.java From onedev with MIT License | 5 votes |
@Override public String encodeURL(CharSequence url) { Args.notNull(url, "url"); UrlRenderer urlRenderer = getUrlRenderer(); Url originalUrl = Url.parse(url); /* WICKET-4645 - always pass absolute url to the web container for encoding because when REDIRECT_TO_BUFFER is in use Wicket may render PageB when PageA is actually the requested one and the web container cannot resolve the base url properly */ String fullUrl = urlRenderer.renderFullUrl(originalUrl); String encodedFullUrl = httpServletResponse.encodeURL(fullUrl); final String encodedUrl; if (originalUrl.isFull()) { encodedUrl = encodedFullUrl; } else { if (fullUrl.equals(encodedFullUrl)) { // no encoding happened so just reuse the original url encodedUrl = url.toString(); } else { // get the relative url with the jsessionid encoded in it Url _encoded = Url.parse(encodedFullUrl); encodedUrl = urlRenderer.renderRelativeUrl(_encoded); } } return encodedUrl; }
Example 2
Source File: ServletWebResponse.java From onedev with MIT License | 5 votes |
@Override public String encodeRedirectURL(CharSequence url) { Args.notNull(url, "url"); UrlRenderer urlRenderer = getUrlRenderer(); Url originalUrl = Url.parse(url); /* * WICKET-4645 - always pass absolute url to the web container for encoding because when * REDIRECT_TO_BUFFER is in use Wicket may render PageB when PageA is actually the requested * one and the web container cannot resolve the base url properly */ String fullUrl = urlRenderer.renderFullUrl(originalUrl); String encodedFullUrl = httpServletResponse.encodeRedirectURL(fullUrl); final String encodedUrl; if (originalUrl.isFull()) { encodedUrl = encodedFullUrl; } else { if (fullUrl.equals(encodedFullUrl)) { // no encoding happened so just reuse the original url encodedUrl = url.toString(); } else { // get the relative url with the jsessionid encoded in it Url _encoded = Url.parse(encodedFullUrl); encodedUrl = urlRenderer.renderRelativeUrl(_encoded); } } return encodedUrl; }
Example 3
Source File: Application.java From openmeetings with Apache License 2.0 | 5 votes |
private static String getWsUrl(Url reqUrl) { if (!reqUrl.isFull()) { return null; } final boolean insecure = "http".equalsIgnoreCase(reqUrl.getProtocol()); String delim = ":"; String port = reqUrl.getPort() == null || reqUrl.getPort() < 0 ? "" : String.valueOf(reqUrl.getPort()); if (!port.isEmpty() && ((insecure && 80 == reqUrl.getPort()) || (!insecure && 443 == reqUrl.getPort()))) { port = ""; } if (port.isEmpty()) { delim = ""; } return String.format("%s://%s%s%s", insecure ? "ws" : "wss", reqUrl.getHost(), delim, port); }