java.lang.Object
org.apache.wicket.request.UrlRenderer
Takes care of rendering URLs.
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.
- Author:
- Matej Knopp, Igor Vaynberg
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the base Url.Renders the URL within context relative to current base URL.renderFullUrl
(Url url) Renders a full URL in theprotocol://hostname:port/path
formatrenderRelativeUrl
(Url url) Renders the Url relative to currently set Base Url.Renders the Urlprotected String
resolveHost
(Url url) Gets the host name that should be used to render the urlprotected Integer
resolvePort
(Url url) Gets port that should be used to render the urlprotected String
resolveProtocol
(Url url) Gets the protocol that should be used to render the urlsetBaseUrl
(Url base) Sets the base Url.protected boolean
shouldRenderAsFull
(Url url) Determines whether a URL should be rendered in its full form
-
Constructor Details
-
UrlRenderer
Construct.- Parameters:
request
- Request that serves as the base for rendering urls
-
-
Method Details
-
setBaseUrl
Sets the base Url. All generated URLs will be relative to this Url.- Parameters:
base
-- Returns:
- original base Url
-
getBaseUrl
Returns the base Url.- Returns:
- base Url
-
renderUrl
Renders the Url- Parameters:
url
-- Returns:
- Url rendered as string
-
renderFullUrl
Renders a full URL in theprotocol://hostname:port/path
format- Parameters:
url
-- Returns:
- rendered URL
-
resolvePort
Gets port that should be used to render the url- Parameters:
url
- url being rendered- Returns:
- port or
null
if none is set
-
resolveHost
Gets the host name that should be used to render the url- Parameters:
url
- url being rendered- Returns:
- the host name or
null
if none is set
-
resolveProtocol
Gets the protocol that should be used to render the url- Parameters:
url
- url being rendered- Returns:
- the protocol or
null
if none is set
-
renderRelativeUrl
Renders the Url relative to currently set Base Url. This method is only intended for Wicket URLs, because theUrl
object represents part of URL after Wicket Filter. For general URLs within context userenderContextRelativeUrl(String)
- Parameters:
url
-- Returns:
- Url rendered as string
-
shouldRenderAsFull
Determines whether a URL should be rendered in its full form- Parameters:
url
-- Returns:
true
if URL should be rendered in the full form
-
renderContextRelativeUrl
Renders the URL within context relative to current base URL.- Parameters:
url
-- Returns:
- relative URL
-