public interface Request
The WServlet
class is the generic servlet that sits between the
servlet container and the WComponent framework. The WServlet class is responsible for creating Request objects that
represent the incoming HTTP requests, and for dispatching them to the WComponent tree.
WServlet
Modifier and Type | Method and Description |
---|---|
boolean |
containsSameData(Request other)
Indicates whether the given request contains the same set of parameters as this one.
|
String |
getAppPreferenceParameter(String key)
Gets the parameter for the given key.
|
Serializable |
getAppSessionAttribute(String key)
Deprecated.
portlet specific
|
Serializable |
getAttribute(String key)
Returns the value of the named attribute as an
Object , or null if no attribute of the
given name exists. |
byte[] |
getFileContents(String key)
If the request parameter is a file attachment, use this method to access the content of the attached file.
|
org.apache.commons.fileupload.FileItem |
getFileItem(String key)
Deprecated.
As of 25/05/2015, replaced by
getFileItems(java.lang.String) |
org.apache.commons.fileupload.FileItem[] |
getFileItems(String key)
If the request parameter is a file attachment, use this method to access the parsed
FileItem []. |
Map<String,org.apache.commons.fileupload.FileItem[]> |
getFiles()
Retrieves the files which were uploaded in this request.
|
int |
getMaxInactiveInterval()
Returns the maximum time interval, in seconds, that the servlet container will keep this session open between
client accesses.
|
String |
getMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
|
String |
getParameter(String key)
Returns the value of a request parameter as a
String , or null if the parameter does not
exist. |
Enumeration |
getParameterNames() |
Map<String,String[]> |
getParameters() |
String[] |
getParameterValues(String key)
Returns an array of
String objects containing all of the values the given request parameter has, or
null if the parameter does not exist. |
Serializable |
getRenderParameter(String key)
Deprecated.
portal specific. user
getSessionAttribute(String) |
Serializable |
getSessionAttribute(String key)
Returns the object bound with the specified name in this session, or
null if no object is bound
under the name. |
boolean |
isLogout() |
boolean |
isUserInRole(String role)
Returns a boolean indicating whether the authenticated user is included in the specified logical "role".
|
void |
logout()
Signal to the servlet that we want to log out (terminate the session).
|
void |
setAppSessionAttribute(String key,
Serializable value)
Deprecated.
portlet specific
|
void |
setAttribute(String key,
Serializable value)
Stores an attribute in this request.
|
void |
setEvent(String action,
HashMap<String,Serializable> eventMap)
Deprecated.
portal specific
|
void |
setEvent(String action,
String parameter,
Serializable value)
Deprecated.
portal specific
|
void |
setRenderParameter(String key,
Serializable value)
Deprecated.
portal specific. user
setSessionAttribute(String, Serializable) |
void |
setSessionAttribute(String key,
Serializable value)
Binds an object to this session, using the name specified.
|
String getParameter(String key)
String
, or null
if the parameter does not
exist. Request parameters are extra information sent with the request. For HTTP servlets, parameters are
contained in the query string or posted form data.
You should only use this method when you are sure the parameter has only one value. If the parameter might have
more than one value, use getParameterValues(java.lang.String)
.
If you use this method with a multivalued parameter, the value returned is equal to the first value in the array
returned by getParameterValues
.
key
- a String
specifying the key/name of the parameterString
representing the single value of the parametergetParameterValues(java.lang.String)
String[] getParameterValues(String key)
String
objects containing all of the values the given request parameter has, or
null
if the parameter does not exist.
If the parameter has a single value, the array has a length of 1.
key
- a String
containing the key/name of the parameter whose value is requestedString
objects containing the parameter's valuesgetParameter(java.lang.String)
byte[] getFileContents(String key)
key
- the name of the parameter used to pass the file content.org.apache.commons.fileupload.FileItem getFileItem(String key)
getFileItems(java.lang.String)
FileItem
.key
- the name of the parameter used to pass the file content.FileItem
representing the uploaded file.org.apache.commons.fileupload.FileItem[] getFileItems(String key)
FileItem
[].key
- the name of the parameter used to pass the file content.FileItem
[] representing the uploaded files.Enumeration getParameterNames()
Enumeration
of String
objects containing the names of the parameters
contained in this request. If the request has no parameters, the method returns an empty
Enumeration
.Map<String,String[]> getParameters()
Map
.Map<String,org.apache.commons.fileupload.FileItem[]> getFiles()
boolean containsSameData(Request other)
other
- the request to check.Serializable getAttribute(String key)
Returns the value of the named attribute as an Object
, or null
if no attribute of the
given name exists.
Attributes can be set two ways. The container may set attributes to make available custom information about a request. Attributes can also be set programatically using setAttribute.
key
- the request attribute keyObject
containing the value of the attribute, or null
if the attribute does
not existvoid setAttribute(String key, Serializable value)
key
- the attribute keyvalue
- the attribute valueSerializable getSessionAttribute(String key)
null
if no object is bound
under the name.key
- the session attribute keyObject
containing the value of the attribute, or null
if the attribute does
not exist@Deprecated Serializable getAppSessionAttribute(String key)
null
if no object is
bound under the name.
This method is relevant for portlets in which case getAppSessionAttribute accesses a portlet scoped session, while getSessionAttribute accesses the global session.
key
- the session attribute keyObject
containing the value of the attribute, or null
if the attribute does
not existvoid setSessionAttribute(String key, Serializable value)
If the value passed in is null, this has the same effect as removing the attribute.
key
- the session attribute key.value
- an Object
containing the value of the attribute.@Deprecated void setAppSessionAttribute(String key, Serializable value)
If the value passed in is null, this has the same effect as removing the attribute.
This method is relevant for portlets in which case getAppSessionAttribute accesses a portlet scoped session, while getSessionAttribute accesses the global session.
key
- the session attribute key.value
- an Object
containing the value of the attribute.String getAppPreferenceParameter(String key)
key
- the preference parameter key.void logout()
boolean isLogout()
logout()
has been calledvoid setEvent(String action, String parameter, Serializable value)
value
as the event payload.action
- name of the publishing event to triggerparameter
- the key for the event payload valuevalue
- the value of the event payloadvoid setEvent(String action, HashMap<String,Serializable> eventMap)
eventMap
as the event payload.action
- name of the publishing event to triggereventMap
- the key/value pair for the event payloadvoid setRenderParameter(String key, Serializable value)
setSessionAttribute(String, Serializable)
key
- The key for the parameter.value
- The value of the parameter.Serializable getRenderParameter(String key)
getSessionAttribute(String)
key
- The key for the parameter.boolean isUserInRole(String role)
role
- a String specifying the name of the role.String getMethod()
String
specifying the name of the method with which this request was madeint getMaxInactiveInterval()
Copyright © 2021. All rights reserved.