org.apache.wicket.request
Class UrlRenderer

java.lang.Object
  extended by org.apache.wicket.request.UrlRenderer

public class UrlRenderer
extends Object

Takes care of rendering relative (or in future possibly absolute - depending on configuration) URLs.

All 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

Constructor Summary
UrlRenderer(Url base)
          Construct.
 
Method Summary
 Url getBaseUrl()
          Returns the base Url.
 String renderContextPathRelativeUrl(String url, Request request)
          Renders the URL within context relative to current base URL.
 String renderUrl(Url url)
          Renders the Url relative to currently set Base Url.
 Url setBaseUrl(Url base)
          Sets the base Url.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlRenderer

public UrlRenderer(Url base)
Construct.

Parameters:
base - base Url. All generated Urls will be relative to this Url.
Method Detail

setBaseUrl

public Url setBaseUrl(Url base)
Sets the base Url. All generated URLs will be relative to this Url.

Parameters:
base -
Returns:
original base Url

getBaseUrl

public Url getBaseUrl()
Returns the base Url.

Returns:
base Url

renderUrl

public String renderUrl(Url url)
Renders the Url relative to currently set Base Url. This method is only intended for Wicket URLs, because the Url object represents part of URL after Wicket Filter. For general URLs within context use renderContextPathRelativeUrl(String, Request)

Parameters:
url -
Returns:
Url rendered as string

renderContextPathRelativeUrl

public String renderContextPathRelativeUrl(String url,
                                           Request request)
Renders the URL within context relative to current base URL.

Parameters:
url -
request -
Returns:
relative URL


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.