org.mmbase.framework.basic
Class BasicUrlConverter

java.lang.Object
  extended by org.mmbase.framework.basic.BasicUrlConverter
All Implemented Interfaces:
Serializable, UrlConverter

public final class BasicUrlConverter
extends Object
implements UrlConverter

Basic implementation of UrlConverter. Essential, should typically be chained last in ChainedUrlConverter by the framework.

Since:
MMBase-1.9
Version:
$Id: BasicUrlConverter.java 41969 2010-04-20 11:54:02Z michiel $
Author:
Michiel Meeuwissen
See Also:
Serialized Form

Constructor Summary
BasicUrlConverter(BasicFramework fw)
           
 
Method Summary
 boolean equals(Object o)
           
 Block getBlock(String path, Parameters frameworkParameters)
          The BasicUrlConverter is unable to explicitely define a block and hence returns null.
 int getDefaultWeight()
           
 Url getInternalUrl(String page, Map<String,?> params, Parameters frameworkParameters)
          See Framework.getInternalUrl(String, Map, Parameters).
 Parameter<?>[] getParameterDefinition()
          An URLConverter can add parameters to it's parent Framework.
 Url getProcessUrl(String path, Map<String,?> parameters, Parameters frameworkParameters, boolean escapeAmps)
           
static String getUrl(String page, Map<? extends CharSequence,?> params, HttpServletRequest req, boolean escapeamp)
          General utility function to create an Url
 Url getUrl(String path, Map<String,?> parameters, Parameters frameworkParameters, boolean escapeAmps)
          See Framework.getUrl(String, Map, Parameters, boolean).
protected  String getUrl(String path, Map<String,?> parameters, Parameters frameworkParameters, boolean escapeAmps, boolean action)
           
static HttpServletRequest getUserRequest(HttpServletRequest req)
          Entirely unwraps the request.
 int hashCode()
           
 boolean isFilteredMode(Parameters frameworkParameters)
          This URLConverter can work on any url, so is wlays in 'filtered' mode'.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicUrlConverter

public BasicUrlConverter(BasicFramework fw)
Method Detail

getUrl

public static String getUrl(String page,
                            Map<? extends CharSequence,?> params,
                            HttpServletRequest req,
                            boolean escapeamp)
General utility function to create an Url

Parameters:
page - servletPath
params - The query to be added
req - A request object is needed to determine context-paths and so on.
escapeamp - Whether ampersands must be XML-escaped. Typically needed if the URL is used in (X)HTML.
Returns:
An URL relative to the root of this web application (i.e. without a context path),

isFilteredMode

public boolean isFilteredMode(Parameters frameworkParameters)
                       throws FrameworkException
This URLConverter can work on any url, so is wlays in 'filtered' mode'.

Specified by:
isFilteredMode in interface UrlConverter
Throws:
FrameworkException

getDefaultWeight

public int getDefaultWeight()
Specified by:
getDefaultWeight in interface UrlConverter

getBlock

public Block getBlock(String path,
                      Parameters frameworkParameters)
The BasicUrlConverter is unable to explicitely define a block and hence returns null.


getParameterDefinition

public Parameter<?>[] getParameterDefinition()
Description copied from interface: UrlConverter
An URLConverter can add parameters to it's parent Framework. If the parameter is already defined in the Framework, the framework will of course ignore the one requested to be defined by this UrlConverter.

Specified by:
getParameterDefinition in interface UrlConverter
To Do:
Actually these parameters are only added here, because this urlconverter is always in BasicFramework. Actually BasicFramework should add them itself.

getUserRequest

public static HttpServletRequest getUserRequest(HttpServletRequest req)
Entirely unwraps the request. So, this returns the original request object, without implicit additions by e.g. the Filter.


getUrl

protected String getUrl(String path,
                        Map<String,?> parameters,
                        Parameters frameworkParameters,
                        boolean escapeAmps,
                        boolean action)

getUrl

public Url getUrl(String path,
                  Map<String,?> parameters,
                  Parameters frameworkParameters,
                  boolean escapeAmps)
Description copied from interface: UrlConverter
See Framework.getUrl(String, Map, Parameters, boolean). But it can also return null which mean, 'I don't know.'

Specified by:
getUrl in interface UrlConverter
Parameters:
path - The path (generally a relative URL) to create an URL for.
parameters - Parameters The parameters to be passed to the page, as specified e.g. with mm:param -tags
frameworkParameters - The parameters that are required by the framework
escapeAmps - true if parameters should be added with an escaped & (&amp;). You should escape & when a URL is exposed (i.e. in HTML), but not if the url is for some reason called directly.
Returns:
An URL relative to the root of this web application (i.e. without a context path). Url.NOT if not determinable.

getProcessUrl

public Url getProcessUrl(String path,
                         Map<String,?> parameters,
                         Parameters frameworkParameters,
                         boolean escapeAmps)
Specified by:
getProcessUrl in interface UrlConverter
Returns:
An URL relative to the root of this web application (i.e. without a context path). Never null

getInternalUrl

public Url getInternalUrl(String page,
                          Map<String,?> params,
                          Parameters frameworkParameters)
Description copied from interface: UrlConverter
See Framework.getInternalUrl(String, Map, Parameters).

Specified by:
getInternalUrl in interface UrlConverter
Parameters:
page - The page (e.g. image/css) provided by the component to create an URL for
params - Extra parameters for that path
frameworkParameters - The parameters that are required by the framework, such as the 'request' and 'cloud' objects
Returns:
A valid internal URL, or Url.NOT if nothing framework specific could be determined (this would make it possible to 'chain' frameworks).

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


MMBase 2.0-SNAPSHOT - null