Module org.apache.wicket.core
Class ServletWebRequest
java.lang.Object
org.apache.wicket.request.Request
org.apache.wicket.request.http.WebRequest
org.apache.wicket.protocol.http.servlet.ServletWebRequest
- Direct Known Subclasses:
MultipartServletWebRequest
,WebSocketRequest
WebRequest
subclass that wraps a HttpServletRequest
object.- Author:
- Matej Knopp, Juergen Donnerstag, Igor Vaynberg
-
Field Summary
Fields inherited from class org.apache.wicket.request.http.WebRequest
HEADER_AJAX, HEADER_AJAX_BASE_URL, HEADER_ORIGIN, HEADER_REFERER, PARAM_AJAX, PARAM_AJAX_BASE_URL, PARAM_AJAX_REQUEST_ANTI_CACHE
-
Constructor Summary
ConstructorDescriptionServletWebRequest
(jakarta.servlet.http.HttpServletRequest httpServletRequest, String filterPrefix) Construct.ServletWebRequest
(jakarta.servlet.http.HttpServletRequest httpServletRequest, String filterPrefix, Url url) Construct. -
Method Summary
Modifier and TypeMethodDescriptioncloneWithUrl
(Url url) Returns request with specified URL and same POST parameters as this request.protected Map<String,
List<StringValue>> Gets charset of the requestReturns base url without context or filter mapping.jakarta.servlet.http.HttpServletRequest
Provides access to the low-level container request object that implementaion of thisRequest
delegate to.Returns the context path or an empty string if the application is running under root context.List<jakarta.servlet.http.Cookie>
getDateHeader
(String name) Returns the value of the specified request header as along
value that represents aDate
object.Returns the path to which wicket Filter is mapped or an empty string if the filter is mapped to/*
.Returns the prefix of Wicket filter (without the leading /)Returns the value of the specified request header as aString
getHeaders
(String name) Returns all the values of the specified request header.Returns locale for this request.Returns prefix from Wicket Filter mapping to context path.getUrl()
Returns the URL for this request.newMultipartWebRequest
(Bytes maxSize, String upload) Creates multipart web request from this request.newMultipartWebRequest
(Bytes maxSize, String upload, org.apache.commons.fileupload2.core.FileItemFactory factory) Creates multipart web request from this request.boolean
Signals whether or not request processing should preserve the current client url - in other words, handle this request without redirecting.Methods inherited from class org.apache.wicket.request.http.WebRequest
getCookie, getIfModifiedSinceHeader, isAjax
Methods inherited from class org.apache.wicket.request.Request
getOriginalUrl, getQueryParameters, getRequestParameters
-
Constructor Details
-
ServletWebRequest
public ServletWebRequest(jakarta.servlet.http.HttpServletRequest httpServletRequest, String filterPrefix) Construct.- Parameters:
httpServletRequest
-filterPrefix
- contentPath + filterPath, used to extract the actualUrl
-
ServletWebRequest
public ServletWebRequest(jakarta.servlet.http.HttpServletRequest httpServletRequest, String filterPrefix, Url url) Construct.- Parameters:
httpServletRequest
-filterPrefix
- contentPath + filterPath, used to extract the actualUrl
url
-
-
-
Method Details
-
getClientUrl
Returns base url without context or filter mapping.Example: if current url is
http://localhost:8080/context/filter/mapping/wicket/bookmarkable/com.foo.Page?1&id=2
the base url is wicket/bookmarkable/com.foo.Page- Specified by:
getClientUrl
in classRequest
- Returns:
- client url
- See Also:
-
getFilterPrefix
Returns the prefix of Wicket filter (without the leading /)- Returns:
- Wicket filter prefix
-
getCookies
- Specified by:
getCookies
in classWebRequest
- Returns:
- request cookies
-
getLocale
Description copied from class:Request
Returns locale for this request. -
getDateHeader
Description copied from class:WebRequest
Returns the value of the specified request header as along
value that represents aDate
object. Use this method with headers that contain dates, such asIf-Modified-Since
.- Specified by:
getDateHeader
in classWebRequest
- Returns:
- date value of request header or
null
if not found
-
getHeader
Description copied from class:WebRequest
Returns the value of the specified request header as aString
- Specified by:
getHeader
in classWebRequest
- Returns:
- string value of request header
-
getHeaders
Description copied from class:WebRequest
Returns all the values of the specified request header.- Specified by:
getHeaders
in classWebRequest
- Returns:
- unmodifiable list of header values
-
generatePostParameters
-
getPostParameters
- Overrides:
getPostParameters
in classRequest
- Returns:
- POST request parameters for this request.
-
getUrl
Description copied from class:Request
Returns the URL for this request. URL is relative to Wicket filter path. -
cloneWithUrl
Description copied from class:WebRequest
Returns request with specified URL and same POST parameters as this request.- Overrides:
cloneWithUrl
in classWebRequest
- Parameters:
url
- Url instance- Returns:
- request with specified URL.
-
newMultipartWebRequest
public MultipartServletWebRequest newMultipartWebRequest(Bytes maxSize, String upload) throws org.apache.commons.fileupload2.core.FileUploadException Creates multipart web request from this request.- Parameters:
maxSize
- max allowed size of requestupload
- upload identifier forUploadInfo
- Returns:
- multipart request
- Throws:
org.apache.commons.fileupload2.core.FileUploadException
-
newMultipartWebRequest
public MultipartServletWebRequest newMultipartWebRequest(Bytes maxSize, String upload, org.apache.commons.fileupload2.core.FileItemFactory factory) throws org.apache.commons.fileupload2.core.FileUploadException Creates multipart web request from this request.- Parameters:
maxSize
- max allowed size of requestupload
- upload identifier forUploadInfo
factory
-- Returns:
- multipart request
- Throws:
org.apache.commons.fileupload2.core.FileUploadException
-
getPrefixToContextPath
Description copied from class:Request
Returns prefix from Wicket Filter mapping to context path. This method does not take the actual URL into account.For example if Wicket filter is mapped to hello/* this method should return ../ regardless of actual URL (after Wicket filter)
- Overrides:
getPrefixToContextPath
in classRequest
- Returns:
- prefix to context path for this request.
-
getCharset
Description copied from class:Request
Gets charset of the request- Specified by:
getCharset
in classRequest
- Returns:
- request charset
-
getContainerRequest
Description copied from class:Request
Provides access to the low-level container request object that implementaion of thisRequest
delegate to. This allows users to access features provided by the container requests but not by generalized WicketRequest
objects.- Specified by:
getContainerRequest
in classRequest
- Returns:
- low-level container request object, or
null
if none
-
getContextPath
Description copied from class:Request
Returns the context path or an empty string if the application is running under root context. Returned path, unless an empty string, will always start with a slash and will never end with a slash.- Overrides:
getContextPath
in classRequest
- Returns:
- context path
-
getFilterPath
Description copied from class:Request
Returns the path to which wicket Filter is mapped or an empty string if the filter is mapped to/*
. Returned path, unless an empty string, will always start with a slash and will never end with a slash.- Overrides:
getFilterPath
in classRequest
- Returns:
- filter path
-
shouldPreserveClientUrl
Description copied from class:WebRequest
Signals whether or not request processing should preserve the current client url - in other words, handle this request without redirecting. By default, this method returnsfalse
. 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 offalse
then Wicket will redirect to the bookmarkable url of the error page, instead of preserving the url that caused the 404 in the browser.- Overrides:
shouldPreserveClientUrl
in classWebRequest
- Returns:
true
if current client url should be preserved
-