/** * Construct. * * @param request * Request that serves as the base for rendering urls */ public UrlRenderer(final Request request) { this.request = request; baseUrl = request.getClientUrl(); }
@Override public Url getClientUrl() { return Request.this.getClientUrl(); }
@Override public Url getClientUrl() { return Request.this.getClientUrl(); }
/** * Construct. * * @param request * Request that serves as the base for rendering urls */ public UrlRenderer(final Request request) { this.request = request; baseUrl = request.getClientUrl(); }
/** * 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 port that should be used to render the url * * @param url * url being rendered * @return port or {@code null} if none is set */ protected Integer resolvePort(final Url url) { return choose(url.getPort(), baseUrl.getPort(), request.getClientUrl().getPort()); }
/** * Gets port that should be used to render the url * * @param url * url being rendered * @return port or {@code null} if none is set */ protected Integer resolvePort(final Url url) { return choose(url.getPort(), baseUrl.getPort(), request.getClientUrl().getPort()); }
/** * Gets the host name that should be used to render the url * * @param url * url being rendered * @return the host name or {@code null} if none is set */ protected String resolveHost(final Url url) { return choose(url.getHost(), baseUrl.getHost(), request.getClientUrl().getHost()); }
/** * Gets the host name that should be used to render the url * * @param url * url being rendered * @return the host name or {@code null} if none is set */ protected String resolveHost(final Url url) { return choose(url.getHost(), baseUrl.getHost(), request.getClientUrl().getHost()); }
/** * 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()); }
/** * 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; }
if (StringUtils.isEmpty(proxyBaseUrl)) { Request r = getRequest(); Url clientUrl = r.getClientUrl(); styleUrl = clientUrl.getProtocol()
Url baseUrl = request.getClientUrl(); String namespace = getContext().getNamespace(); String bookmarkableIdentifier = getContext().getBookmarkableIdentifier();
Url baseUrl = request.getClientUrl(); String namespace = getContext().getNamespace(); String bookmarkableIdentifier = getContext().getBookmarkableIdentifier();
Url clientUrl = request.getClientUrl(); if (!shouldRedirectToExternalUrl(absoluteUrl, clientUrl)) { if (absoluteUrl.getProtocol() != null) {
Url baseUrl = request.getClientUrl(); String namespace = getContext().getNamespace(); String pageIdentifier = getContext().getPageIdentifier();
Url baseUrl = request.getClientUrl(); String namespace = getContext().getNamespace(); String pageIdentifier = getContext().getPageIdentifier();