WebRequest adapter for a JSF jakarta.faces.context.FacesContext .
Requires JSF 2.0 or higher, as of Spring 4.0.
| Access | Constructor and Description |
|---|---|
| public | FacesWebRequest(FacesContext
the current FacesContext facesContext)Create a new FacesWebRequest adapter for the given FacesContext. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | checkNotModified(long
the last-modified timestamp in
milliseconds that the application determined for the underlying
resource lastModifiedTimestamp)Implements org. |
| public boolean | checkNotModified(String
the entity tag that the application determined
for the underlying resource. This parameter will be padded
with quotes (") if necessary. eTag)Implements org. ETag (entity tag), as determined by the application.
|
| public boolean | checkNotModified(String
the entity tag that the application determined
for the underlying resource. This parameter will be padded
with quotes (") if necessary. etag, long the last-modified timestamp in
milliseconds that the application determined for the underlying
resource lastModifiedTimestamp)Implements org. ETag (entity tag) and last-modified timestamp,
as determined by the application.
|
| public String | getContextPath()
Implements org. |
| public String | getDescription(boolean
whether to include client-specific
information such as session id and user name includeClientInfo)Implements org. |
| public String | getHeader(String headerName)
Implements org. null if none.
|
| public Iterator | getHeaderNames()
Implements org. |
| public String[] | getHeaderValues(String headerName)
Implements org. null if none.
|
| public Locale | getLocale()
Implements org. |
| public Object | getNativeRequest()
Implements org. |
| public <T> T | getNativeRequest(Class<T>
the desired type of request object requiredType)Implements org. |
| public Object | getNativeResponse()
Implements org. |
| public <T> T | getNativeResponse(Class<T>
the desired type of response object requiredType)Implements org. |
| public String | getParameter(String paramName)
Implements org. null if none.
|
| public Map | getParameterMap()
Implements org. |
| public Iterator | getParameterNames()
Implements org. |
| public String[] | getParameterValues(String paramName)
Implements org. null if none.
|
| public String | getRemoteUser()
Implements org. |
| public Principal | getUserPrincipal()
Implements org. |
| public boolean | isSecure()
Implements org. |
| public boolean | isUserInRole(String role)
Implements org. |
| public String |
| FacesWebRequest | back to summary |
|---|---|
| public FacesWebRequest(FacesContext facesContext) Create a new FacesWebRequest adapter for the given FacesContext.
| |
| checkNotModified | back to summary |
|---|---|
| public boolean checkNotModified(long lastModifiedTimestamp) Implements org. Doc from org. Check whether the requested resource has been modified given the supplied last-modified timestamp (as determined by the application). This will also transparently set the "Last-Modified" response header and HTTP status when applicable. Typical usage:
public String myHandleMethod(WebRequest request, Model model) {
long lastModified = // application-specific calculation
if (request.checkNotModified(lastModified)) {
// shortcut exit - no further processing necessary
return null;
}
// further request processing, actually building content
model.addAttribute(...);
return "myViewName";
}
This method works with conditional GET/HEAD requests, but also with conditional POST/PUT/DELETE requests. Note you can use either
this If the "If-Modified-Since" header is set but cannot be parsed to a date value, this method will ignore the header and proceed with setting the last-modified timestamp on the response.
| |
| checkNotModified | back to summary |
|---|---|
| public boolean checkNotModified(String eTag) Implements org. Doc from org. Check whether the requested resource has been modified given the
supplied This will also transparently set the "ETag" response header and HTTP status when applicable. Typical usage:
public String myHandleMethod(WebRequest request, Model model) {
String eTag = // application-specific calculation
if (request.checkNotModified(eTag)) {
// shortcut exit - no further processing necessary
return null;
}
// further request processing, actually building content
model.addAttribute(...);
return "myViewName";
}Note you can use either
this | |
| checkNotModified | back to summary |
|---|---|
| public boolean checkNotModified(String etag, long lastModifiedTimestamp) Implements org. Doc from org. Check whether the requested resource has been modified given the
supplied This will also transparently set the "ETag" and "Last-Modified" response headers, and HTTP status when applicable. Typical usage:
public String myHandleMethod(WebRequest request, Model model) {
String eTag = // application-specific calculation
long lastModified = // application-specific calculation
if (request.checkNotModified(eTag, lastModified)) {
// shortcut exit - no further processing necessary
return null;
}
// further request processing, actually building content
model.addAttribute(...);
return "myViewName";
}
This method works with conditional GET/HEAD requests, but also with conditional POST/PUT/DELETE requests. Note The HTTP specification recommends
setting both ETag and Last-Modified values, but you can also
use
| |
| getContextPath | back to summary |
|---|---|
| public String getContextPath() Implements org. Doc from org. Return the context path for this request (usually the base path that the current web application is mapped to).
| |
| getDescription | back to summary |
|---|---|
| public String getDescription(boolean includeClientInfo) Implements org. Doc from org. Get a short description of this request, typically containing request URI and session id. | |
| getHeader | back to summary |
|---|---|
| public String getHeader(String headerName) Implements org. Doc from org. Return the request header of the given name, or Retrieves the first header value in case of a multi-value header. | |
| getHeaderNames | back to summary |
|---|---|
| public Iterator Implements org. Doc from org. Return an Iterator over request header names.
| |
| getHeaderValues | back to summary |
|---|---|
| public String[] getHeaderValues(String headerName) Implements org. Doc from org. Return the request header values for the given header name,
or A single-value header will be exposed as an array with a single element. | |
| getLocale | back to summary |
|---|---|
| public Locale getLocale() Implements org. Doc from org. Return the primary Locale for this request.
| |
| getNativeRequest | back to summary |
|---|---|
| public Object getNativeRequest() Implements org. Doc from org. Return the underlying native request object.
| |
| getNativeRequest | back to summary |
|---|---|
| public <T> T getNativeRequest(Class<T> requiredType) Implements org. Doc from org. Return the underlying native request object, if available.
| |
| getNativeResponse | back to summary |
|---|---|
| public Object getNativeResponse() Implements org. Doc from org. Return the underlying native response object, if any.
| |
| getNativeResponse | back to summary |
|---|---|
| public <T> T getNativeResponse(Class<T> requiredType) Implements org. Doc from org. Return the underlying native response object, if available.
| |
| getParameter | back to summary |
|---|---|
| public String getParameter(String paramName) Implements org. Doc from org. Return the request parameter of the given name, or Retrieves the first parameter value in case of a multi-value parameter. | |
| getParameterMap | back to summary |
|---|---|
| public Map Implements org. Doc from org. Return an immutable Map of the request parameters, with parameter names as map keys and parameter values as map values. The map values will be of type String array. A single-value parameter will be exposed as an array with a single element.
| |
| getParameterNames | back to summary |
|---|---|
| public Iterator Implements org. Doc from org. Return an Iterator over request parameter names.
| |
| getParameterValues | back to summary |
|---|---|
| public String[] getParameterValues(String paramName) Implements org. Doc from org. Return the request parameter values for the given parameter name,
or A single-value parameter will be exposed as an array with a single element. | |
| getRemoteUser | back to summary |
|---|---|
| public String getRemoteUser() Implements org. Doc from org. Return the remote user for this request, if any. | |
| getUserPrincipal | back to summary |
|---|---|
| public Principal getUserPrincipal() Implements org. Doc from org. Return the user principal for this request, if any. | |
| isSecure | back to summary |
|---|---|
| public boolean isSecure() Implements org. Doc from org. Return whether this request has been sent over a secure transport mechanism (such as SSL).
| |
| isUserInRole | back to summary |
|---|---|
| public boolean isUserInRole(String role) Implements org. Doc from org. Determine whether the user is in the given role for this request.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |