java.lang.Object | |
↳ | org.springframework.web.portlet.util.PortletUtils |
Miscellaneous utilities for portlet applications. Used by various framework classes.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clear all the render parameters from the javax.portlet.ActionResponse.
| |||||||||||
Expose the given Map as request attributes, using the keys as attribute names
and the values as corresponding attribute values.
| |||||||||||
Retrieve the first cookie with the given name.
| |||||||||||
Return an appropriate request object of the specified type, if available,
unwrapping the given request as far as necessary.
| |||||||||||
Return an appropriate response object of the specified type, if available,
unwrapping the given response as far as necessary.
| |||||||||||
Get the specified session attribute under the javax.portlet.PortletSession#PORTLET_SCOPE,
creating and setting a new attribute if no existing found.
| |||||||||||
Get the specified session attribute in the given scope,
creating and setting a new attribute if no existing found.
| |||||||||||
Return a map containing all parameters with the given prefix.
| |||||||||||
Return the real path of the given path within the web application,
as provided by the portlet container.
| |||||||||||
Check the given request for a session attribute of the given name
under the javax.portlet.PortletSession#PORTLET_SCOPE.
| |||||||||||
Check the given request for a session attribute of the given name in the given scope.
| |||||||||||
Check the given request for a session attribute of the given name under the
javax.portlet.PortletSession#PORTLET_SCOPE.
| |||||||||||
Check the given request for a session attribute of the given name in the given scope.
| |||||||||||
Return the best available mutex for the given session:
that is, an object to synchronize on for the given session.
| |||||||||||
Return the full name of a specific input type="submit" parameter
if it was sent in the request, either via a button (directly with name)
or via an image (name + ".x" or name + ".y").
| |||||||||||
Return the target page specified in the request.
| |||||||||||
Return the temporary directory for the current web application,
as provided by the portlet container.
| |||||||||||
Check if a specific input type="submit" parameter was sent in the request,
either via a button (directly with name) or via an image (name + ".x" or
name + ".y").
| |||||||||||
Pass all the action request parameters to the render phase by putting them into
the action response object.
| |||||||||||
Serve the resource as specified in the given request to the given response,
using the PortletContext's request dispatcher.
| |||||||||||
Set the session attribute with the given name to the given value in the given scope.
| |||||||||||
Set the session attribute with the given name to the given value under the javax.portlet.PortletSession#PORTLET_SCOPE.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Clear all the render parameters from the javax.portlet.ActionResponse. This may not be called when the action will call ActionResponse#sendRedirect sendRedirect.
response | the current action response |
---|
Expose the given Map as request attributes, using the keys as attribute names and the values as corresponding attribute values. Keys must be Strings.
request | current portlet request |
---|---|
attributes | the attributes Map |
Retrieve the first cookie with the given name. Note that multiple cookies can have the same name but different paths or domains.
request | current portlet request |
---|---|
name | cookie name |
null
if none is found
Return an appropriate request object of the specified type, if available, unwrapping the given request as far as necessary.
request | the portlet request to introspect |
---|---|
requiredType | the desired type of request object |
null
if none
of that type is available
Return an appropriate response object of the specified type, if available, unwrapping the given response as far as necessary.
response | the portlet response to introspect |
---|---|
requiredType | the desired type of response object |
null
if none
of that type is available
Get the specified session attribute under the javax.portlet.PortletSession#PORTLET_SCOPE, creating and setting a new attribute if no existing found. The given class needs to have a public no-arg constructor. Useful for on-demand state objects in a web tier, like shopping carts.
session | current portlet session |
---|---|
name | the name of the session attribute |
clazz | the class to instantiate for a new attribute |
IllegalArgumentException | if the session attribute could not be instantiated |
---|
Get the specified session attribute in the given scope, creating and setting a new attribute if no existing found. The given class needs to have a public no-arg constructor. Useful for on-demand state objects in a web tier, like shopping carts.
session | current portlet session |
---|---|
name | the name of the session attribute |
clazz | the class to instantiate for a new attribute |
scope | the session scope of this attribute |
IllegalArgumentException | if the session attribute could not be instantiated |
---|
Return a map containing all parameters with the given prefix. Maps single values to String and multiple values to String array.
For example, with a prefix of "spring_", "spring_param1" and "spring_param2" result in a Map with "param1" and "param2" as keys.
Similar to portlet javax.portlet.PortletRequest#getParameterMap(), but more flexible.
request | portlet request in which to look for parameters |
---|---|
prefix | the beginning of parameter names
(if this is null or the empty string, all parameters will match) |
Return the real path of the given path within the web application, as provided by the portlet container.
Prepends a slash if the path does not already start with a slash,
and throws a java.io.FileNotFoundException if the path cannot
be resolved to a resource (in contrast to
javax.portlet.PortletContext#getRealPath PortletContext's getRealPath
,
which simply returns null
).
portletContext | the portlet context of the web application |
---|---|
path | the relative path within the web application |
FileNotFoundException | if the path cannot be resolved to a resource |
---|
Check the given request for a session attribute of the given name under the javax.portlet.PortletSession#PORTLET_SCOPE. Throws an exception if there is no session or if the session has no such attribute in that scope.
Does not create a new session if none has existed before!
request | current portlet request |
---|---|
name | the name of the session attribute |
IllegalStateException | if the session attribute could not be found |
---|
Check the given request for a session attribute of the given name in the given scope. Throws an exception if there is no session or if the session has no such attribute in that scope.
Does not create a new session if none has existed before!
request | current portlet request |
---|---|
name | the name of the session attribute |
scope | session scope of this attribute |
IllegalStateException | if the session attribute could not be found |
---|
Check the given request for a session attribute of the given name under the
javax.portlet.PortletSession#PORTLET_SCOPE.
Returns null
if there is no session or if the session has no such attribute in that scope.
Does not create a new session if none has existed before!
request | current portlet request |
---|---|
name | the name of the session attribute |
null
if not found
Check the given request for a session attribute of the given name in the given scope.
Returns null
if there is no session or if the session has no such attribute in that scope.
Does not create a new session if none has existed before!
request | current portlet request |
---|---|
name | the name of the session attribute |
scope | session scope of this attribute |
null
if not found
Return the best available mutex for the given session: that is, an object to synchronize on for the given session.
Returns the session mutex attribute if available; usually,
this means that the
HttpSessionMutexListener
needs to be defined in web.xml
. Falls back to the
javax.portlet.PortletSession itself if no mutex attribute found.
The session mutex is guaranteed to be the same object during
the entire lifetime of the session, available under the key defined
by the SESSION_MUTEX_ATTRIBUTE
constant. It serves as a safe reference to synchronize on for locking
on the current session.
In many cases, the javax.portlet.PortletSession reference itself is a safe mutex as well, since it will always be the same object reference for the same active logical session. However, this is not guaranteed across different servlet containers; the only 100% safe way is a session mutex.
session | the HttpSession to find a mutex for |
---|
null
)Return the full name of a specific input type="submit" parameter if it was sent in the request, either via a button (directly with name) or via an image (name + ".x" or name + ".y").
request | current portlet request |
---|---|
name | name of the parameter |
Return the target page specified in the request.
request | current portlet request |
---|---|
paramPrefix | the parameter prefix to check for (e.g. "_target" for parameters like "_target1" or "_target2") |
currentPage | the current page, to be returned as fallback if no target page specified |
Return the temporary directory for the current web application, as provided by the portlet container.
portletContext | the portlet context of the web application |
---|
Check if a specific input type="submit" parameter was sent in the request, either via a button (directly with name) or via an image (name + ".x" or name + ".y").
request | current portlet request |
---|---|
name | name of the parameter |
Pass all the action request parameters to the render phase by putting them into the action response object. This may not be called when the action will call javax.portlet.ActionResponse#sendRedirect sendRedirect.
request | the current action request |
---|---|
response | the current action response |
Serve the resource as specified in the given request to the given response, using the PortletContext's request dispatcher.
This is roughly equivalent to Portlet 2.0 GenericPortlet.
request | the current resource request |
---|---|
response | the current resource response |
context | the current Portlet's PortletContext |
propagated from Portlet API's forward method | |
IOException | propagated from Portlet API's forward method |
PortletException |
Set the session attribute with the given name to the given value in the given scope.
Removes the session attribute if value is null
, if a session existed at all.
Does not create a new session if not necessary!
request | current portlet request |
---|---|
name | the name of the session attribute |
value | the value of the session attribute |
scope | session scope of this attribute |
Set the session attribute with the given name to the given value under the javax.portlet.PortletSession#PORTLET_SCOPE.
Removes the session attribute if value is null
, if a session existed at all.
Does not create a new session if not necessary!
request | current portlet request |
---|---|
name | the name of the session attribute |
value | the value of the session attribute |