org.apache.wicket
Class Request

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

public abstract class Request
extends 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
 String decodeURL(String url)
          An implementation of this method is only required if a subclass wishes to support sessions via URL rewriting.
abstract  Locale getLocale()
           
 Page getPage()
           
abstract  String getParameter(String key)
          Gets a given (query) parameter by name.
abstract  Map<String,String[]> getParameterMap()
          Gets a map of (query) parameters sent with the request.
abstract  String[] getParameters(String key)
          Gets an array of multiple parameters by name.
abstract  String getPath()
           
abstract  String getQueryString()
          Returns the query string (part after ?) of this request.
abstract  String getRelativePathPrefixToContextRoot()
          Gets a prefix to make this relative to the context root.
abstract  String getRelativePathPrefixToWicketHandler()
          Gets a prefix to make this relative to the Wicket Servlet/Filter.
 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  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.
 void setRequestParameters(RequestParameters requestParameters)
          Sets request parameters.
 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 String decodeURL(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 Locale getLocale()
Returns:
The locale for this request

getPage

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

getParameter

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

Parameters:
key - Parameter name
Returns:
Parameter value

getParameterMap

public abstract Map<String,String[]> getParameterMap()
Gets a map of (query) parameters sent with the request.

Returns:
Map of parameters

getParameters

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

Parameters:
key - Parameter name
Returns:
Parameter values

getPath

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

getRelativePathPrefixToContextRoot

public abstract 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 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

@Deprecated
public 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

setRequestParameters

public final void setRequestParameters(RequestParameters requestParameters)
Sets request parameters. Should only be used when one request is being created as a replacement for another.

Parameters:
requestParameters -

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 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 String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

getQueryString

public abstract String getQueryString()
Returns the query string (part after ?) of this request.

Returns:
request query string


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