org.apache.beehive.netui.core.urls
Class URLRewriter

Object
  extended by URLRewriter

public abstract class URLRewriter
extends Object

Offers methods for rewriting URLs/query parameters.


Constructor Summary
URLRewriter()
           
 
Method Summary
 boolean allowOtherRewriters()
           
 boolean allowParamsOnFormAction(ServletContext servletContext, ServletRequest request)
          Tell whether rewritten form actions should be allowed to have query parameters.
 AjaxUrlInfo getAjaxUrl(ServletContext servletContext, ServletRequest request, Object nameable)
          This method will return two bits of information that are used by components that want run through the AJAX facilities.
abstract  String getNamePrefix(ServletContext servletContext, ServletRequest request, String name)
          Get the prefix to use when rewriting a query parameter name.
abstract  void rewriteURL(ServletContext servletContext, ServletRequest request, ServletResponse response, MutableURI url, URLType type, boolean needsToBeSecure)
          Rewrite the given URL.
 void setAllowOtherRewriters(boolean allowOtherRewriters)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLRewriter

public URLRewriter()
Method Detail

setAllowOtherRewriters

public void setAllowOtherRewriters(boolean allowOtherRewriters)

allowOtherRewriters

public boolean allowOtherRewriters()

getNamePrefix

public abstract String getNamePrefix(ServletContext servletContext,
                                     ServletRequest request,
                                     String name)
Get the prefix to use when rewriting a query parameter name. Loops through the list of registered URLRewriters to build up a the prefix.

Parameters:
servletContext - the current ServletContext.
request - the current ServletRequest.
name - the name of the query parameter.
Returns:
a prefix to use to rewrite a query parameter name.

getAjaxUrl

public AjaxUrlInfo getAjaxUrl(ServletContext servletContext,
                              ServletRequest request,
                              Object nameable)
This method will return two bits of information that are used by components that want run through the AJAX facilities. The AjaxUrlInfo class is returned and specifies this information.

Parameters:
servletContext - the current ServletContext.
request - the current ServletRequest.
nameable - this object that is the target of the Ajax request. Typically it is an INameable.

rewriteURL

public abstract void rewriteURL(ServletContext servletContext,
                                ServletRequest request,
                                ServletResponse response,
                                MutableURI url,
                                URLType type,
                                boolean needsToBeSecure)
Rewrite the given URL.

Parameters:
servletContext - the current ServletContext.
request - the current ServletRequest.
response - the current ServletResponse.
url - the MutableURI to be rewritten.
type - the type of URL to be rewritten. This is one of the following values:
  • action: a standard (non-resource) URL
  • resource: a resource (e.g., image) URL
needsToBeSecure - a flag indicating whether the URL should be secure (SSL required) or not

allowParamsOnFormAction

public boolean allowParamsOnFormAction(ServletContext servletContext,
                                       ServletRequest request)
Tell whether rewritten form actions should be allowed to have query parameters. If this returns false, then a form-tag implementation should render query parameters into hidden fields on the form instead of allowing them to remain in the URL.