/** * Gets the protocol that should be used to render the url * * @param url * url being rendered * @return the protocol or {@code null} if none is set */ protected String resolveProtocol(final Url url) { return choose(url.getProtocol(), baseUrl.getProtocol(), request.getClientUrl() .getProtocol()); }
/** * Gets the protocol that should be used to render the url * * @param url * url being rendered * @return the protocol or {@code null} if none is set */ protected String resolveProtocol(final Url url) { return choose(url.getProtocol(), baseUrl.getProtocol(), request.getClientUrl() .getProtocol()); }
/** * Returns whether the Url is a CSS data uri. Data uris start with '{@literal data:}'. * * @return <code>true</code> if Url starts with 'data:', <code>false</code> otherwise. */ public boolean isDataUrl() { return (getProtocol() != null && getProtocol().equals("data")) || (!getSegments().isEmpty() && getSegments() .get(0).startsWith("data")); }
/** * Returns whether the Url is a CSS data uri. Data uris start with '{@literal data:}'. * * @return <code>true</code> if Url starts with 'data:', <code>false</code> otherwise. */ public boolean isDataUrl() { return (getProtocol() != null && getProtocol().equals("data")) || (!getSegments().isEmpty() && getSegments() .get(0).startsWith("data")); }
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); }
if (url.getProtocol() != null) setScheme(url.getProtocol());
if (url.getProtocol() != null) setScheme(url.getProtocol());
/** * Should the page be rendered immediately. */ protected boolean shouldRenderPageAndWriteResponse(RequestCycle cycle, Url currentUrl, Url targetUrl) { // WICKET-5484 never render and write for Ajax requests if (isAjax(cycle)) { return false; } return (compatibleProtocols(currentUrl.getProtocol(), targetUrl.getProtocol())) && (neverRedirect(getRedirectPolicy()) || ((isOnePassRender() && notForcedRedirect(getRedirectPolicy())) || (targetUrl .equals(currentUrl) && (!isNewPageInstance() && !isPageStateless()))) || (targetUrl.equals(currentUrl) && isRedirectToRender()) || (shouldPreserveClientUrl(cycle) && notForcedRedirect(getRedirectPolicy()))); }
/** * Should the page be rendered immediately. */ protected boolean shouldRenderPageAndWriteResponse(RequestCycle cycle, Url currentUrl, Url targetUrl) { // WICKET-5484 never render and write for Ajax requests if (isAjax(cycle)) { return false; } return (compatibleProtocols(currentUrl.getProtocol(), targetUrl.getProtocol())) && (neverRedirect(getRedirectPolicy()) || ((isOnePassRender() && notForcedRedirect(getRedirectPolicy())) || (targetUrl .equals(currentUrl) && (!isNewPageInstance() && !isPageStateless()))) || (targetUrl.equals(currentUrl) && isRedirectToRender()) || (shouldPreserveClientUrl(cycle) && notForcedRedirect(getRedirectPolicy()))); }
Url clientUrl = request.getClientUrl(); if (!shouldRedirectToExternalUrl(absoluteUrl, clientUrl)) { if (absoluteUrl.getProtocol() != null) { renderedUrl = Strings.replaceAll(renderedUrl, absoluteUrl.getProtocol() + "://", "/");
relative.setHost(url.getHost()); relative.setPort(url.getPort()); relative.setProtocol(url.getProtocol()); renderedUrl = renderFullUrl(relative);
relative.setHost(url.getHost()); relative.setPort(url.getPort()); relative.setProtocol(url.getProtocol()); renderedUrl = renderFullUrl(relative);