org.apache.wicket
Class Request

java.lang.Object
  extended by org.apache.wicket.Request
Direct Known Subclasses:
WebRequest

public abstract class Request
extends java.lang.Object

Base class for page request implementations allowing access to request parameters. A Request has a URL and a parameter map. You can retrieve the URL of the request with getURL(). The entire parameter map can be retrieved via getParameterMap(). Individual parameters can be retrieved via getParameter(String). If multiple values are available for a given parameter, they can be retrieved via getParameters(String).

Author:
Jonathan Locke

Constructor Summary
Request()
          Construct.
 
Method Summary
 java.lang.String decodeURL(java.lang.String url)
          An implementation of this method is only required if a subclass wishes to support sessions via URL rewriting.
abstract  java.util.Locale getLocale()
           
 Page getPage()
           
abstract  java.lang.String getParameter(java.lang.String key)
          Gets a given (query) parameter by name.
abstract  java.util.Map getParameterMap()
          Gets a map of (query) parameters sent with the request.
abstract  java.lang.String[] getParameters(java.lang.String key)
          Gets an array of multiple parameters by name.
abstract  java.lang.String getPath()
           
abstract  java.lang.String getRelativePathPrefixToContextRoot()
          Gets a prefix to make this relative to the context root.
abstract  java.lang.String getRelativePathPrefixToWicketHandler()
          Gets a prefix to make this relative to the Wicket Servlet/Filter.
 java.lang.String getRelativeURL()
          Deprecated. Use getURL() instead.
 RequestParameters getRequestParameters()
          Gets the request parameters object using the instance of IRequestCodingStrategy of the provided request cycle processor.
abstract  java.lang.String getURL()
          Retrieves the relative URL of this request for local use.
 boolean mergeVersion()
          A request can say if the current request should generated a new version number.
 void setPage(Page page)
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Request

public Request()
Construct.

Method Detail

decodeURL

public java.lang.String decodeURL(java.lang.String url)
An implementation of this method is only required if a subclass wishes to support sessions via URL rewriting. This default implementation simply returns the URL String it is passed.

Parameters:
url - The URL to decode
Returns:
The decoded url

getLocale

public abstract java.util.Locale getLocale()
Returns:
The locale for this request

getPage

public Page getPage()
Returns:
Any Page for this request

getParameter

public abstract java.lang.String getParameter(java.lang.String key)
Gets a given (query) parameter by name.

Parameters:
key - Parameter name
Returns:
Parameter value

getParameterMap

public abstract java.util.Map getParameterMap()
Gets a map of (query) parameters sent with the request.

Returns:
Map of parameters

getParameters

public abstract java.lang.String[] getParameters(java.lang.String key)
Gets an array of multiple parameters by name.

Parameters:
key - Parameter name
Returns:
Parameter values

getPath

public abstract java.lang.String getPath()
Returns:
Path info for request

getRelativePathPrefixToContextRoot

public abstract java.lang.String getRelativePathPrefixToContextRoot()
Gets a prefix to make this relative to the context root.

For example, if your context root is http://server.com/myApp/ and the request is for /myApp/mountedPage/, then the prefix returned might be "../../".

For a particular technology, this might return either an absolute prefix or a relative one.

Returns:
Prefix relative to this request required to back up to context root.

getRelativePathPrefixToWicketHandler

public abstract java.lang.String getRelativePathPrefixToWicketHandler()
Gets a prefix to make this relative to the Wicket Servlet/Filter.

For example, if your context root is http://server.com/myApp/ and the request is for /myApp/mountedPage/, then the prefix returned might be "../../".

For a particular technology, this might return either an absolute prefix or a relative one.

Returns:
Prefix relative to this request required to back up to context root.

getRelativeURL

public java.lang.String getRelativeURL()
Deprecated. Use getURL() instead.

Gets the relative (to some root) url (e.g. in a servlet environment, the url without the context path and without a leading '/'). Use this method e.g. to load resources using the servlet context.

Returns:
Request URL

getRequestParameters

public final RequestParameters getRequestParameters()
Gets the request parameters object using the instance of IRequestCodingStrategy of the provided request cycle processor.

Returns:
the request parameters object

getURL

public abstract java.lang.String getURL()
Retrieves the relative URL of this request for local use. This is relative to the context root.

Returns:
The relative request URL for local use

setPage

public void setPage(Page page)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.

Parameters:
page - The Page for this request

mergeVersion

public boolean mergeVersion()
A request can say if the current request should generated a new version number. If this returns true, then all the changes on a page that has versioning enabled is merged with the latest version. Else it will just create a new version.

Returns:
true if the version must be merged with the previous latest.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


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