public String concatServerAdressWithContext(String context) { String contextPrefix = ""; String fullContext = context; if (!fullContext.startsWith("/")) { fullContext = "/" + fullContext; } return url.getProtocol() + "://" + url.getHost() + ":" + url.getPort() + contextPrefix + fullContext; }
public String concatServerAdressWithContext(String context) { String contextPrefix = ""; String fullContext = context; if (!fullContext.startsWith("/")) { fullContext = "/" + fullContext; } return url.getProtocol() + "://" + url.getHost() + ":" + url.getPort() + contextPrefix + fullContext; }
public String concatServerAdressWithContext(String context) { String contextPrefix = ""; String fullContext = context; if (!fullContext.startsWith("/")) { fullContext = "/" + fullContext; } return url.getProtocol() + "://" + url.getHost() + ":" + url.getPort() + contextPrefix + fullContext; }
private boolean shouldRedirectToExternalUrl(Url url, Url clientUrl) { if (!Strings.isEmpty(url.getProtocol()) && !url.getProtocol().equals(clientUrl.getProtocol())) { return true; } if (!Strings.isEmpty(url.getHost()) && !url.getHost().equals(clientUrl.getHost())) { return true; } if ((url.getPort() != null) && !url.getPort().equals(clientUrl.getPort())) { return true; } return false; } }
/** * Determines whether a URL should be rendered in its full form * * @param url * @return {@code true} if URL should be rendered in the full form */ protected boolean shouldRenderAsFull(final Url url) { Url clientUrl = request.getClientUrl(); if (!Strings.isEmpty(url.getProtocol()) && !url.getProtocol().equals(clientUrl.getProtocol())) { return true; } if (!Strings.isEmpty(url.getHost()) && !url.getHost().equals(clientUrl.getHost())) { return true; } if ((url.getPort() != null) && !url.getPort().equals(clientUrl.getPort())) { return true; } if (url.isContextAbsolute()) { // do not relativize urls like "/a/b" return true; } return false; }
/** * Determines whether a URL should be rendered in its full form * * @param url * @return {@code true} if URL should be rendered in the full form */ protected boolean shouldRenderAsFull(final Url url) { Url clientUrl = request.getClientUrl(); if (!Strings.isEmpty(url.getProtocol()) && !url.getProtocol().equals(clientUrl.getProtocol())) { return true; } if (!Strings.isEmpty(url.getHost()) && !url.getHost().equals(clientUrl.getHost())) { return true; } if ((url.getPort() != null) && !url.getPort().equals(clientUrl.getPort())) { return true; } if (url.isContextAbsolute()) { // do not relativize urls like "/a/b" return true; } return false; }
/** * Build value to Origin header based on RequestCycle Url * * @return Origin header */ protected String createOriginHeader(){ Url url = RequestCycle.get().getRequest().getUrl(); return url.getProtocol() + "://" +url.getHost() + ":" + url.getPort(); }
/** * Build value to Origin header based on RequestCycle Url * * @return Origin header */ protected String createOriginHeader() { Url url = RequestCycle.get().getRequest().getUrl(); return url.getProtocol() + "://" + url.getHost() + ":" + url.getPort(); }
private void resetLogin(RequestCycle cycle) { final Url url = cycle.getUrlRenderer().getBaseUrl(); final String redirectURL = url.getProtocol() + "://" + url.getHost() + ":" + url.getPort() + SecurityUtil.getLogoutPath(); throw new RedirectToUrlException(redirectURL); }
+ clientUrl.getHost() + ":" + clientUrl.getPort() + r.getContextPath(); } else {
Url relative = Url.parse(relativeUrl, url.getCharset()); relative.setHost(url.getHost()); relative.setPort(url.getPort()); relative.setProtocol(url.getProtocol()); renderedUrl = renderFullUrl(relative);
Url relative = Url.parse(relativeUrl, url.getCharset()); relative.setHost(url.getHost()); relative.setPort(url.getPort()); relative.setProtocol(url.getProtocol()); renderedUrl = renderFullUrl(relative);