|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The PortletRequest
defines the base interface to provide client
request information to a portlet. The portlet container uses two specialized
versions of this interface when invoking a portlet, ActionRequest
and RenderRequest
. The portlet container creates these objects and
passes them as arguments to the portlet's processAction
and
render
methods.
ActionRequest
,
RenderRequest
Field Summary | |
static java.lang.String |
BASIC_AUTH
String identifier for Basic authentication. |
static java.lang.String |
CLIENT_CERT_AUTH
String identifier for Certification based authentication. |
static java.lang.String |
DIGEST_AUTH
String identifier for Digest based authentication. |
static java.lang.String |
FORM_AUTH
String identifier for Form based authentication. |
static java.lang.String |
USER_INFO
Used to retrieve user information attributes with the getAttribute call. |
Method Summary | |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the named attribute as an Object ,
or null if no attribute of the given name exists. |
java.util.Enumeration |
getAttributeNames()
Returns an Enumeration containing the
names of the attributes available to this request. |
java.lang.String |
getAuthType()
Returns the name of the authentication scheme used for the connection between client and portal, for example, BASIC_AUTH , CLIENT_CERT_AUTH ,
a custom one or null if there was no authentication. |
java.lang.String |
getContextPath()
Returns the context path which is the path prefix associated with the deployed portlet application. |
java.util.Locale |
getLocale()
Returns the preferred Locale in which the portal will accept content. |
java.util.Enumeration |
getLocales()
Returns an Enumeration of Locale objects indicating, in decreasing order starting with the preferred locale in which the portal will accept content for this request. |
java.lang.String |
getParameter(java.lang.String name)
Returns the value of a request parameter as a String ,
or null if the parameter does not exist. |
java.util.Map |
getParameterMap()
Returns a Map of the parameters of this request. |
java.util.Enumeration |
getParameterNames()
Returns an Enumeration of String
objects containing the names of the parameters contained
in this request. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Returns an array of String objects containing
all of the values the given request parameter has, or
null if the parameter does not exist. |
PortalContext |
getPortalContext()
Returns the context of the calling portal. |
PortletMode |
getPortletMode()
Returns the current portlet mode of the portlet. |
PortletSession |
getPortletSession()
Returns the current portlet session or, if there is no current session, creates one and returns the new session. |
PortletSession |
getPortletSession(boolean create)
Returns the current portlet session or, if there is no current session and the given flag is true , creates one and returns
the new session. |
PortletPreferences |
getPreferences()
Returns the preferences object associated with the portlet. |
java.util.Enumeration |
getProperties(java.lang.String name)
Returns all the values of the specified request property as a Enumeration of String objects. |
java.lang.String |
getProperty(java.lang.String name)
Returns the value of the specified request property as a String . |
java.util.Enumeration |
getPropertyNames()
Returns a Enumeration of all the property names
this request contains. |
java.lang.String |
getRemoteUser()
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. |
java.lang.String |
getRequestedSessionId()
Returns the session ID indicated in the client request. |
java.lang.String |
getResponseContentType()
Returns the portal preferred content type for the response. |
java.util.Enumeration |
getResponseContentTypes()
Gets a list of content types which the portal accepts for the response. |
java.lang.String |
getScheme()
Returns the name of the scheme used to make this request. |
java.lang.String |
getServerName()
Returns the host name of the server that received the request. |
int |
getServerPort()
Returns the port number on which this request was received. |
java.security.Principal |
getUserPrincipal()
Returns a java.security.Principal object containing the name of the current authenticated user. |
WindowState |
getWindowState()
Returns the current window state of the portlet. |
boolean |
isPortletModeAllowed(PortletMode mode)
Returns true, if the given portlet mode is a valid one to set for this portlet in the context of the current request. |
boolean |
isRequestedSessionIdValid()
Checks whether the requested session ID is still valid. |
boolean |
isSecure()
Returns a boolean indicating whether this request was made using a secure channel between client and the portal, such as HTTPS. |
boolean |
isUserInRole(java.lang.String role)
Returns a boolean indicating whether the authenticated user is included in the specified logical "role". |
boolean |
isWindowStateAllowed(WindowState state)
Returns true, if the given window state is valid to be set for this portlet in the context of the current request. |
void |
removeAttribute(java.lang.String name)
Removes an attribute from this request. |
void |
setAttribute(java.lang.String name,
java.lang.Object o)
Stores an attribute in this request. |
Field Detail |
public static final java.lang.String BASIC_AUTH
public static final java.lang.String FORM_AUTH
public static final java.lang.String CLIENT_CERT_AUTH
public static final java.lang.String DIGEST_AUTH
public static final java.lang.String USER_INFO
getAttribute
call. The user information is returned
as a Map
object. The portlet must define the
user information attribute it is interested in inside the
user-attribute
section of the deployment descriptor.
If an attribute is not supported
by the current runtime system it will not show up in the user
attribute map.null
value.
If the user-attribute is not defined for the current user it will not show up in the Map.
The value is javax.portlet.userinfo
.
Method Detail |
public boolean isWindowStateAllowed(WindowState state)
state
- window state to checked
public boolean isPortletModeAllowed(PortletMode mode)
mode
- portlet mode to check
public PortletMode getPortletMode()
public WindowState getWindowState()
public PortletPreferences getPreferences()
public PortletSession getPortletSession()
Creating a new portlet session will result in creating
a new HttpSession
on which the portlet session is based on.
public PortletSession getPortletSession(boolean create)
true
, creates one and returns
the new session.
If the given flag is false
and there is no current
portlet session, this method returns null
.
Creating a new portlet session will result in creating
a new HttpSession
on which the portlet session is based on.
create
- true
to create a new session, false
to return null
if there
is no current session
public java.lang.String getProperty(java.lang.String name) throws java.lang.IllegalArgumentException
String
. If the request did not include a property
of the specified name, this method returns null
.
A portlet can access portal/portlet-container specific properties through this method and, if available, the headers of the HTTP client request.
This method should only be used if the
property has only one value. If the property might have
more than one value, use getProperties(java.lang.String)
.
If this method is used with a multivalued
parameter, the value returned is equal to the first value
in the Enumeration returned by getProperties
.
name
- a String
specifying the
property name
String
containing the
value of the requested
property, or null
if the request does not
have a property of that name.
java.lang.IllegalArgumentException
- if name is null
.public java.util.Enumeration getProperties(java.lang.String name) throws java.lang.IllegalArgumentException
Enumeration
of String
objects.
If the request did not include any propertys
of the specified name, this method returns an empty
Enumeration
.
The property name is case insensitive. You can use
this method with any request property.
name
- a String
specifying the
property name
Enumeration
containing
the values of the requested property. If
the request does not have any properties of
that name return an empty Enumeration
.
java.lang.IllegalArgumentException
- if name is null
.public java.util.Enumeration getPropertyNames()
Enumeration
of all the property names
this request contains. If the request has no
properties, this method returns an empty Enumeration
.
Enumeration
of all the
property names sent with this
request; if the request has
no properties, an empty Enumeration
.public PortalContext getPortalContext()
public java.lang.String getAuthType()
BASIC_AUTH
, CLIENT_CERT_AUTH
,
a custom one or null
if there was no authentication.
BASIC_AUTH
,
FORM_AUTH
, CLIENT_CERT_AUTH
,
DIGEST_AUTH
(suitable for == comparison)
indicating the authentication scheme,
a custom one, or
null
if the request was
not authenticated.public java.lang.String getContextPath()
To encode a URL the PortletResponse.encodeURL(java.lang.String)
method must be used.
String
specifying the
portion of the request URL that indicates the context
of the requestPortletResponse.encodeURL(java.lang.String)
public java.lang.String getRemoteUser()
String
specifying the login
of the user making this request, or null
if the user login is not known.public java.security.Principal getUserPrincipal()
java.security.Principal
containing
the name of the user making this request, or
null
if the user has not been
authenticated.public boolean isUserInRole(java.lang.String role)
false
.
role
- a String
specifying the name
of the role
boolean
indicating whether
the user making this request belongs to a given role;
false
if the user has not been
authenticated.public java.lang.Object getAttribute(java.lang.String name) throws java.lang.IllegalArgumentException
Object
,
or null
if no attribute of the given name exists.
Attribute names should follow the same conventions as package
names. This specification reserves names matching java.*
,
and javax.*
.
In a distributed portlet web application the Object
needs to be serializable.
name
- a String
specifying the name of
the attribute
Object
containing the value
of the attribute, or null
if
the attribute does not exist.
java.lang.IllegalArgumentException
- if name is null
.public java.util.Enumeration getAttributeNames()
Enumeration
containing the
names of the attributes available to this request.
This method returns an empty Enumeration
if the request has no attributes available to it.
Enumeration
of strings
containing the names
of the request attributes, or an empty
Enumeration
if the request
has no attributes available to it.public java.lang.String getParameter(java.lang.String name) throws java.lang.IllegalArgumentException
String
,
or null
if the parameter does not exist. Request parameters
are extra information sent with the request. The returned parameter
are "x-www-form-urlencoded" decoded.
Only parameters targeted to the current portlet are accessible.
This method should only be used if the
parameter has only one value. If the parameter might have
more than one value, use getParameterValues(java.lang.String)
.
If this method is used with a multivalued
parameter, the value returned is equal to the first value
in the array returned by getParameterValues
.
name
- a String
specifying the
name of the parameter
String
representing the
single value of the parameter
java.lang.IllegalArgumentException
- if name is null
.getParameterValues(java.lang.String)
public java.util.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
.
Only parameters targeted to the current portlet are returned.
Enumeration
of String
objects, each String
containing
the name of a request parameter; or an
empty Enumeration
if the
request has no parameters.public java.lang.String[] getParameterValues(java.lang.String name) throws java.lang.IllegalArgumentException
String
objects containing
all of the values the given request parameter has, or
null
if the parameter does not exist.
The returned parameters are "x-www-form-urlencoded" decoded.
If the parameter has a single value, the array has a length of 1.
name
- a String
containing the name of
the parameter the value of which is requested
String
objects
containing the parameter values.
java.lang.IllegalArgumentException
- if name is null
.getParameter(java.lang.String)
public java.util.Map getParameterMap()
Map
of the parameters of this request.
Request parameters are extra information sent with the request.
The returned parameters are "x-www-form-urlencoded" decoded.
The values in the returned Map
are from type
String array (String[]
).
If no parameters exist this method returns an empty Map
.
Map
containing parameter names as
keys and parameter values as map values, or an empty Map
if no parameters exist. The keys in the parameter
map are of type String. The values in the parameter map are of type
String array (String[]
).public boolean isSecure()
public void setAttribute(java.lang.String name, java.lang.Object o) throws java.lang.IllegalArgumentException
Attribute names should follow the same conventions as
package names. Names beginning with java.*
,
javax.*
, and com.sun.*
are
reserved for use by Sun Microsystems.
If the value passed into this method is null
,
the effect is the same as calling removeAttribute(java.lang.String)
.
name
- a String
specifying
the name of the attributeo
- the Object
to be stored
java.lang.IllegalArgumentException
- if name is null
.public void removeAttribute(java.lang.String name) throws java.lang.IllegalArgumentException
Attribute names should follow the same conventions as
package names. Names beginning with java.*
,
javax.*
, and com.sun.*
are
reserved for use by Sun Microsystems.
name
- a String
specifying
the name of the attribute to be removed
java.lang.IllegalArgumentException
- if name is null
.public java.lang.String getRequestedSessionId()
null
.
String
specifying the session
ID, or null
if the request did
not specify a session IDisRequestedSessionIdValid()
public boolean isRequestedSessionIdValid()
true
if this
request has an id for a valid session
in the current session context;
false
otherwisegetRequestedSessionId()
,
getPortletSession()
public java.lang.String getResponseContentType()
The content type only includes the MIME type, not the character set.
Only content types that the portlet has defined in its
deployment descriptor are valid return values for
this method call. If the portlet has defined
'*'
or '* / *'
as supported content
types, these may also be valid return values.
public java.util.Enumeration getResponseContentTypes()
The content type only includes the MIME type, not the character set.
Only content types that the portlet has defined in its
deployment descriptor are valid return values for
this method call. If the portlet has defined
'*'
or '* / *'
as supported content
types, these may also be valid return values.
public java.util.Locale getLocale()
public java.util.Enumeration getLocales()
public java.lang.String getScheme()
http
, https
, or ftp
.
Different schemes have different rules for constructing URLs,
as noted in RFC 1738.
String
containing the name
of the scheme used to make this requestpublic java.lang.String getServerName()
String
containing the name
of the server to which the request was sentpublic int getServerPort()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |