org.apache.jetspeed.portlet
Interface PortletRequest

All Known Subinterfaces:
SaxPortletRequest

public interface PortletRequest

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

Author:
Thomas F. Boehme
See Also:
PortletResponse

Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          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 object representing the client device that the user connects to the portal with.
 PortletData getData()
          Returns the data of the virtual instance of this portlet If the portlet is run in CONFIGURE mode, the portlet data is not accessible and this method will return null.
 java.util.Locale getLocale()
          Returns the locale of the preferred language.
 java.lang.String getMethod()
          Returns the HTTP method of this request.
 Portlet.Mode getMode()
          Returns the mode that the portlet is running in.
 java.lang.String getParameter(java.lang.String name)
          Returns the value of the parameter with the given name, or null if no such parameter exists.
 java.util.Map getParameterMap()
          Returns a map of the parameters of this request.
 java.util.Enumeration getParameterNames()
          Returns an enumeration of all parameter names.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns the values of all parameters with the given name.
 PortletSession getSession()
          Returns the current session or, if there is no current session, it creates one and returns it.
 PortletSession getSession(boolean create)
          Returns the current session or, if there is no current session and the given flag is true, it creates one and returns it.
 PortletWindow getWindow()
          Returns the window that the portlet is running in.
 boolean isSecure()
          Returns whether this request was made using a secure channel, such as HTTPS.
 void removeAttribute(java.lang.String name)
          Removes the attribute with the given name.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Associates an attribute with the given name and value with this request.
 

Method Detail

getMode

public Portlet.Mode getMode()
Returns the mode that the portlet is running in.

Returns:
the portlet mode

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

getLocale

public java.util.Locale getLocale()
Returns the locale of the preferred language. The preference 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

getClient

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

Returns:
the client

getParameter

public java.lang.String getParameter(java.lang.String name)
Returns the value of the parameter with the given name, or null if no such parameter exists.

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

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

getParameterMap

public java.util.Map getParameterMap()
Returns a map of the parameters of this request.

Returns:
a map of parameters
See Also:
getParameter(String), 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 name)
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:
name - the parameter name
Returns:
the array of parameter values
See Also:
getParameterMap(), getParameter(String)

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
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.

Parameters:
name - the attribute name
value - the attribute value

removeAttribute

public void removeAttribute(java.lang.String name)
Removes the attribute with the given name.

Parameters:
name - the name of attribute to be removed

getAttribute

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

Parameters:
name - 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

isSecure

public boolean isSecure()
Returns whether this request was made using a secure channel, such as HTTPS.

Returns:
true if channel is secure,
false otherwise

getWindow

public PortletWindow getWindow()
Returns the window that the portlet is running in.

Returns:
the portlet window

getData

public PortletData getData()
Returns the data of the virtual instance of this portlet

If the portlet is run in CONFIGURE mode, the portlet data is not accessible and this method will return null.

Returns:
the portlet data

getSession

public PortletSession getSession()
Returns the current session or, if there is no current session, it creates one and returns it.

Returns:
the portlet session

getSession

public PortletSession getSession(boolean create)
Returns the current session or, if there is no current session and the given flag is true, it creates one and returns it.

If the given flag is false and there is no current portlet session, this method returns null.

Parameters:
create - true to create a news session,
false to return null of there is no current session
Returns:
the portlet session


Copyright © 2002 Apache Software Foundation. All Rights Reserved.