public class ServletWebRequest extends WebRequest
WebRequest
subclass that wraps a HttpServletRequest
object.HEADER_AJAX, HEADER_AJAX_BASE_URL, HEADER_ORIGIN, HEADER_REFERER, PARAM_AJAX, PARAM_AJAX_BASE_URL, PARAM_AJAX_REQUEST_ANTI_CACHE
Constructor and Description |
---|
ServletWebRequest(javax.servlet.http.HttpServletRequest httpServletRequest,
String filterPrefix)
Construct.
|
ServletWebRequest(javax.servlet.http.HttpServletRequest httpServletRequest,
String filterPrefix,
Url url)
Construct.
|
Modifier and Type | Method and Description |
---|---|
ServletWebRequest |
cloneWithUrl(Url url)
Returns request with specified URL and same POST parameters as this request.
|
protected Map<String,List<StringValue>> |
generatePostParameters() |
Charset |
getCharset()
Gets charset of the request
|
Url |
getClientUrl()
Returns base url without context or filter mapping.
|
javax.servlet.http.HttpServletRequest |
getContainerRequest()
Provides access to the low-level container request object that implementaion of this
Request delegate to. |
String |
getContextPath()
Returns the context path or an empty string if the application is running under root context.
|
List<javax.servlet.http.Cookie> |
getCookies() |
Time |
getDateHeader(String name)
Returns the value of the specified request header as a
long value that
represents a Date object. |
String |
getFilterPath()
Returns the path to which wicket Filter is mapped or an empty string if the filter is mapped
to
/* . |
String |
getFilterPrefix()
Returns the prefix of Wicket filter (without the leading /)
|
String |
getHeader(String name)
Returns the value of the specified request header as a
String |
List<String> |
getHeaders(String name)
Returns all the values of the specified request header.
|
Locale |
getLocale()
Returns locale for this request.
|
IRequestParameters |
getPostParameters() |
String |
getPrefixToContextPath()
Returns prefix from Wicket Filter mapping to context path.
|
Url |
getUrl()
Returns the URL for this request.
|
MultipartServletWebRequest |
newMultipartWebRequest(Bytes maxSize,
String upload)
Creates multipart web request from this request.
|
MultipartServletWebRequest |
newMultipartWebRequest(Bytes maxSize,
String upload,
org.apache.commons.fileupload.FileItemFactory factory)
Creates multipart web request from this request.
|
boolean |
shouldPreserveClientUrl()
Signals whether or not request processing should preserve the current client url - in other
words, handle this request without redirecting.
|
getCookie, getIfModifiedSinceHeader, isAjax
getOriginalUrl, getQueryParameters, getRequestParameters
public ServletWebRequest(javax.servlet.http.HttpServletRequest httpServletRequest, String filterPrefix)
httpServletRequest
- filterPrefix
- contentPath + filterPath, used to extract the actual Url
public Url getClientUrl()
Example: if current url is
http://localhost:8080/context/filter/mapping/wicket/bookmarkable/com.foo.Page?1&id=2the base url is wicket/bookmarkable/com.foo.Page
getClientUrl
in class Request
Request.getClientUrl()
public String getFilterPrefix()
public List<javax.servlet.http.Cookie> getCookies()
getCookies
in class WebRequest
public Locale getLocale()
Request
public Time getDateHeader(String name)
WebRequest
long
value that
represents a Date
object. Use this method with headers that contain dates, such
as If-Modified-Since
.getDateHeader
in class WebRequest
null
if not foundpublic String getHeader(String name)
WebRequest
String
getHeader
in class WebRequest
public List<String> getHeaders(String name)
WebRequest
getHeaders
in class WebRequest
protected Map<String,List<StringValue>> generatePostParameters()
public IRequestParameters getPostParameters()
getPostParameters
in class Request
public Url getUrl()
Request
public ServletWebRequest cloneWithUrl(Url url)
WebRequest
cloneWithUrl
in class WebRequest
url
- Url instancepublic MultipartServletWebRequest newMultipartWebRequest(Bytes maxSize, String upload) throws org.apache.commons.fileupload.FileUploadException
maxSize
- max allowed size of requestupload
- upload identifier for UploadInfo
org.apache.commons.fileupload.FileUploadException
public MultipartServletWebRequest newMultipartWebRequest(Bytes maxSize, String upload, org.apache.commons.fileupload.FileItemFactory factory) throws org.apache.commons.fileupload.FileUploadException
maxSize
- max allowed size of requestupload
- upload identifier for UploadInfo
factory
- org.apache.commons.fileupload.FileUploadException
public String getPrefixToContextPath()
Request
For example if Wicket filter is mapped to hello/* this method should return ../ regardless of actual URL (after Wicket filter)
getPrefixToContextPath
in class Request
public Charset getCharset()
Request
getCharset
in class Request
public javax.servlet.http.HttpServletRequest getContainerRequest()
Request
Request
delegate to. This allows users to access features provided by the container
requests but not by generalized Wicket Request
objects.getContainerRequest
in class Request
null
if nonepublic String getContextPath()
Request
getContextPath
in class Request
public String getFilterPath()
Request
/*
. Returned path, unless an empty string, will always start with a slash and will
never end with a slash.getFilterPath
in class Request
public boolean shouldPreserveClientUrl()
WebRequest
false
.
For example, this method can be used to preserve the url that caused a 404 in the browser if
Wicket is also responsible for rendering the 404 page. If this method returns the default
value of false
then Wicket will redirect to the bookmarkable url of the error page,
instead of preserving the url that caused the 404 in the browser.shouldPreserveClientUrl
in class WebRequest
true
if current client url should be preservedCopyright © 2006–2022 Apache Software Foundation. All rights reserved.