public class UrlRenderer extends Object
Normally Urls are rendered relative to the base Url. Base Url is normally Url of the page being rendered. However, during Ajax request and redirect to buffer rendering the BaseUrl needs to be adjusted.
Constructor and Description |
---|
UrlRenderer(Request request)
Construct.
|
Modifier and Type | Method and Description |
---|---|
Url |
getBaseUrl()
Returns the base Url.
|
String |
renderContextRelativeUrl(String url)
Renders the URL within context relative to current base URL.
|
String |
renderFullUrl(Url url)
Renders a full URL in the
protocol://hostname:port/path format |
String |
renderRelativeUrl(Url url)
Renders the Url relative to currently set Base Url.
|
String |
renderUrl(Url url)
Renders the Url
|
protected String |
resolveHost(Url url)
Gets the host name that should be used to render the url
|
protected Integer |
resolvePort(Url url)
Gets port that should be used to render the url
|
protected String |
resolveProtocol(Url url)
Gets the protocol that should be used to render the url
|
Url |
setBaseUrl(Url base)
Sets the base Url.
|
protected boolean |
shouldRenderAsFull(Url url)
Determines whether a URL should be rendered in its full form
|
public UrlRenderer(Request request)
request
- Request that serves as the base for rendering urlspublic Url setBaseUrl(Url base)
base
- public Url getBaseUrl()
public String renderUrl(Url url)
url
- public String renderFullUrl(Url url)
protocol://hostname:port/path
formaturl
- protected Integer resolvePort(Url url)
url
- url being renderednull
if none is setprotected String resolveHost(Url url)
url
- url being renderednull
if none is setprotected String resolveProtocol(Url url)
url
- url being renderednull
if none is setpublic String renderRelativeUrl(Url url)
Url
object represents part
of URL after Wicket Filter.
For general URLs within context use renderContextRelativeUrl(String)
url
- protected boolean shouldRenderAsFull(Url url)
url
- true
if URL should be rendered in the full formCopyright © 2006–2022 Apache Software Foundation. All rights reserved.