org.apache.jetspeed.portal
Interface PortletRequest


public interface PortletRequest

The PortletRequest encapsulates the request sent by the client device to the portlet.

It is up the portlet container to enhance, extends, or modify the response as required before it is actually sent to the client.

See Also:
PortletResponse

Inner Class Summary
static class PortletRequest.Type
           
 
Field Summary
static PortletRequest.Type ADMIN
           The Portlet API should cater for a flexible administration of portlet too, however, the access policies need to be put in place in that case!
static PortletRequest.Type ADMIN_SAVE
           
static PortletRequest.Type CONTENT
           
static PortletRequest.Type DETAILS
           
static PortletRequest.Type EDIT
           
static PortletRequest.Type EDIT_SAVE
           
static PortletRequest.Type HELP
           
 
Method Summary
 java.lang.Object getAttribute(java.lang.String aName)
          Returns the value of the attribute with the given name, or null if no attribute with the given name exists.
 java.util.Enumeration getAttributeNames()
          Returns an enumeration of names of all attributes available to this request.
 Client getClient()
          Returns an objects representing the client device that the user connects to the portal with.
 javax.servlet.http.Cookie[] getCookies()
          Returns an array containing all cookies that the portal stored on behalf of the client.
 java.util.Locale getLocale()
          Returns the locale of the preferred language.
 java.util.Enumeration getLocales()
          Returns an enumeration of locales indicating, in decreasing order starting with the locale of the preferred languages, the preferred languages.
 MediaType getMediaType()
          Returns the preferred media-type.
 java.util.Enumeration getMediaTypes()
          Returns an array of media-types in decreasing order of preferrence.
 java.lang.String getMethod()
          Returns the HTTP method of this request.
 java.lang.String getParameter(java.lang.String aName)
          Returns the value of the parameter with the given name.
 java.util.Enumeration getParameterNames()
          Returns an enumeration of all parameter names.
 java.lang.String[] getParameterValues(java.lang.String aName)
          Returns the values of all parameters with the given name.
 javax.servlet.ServletRequest getServletRequest()
          Returns the original servlet request as sent by the client device.
 PortletSession getSession()
          Returns the current session associated with this request.
 PortletRequest.Type getType()
          Returns the type of this request.
 void setAttribute(java.lang.String aName, java.lang.Object aValue)
          Associates an attribute with the given name and value with this request.
 

Field Detail

CONTENT

public static final PortletRequest.Type CONTENT

DETAILS

public static final PortletRequest.Type DETAILS

EDIT

public static final PortletRequest.Type EDIT

EDIT_SAVE

public static final PortletRequest.Type EDIT_SAVE

HELP

public static final PortletRequest.Type HELP

ADMIN

public static final PortletRequest.Type ADMIN
The Portlet API should cater for a flexible administration of portlet too, however, the access policies need to be put in place in that case!

ADMIN_SAVE

public static final PortletRequest.Type ADMIN_SAVE
Method Detail

getType

public PortletRequest.Type getType()
Returns the type of this request.
Returns:
the type

getMethod

public java.lang.String getMethod()
Returns the HTTP method of this request. The most commonly used request methods are GET and POST.
Returns:
the method

getClient

public Client getClient()
Returns an objects representing the client device that the user connects to the portal with.
Returns:
the client

getLocale

public java.util.Locale getLocale()
Returns the locale of the preferred language. The preferrence is based on the user's choice of language(s) and/or the client's Accept-Language header.

If more than one language is preferred, the locale returned by this method is the one with the highest preference.

Returns:
the locale of the preferred language
See Also:
getLocales()

getLocales

public java.util.Enumeration getLocales()
Returns an enumeration of locales indicating, in decreasing order starting with the locale of the preferred languages, the preferred languages. The preference is based on the user's choice of language(s) and/or the client's Accept-Language header.
Returns:
an enumeration of locales of preferred languages
See Also:
getLocale()

getMediaType

public MediaType getMediaType()
Returns the preferred media-type.
Returns:
the media-type

getMediaTypes

public java.util.Enumeration getMediaTypes()
Returns an array of media-types in decreasing order of preferrence. Still weak on this subject -- need to check current Jetspeed implementation/ideas.
Returns:
an enumeration of media-types

getParameter

public java.lang.String getParameter(java.lang.String aName)
Returns the value of the parameter with the given name.

You should only use this method when you are sure the parameter has only one value. If not, use getParameterValues(String)

Parameters:
aName - the parameter name
Returns:
the parameter value
See Also:
getParameterValues(String)

getParameterNames

public java.util.Enumeration getParameterNames()
Returns an enumeration of all parameter names. If this request
Returns:
the enumeration

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String aName)
Returns the values of all parameters with the given name.

A request can carry more than one parameter with a certain name. This method returns these parameters in the order of appearance.

Parameters:
aName - the parameter name
Returns:
the array of parameter values
See Also:
getParameter(String)

setAttribute

public void setAttribute(java.lang.String aName,
                         java.lang.Object aValue)
Associates an attribute with the given name and value with this request. If a portlet needs to communicate information to embedded servlets or JSP, this methods can used carry the information along.

The portlet provider should take care that the the namespace of attribute names is not unnecessarily polluted. It is recommended to prefix all attributes the package and class name of the portlet that makes use of this method. The prefixing should probably be done by the portlet container.

Parameters:
aName - the attribute name
aValue - the attribute value

getAttribute

public java.lang.Object getAttribute(java.lang.String aName)
Returns the value of the attribute with the given name, or null if no attribute with the given name exists.
Parameters:
aName - the attribute name
Returns:
the attribute value

getAttributeNames

public java.util.Enumeration getAttributeNames()
Returns an enumeration of names of all attributes available to this request. This method returns an empty enumeration if the request has no attributes available to it.
Returns:
an enumeration of attribute names

getCookies

public javax.servlet.http.Cookie[] getCookies()
Returns an array containing all cookies that the portal stored on behalf of the client. This method returns null if no cookies were previously stored.
Returns:
an array of cookies
See Also:
PortletResponse.addCookie(Cookie)

getSession

public PortletSession getSession()
Returns the current session associated with this request.
Returns:
the current session

getServletRequest

public javax.servlet.ServletRequest getServletRequest()
Returns the original servlet request as sent by the client device. We have two schools of thought here: one that wants to hide anything "dangerous" or "internal", another that wants to have an "expert" mode. This method (along with its counterpart in PortletResponse) really needs to be carefully considered.
Returns:
the underlying servlet request
See Also:
PortletResponse.getServletResponse()