org.apache.wicket.protocol.http.servlet
Class ServletWebRequest

java.lang.Object
  extended by org.apache.wicket.Request
      extended by org.apache.wicket.protocol.http.WebRequest
          extended by org.apache.wicket.protocol.http.servlet.ServletWebRequest
Direct Known Subclasses:
MultipartServletWebRequest, UploadWebRequest

public class ServletWebRequest
extends WebRequest

A Servlet specific WebRequest implementation wrapping a HttpServletRequest

Author:
Ate Douma

Constructor Summary
ServletWebRequest(javax.servlet.http.HttpServletRequest httpServletRequest)
          Protected constructor.
 
Method Summary
 int getDepthRelativeToWicketHandler()
          Gets the depth of this request relative to the Wicket handler.
 javax.servlet.http.HttpServletRequest getHttpServletRequest()
          Gets the wrapped http servlet request object.
 java.util.Locale getLocale()
          Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
 java.lang.String getParameter(java.lang.String key)
          Gets the request parameter with the given key.
 java.util.Map getParameterMap()
          Gets the request parameters.
 java.lang.String[] getParameters(java.lang.String key)
          Gets the request parameters with the given key.
 java.lang.String getPath()
          Gets the path info if any.
 java.lang.String getRelativePathPrefixToContextRoot()
          Gets a prefix to make this relative to the context root.
 java.lang.String getRelativePathPrefixToWicketHandler()
          Gets a prefix to make this relative to the Wicket Servlet/Filter.
 java.lang.String getServletPath()
          Gets the servlet path.
 java.lang.String getURL()
          Retrieves the relative URL of this request for local use.
 boolean isAjax()
          This will return true if the header "Wicket-Ajax" is set.
 boolean mergeVersion()
          This method by default calls isAjax(), wicket ajax request do have an header set.
 WebRequest newMultipartWebRequest(Bytes maxsize)
          Create a runtime context type specific (e.g.
 void setWicketRedirectUrl(java.lang.String wicketRedirectUrl)
          Set the redirect url where wicket will redirect to for the next page
 java.lang.String toString()
           
 
Methods inherited from class org.apache.wicket.protocol.http.WebRequest
getCookie, getCookies
 
Methods inherited from class org.apache.wicket.Request
decodeURL, getPage, getRelativeURL, getRequestParameters, setPage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServletWebRequest

public ServletWebRequest(javax.servlet.http.HttpServletRequest httpServletRequest)
Protected constructor.

Parameters:
httpServletRequest - The servlet request information
Method Detail

getHttpServletRequest

public final javax.servlet.http.HttpServletRequest getHttpServletRequest()
Gets the wrapped http servlet request object.

Specified by:
getHttpServletRequest in class WebRequest
Returns:
the wrapped http serlvet request object.

getLocale

public java.util.Locale getLocale()
Returns the preferred Locale that the client will accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.

Specified by:
getLocale in class WebRequest
Returns:
the preferred Locale for the client

getParameter

public java.lang.String getParameter(java.lang.String key)
Gets the request parameter with the given key.

Specified by:
getParameter in class WebRequest
Parameters:
key - Parameter name
Returns:
Parameter value

getParameterMap

public java.util.Map getParameterMap()
Gets the request parameters.

Specified by:
getParameterMap in class WebRequest
Returns:
Map of parameters

getParameters

public java.lang.String[] getParameters(java.lang.String key)
Gets the request parameters with the given key.

Specified by:
getParameters in class WebRequest
Parameters:
key - Parameter name
Returns:
Parameter values

getPath

public java.lang.String getPath()
Gets the path info if any.

Specified by:
getPath in class Request
Returns:
Any servlet path info

getRelativePathPrefixToContextRoot

public java.lang.String getRelativePathPrefixToContextRoot()
Description copied from class: Request
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.

Specified by:
getRelativePathPrefixToContextRoot in class Request
Returns:
Prefix relative to this request required to back up to context root.

getDepthRelativeToWicketHandler

public int getDepthRelativeToWicketHandler()
Gets the depth of this request relative to the Wicket handler.

Returns:
the depth

getRelativePathPrefixToWicketHandler

public java.lang.String getRelativePathPrefixToWicketHandler()
Description copied from class: Request
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.

Specified by:
getRelativePathPrefixToWicketHandler in class Request
Returns:
Prefix relative to this request required to back up to context root.

getURL

public java.lang.String getURL()
Description copied from class: Request
Retrieves the relative URL of this request for local use. This is relative to the context root.

Specified by:
getURL in class Request
Returns:
The relative request URL for local use
See Also:
Request.getURL()

getServletPath

public java.lang.String getServletPath()
Gets the servlet path.

Specified by:
getServletPath in class WebRequest
Returns:
Servlet path

isAjax

public boolean isAjax()
This will return true if the header "Wicket-Ajax" is set.

Specified by:
isAjax in class WebRequest
Returns:
True if the ajax is an ajax request. False if it's not.
See Also:
WebRequest.isAjax()

mergeVersion

public boolean mergeVersion()
This method by default calls isAjax(), wicket ajax request do have an header set. And for all the ajax request the versioning should be merged with the previous one. And when it sees that the current request is a redirect to page request the version will also be merged with the previous one because refresh in the browser or redirects to a page shouldn't generate a new version.

Overrides:
mergeVersion in class Request
Returns:
true if the version must be merged with the previous latest.
See Also:
Request.mergeVersion()

newMultipartWebRequest

public WebRequest newMultipartWebRequest(Bytes maxsize)
Description copied from class: WebRequest
Create a runtime context type specific (e.g. Servlet or Portlet) MultipartWebRequest wrapper for handling multipart content uploads.

Specified by:
newMultipartWebRequest in class WebRequest
Parameters:
maxsize - the maximum size this request may be
Returns:
new WebRequest wrapper implementing MultipartWebRequest
See Also:
WebRequest.newMultipartWebRequest(org.apache.wicket.util.lang.Bytes)

toString

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

setWicketRedirectUrl

public void setWicketRedirectUrl(java.lang.String wicketRedirectUrl)
Set the redirect url where wicket will redirect to for the next page

Parameters:
wicketRedirectUrl -


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