com.plumtree.remote.portlet
Interface IPortletRequest


public interface IPortletRequest

IPortletRequest represents the HTTP request sent from the portal to the Portlet. All of the parameters that are sent from the portal to the Portlet are accessible from IPortletRequest (some user-specific parameters are accessible from IPortletUser). Generally, a Portlet can obtain an IPortletRequest from IPortletContext.getRequest().


Method Summary
 AggregationMode getAggregationMode()
          Returns the current AggregationMode for the Portlet.
 Alignment getAlignment()
          Returns the alignment of the portlet.
 java.lang.String getBasicAuthPassword()
          Returns the password from the HTTP Authorization header in the web request.
 java.lang.String getBasicAuthUsername()
          Returns the username from the HTTP Authorization header in the web request.
 int getClassID()
          Returns the class ID.
 int getCommunityID()
          Returns the ID of the Community in which the Portlet is currently displayed.
 java.lang.String getEncryptedSettingValue(SettingType type, java.lang.String name, javax.crypto.Cipher crypto)
          Gives the value for any portal preference.
 java.lang.String getGatewayConfigValue(java.lang.String valueName)
          Returns the requested value from the CSP-Gateway-Specific-Config header.
 java.net.URL getHostPageURI()
          Returns the URI for the portal page in which the Portlet is currently displayed.
 java.lang.String getHostPageURLQueryString()
          Gets the query string portion of the URL that was used to access this portal's hosting page.
 java.net.URL getImageServerURI()
          Returns the URI for the portal Image Server.
 java.lang.String getLoginToken()
          Returns the user’s login token from the request.
 int getPageID()
          Returns the ID of the portal page on which the Portlet is currently displayed.
 java.lang.String getPortalUUID()
          Returns the portal UUID.
 int getPortletID()
          Returns the Portlet ID for the current Portlet.
 PortletMode getPortletMode()
          Returns a PortletMode object to tell the client what mode the Portlet is running in.
 java.lang.String getProtocolVersion()
          Returns the current version of the protocol being used by the portal to communicate with this Portlet.
 java.net.URL getRemoteAPIEndpoint()
          Returns the remote API endpoint from the portal request.
 java.net.URL getReturnURI()
          Returns the URI for the portal page to return to when done.
 java.util.Map getSettingCollection(SettingType type)
          Returns a map of all settings of the referenced setting type.
 java.lang.String getSettingValue(SettingType type, java.lang.String name)
          Gives the value for any portal preference.
 java.net.URL getStylesheetURI()
          Returns the URI for the stylesheet currently being used by the portal user.
 int getSubPortalID()
          Returns the ID of the subportal that the accessing user belongs to.
 java.util.TimeZone getTimeZone()
          Returns a TimeZone object representing the end user's time zone.
 UserInterface getUserInterface()
          Returns a UserInterface object to tell the client what type of device is being used to browse the portal (e.g., phone, PDA, standard Web browser).
 boolean hasBasicAuth()
          Returns whether the request has basic auth.
 boolean hasTimeZone()
          Returns a boolean indicating whether the time zone is available in the request headers.
 boolean isGatewayed()
          Checks if the request is gatewayed.
 boolean isInCommunity()
          Checks if Portlet is currently displayed in a Community page.
 

Method Detail

getSettingValue

public java.lang.String getSettingValue(SettingType type,
                                        java.lang.String name)
Gives the value for any portal preference. This method replaces the Get*Setting() methods in the 3.5 GDK.

Parameters:
type - the type of the setting (e.g., Admin, User, or Portlet)
name - the name of the setting
Returns:
the value of the setting and null if the setting was not sent
Throws:
NotGatewayedException - if the request is not gatewayed

getEncryptedSettingValue

public java.lang.String getEncryptedSettingValue(SettingType type,
                                                 java.lang.String name,
                                                 javax.crypto.Cipher crypto)
                                          throws CryptoException
Gives the value for any portal preference. Uses the cryptographer supplied by the client to unencrypt the setting value from the portal. For example:
IPortletRequest portletRequest = .....;//get IPortletRequest.
javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("DES"); //use DES algorithm.
String decryptedValue = portletRequest.getEncryptedSettingValue(SettingType.Admin, "password", cipher);
Note that the same Cipher should be used for both encryption and decryption.
See the javax.crypto.Cipher javadocs for the list of available algorithms.

Parameters:
type - the type of setting (e.g., Admin, User, or Portlet)
name - the name of the setting
crypto - the cryptographer that can decode the setting value
Returns:
the decoded setting value
Throws:
NotGatewayedException - if the request is not gatewayed
CryptoException - if there is an error decrypting the setting value

getSettingCollection

public java.util.Map getSettingCollection(SettingType type)
Returns a map of all settings of the referenced setting type.

Parameters:
type - the type of setting (e.g., Admin, User, or Portlet)
Returns:
a map of settings
Throws:
NotGatewayedException - if the request is not gatewayed

getUserInterface

public UserInterface getUserInterface()
Returns a UserInterface object to tell the client what type of device is being used to browse the portal (e.g., phone, PDA, standard Web browser).

Returns:
UserInterface
Throws:
NotGatewayedException - if the request is not gatewayed
ProtocolNotSupportedException - if the portal does not support the device type

getPortletMode

public PortletMode getPortletMode()
Returns a PortletMode object to tell the client what mode the Portlet is running in. The Portlet mode indicates whether the Portlet should display standard content or a summary for small-screened mobile devices. The mode also indicates if the Portlet is syndicated (running asynchronously).

Returns:
PortletMode instance, null if not found in request.
Throws:
NotGatewayedException - if the request is not gatewayed

hasTimeZone

public boolean hasTimeZone()
Returns a boolean indicating whether the time zone is available in the request headers.

Returns:
true if the time zone is available, false otherwise.
Throws:
NotGatewayedException - if the request is not gatewayed.

getTimeZone

public java.util.TimeZone getTimeZone()
                               throws NotInRequestException
Returns a TimeZone object representing the end user's time zone.

Returns:
TimeZone
Throws:
NotGatewayedException - if the request is not gatewayed
ProtocolNotSupportedException - if the portal does not support this feature
NotInRequestException

getLoginToken

public java.lang.String getLoginToken()
                               throws NotInRequestException
Returns the user’s login token from the request. The login token can be used to access the portal as the current user. To instantiate an IRemoteSession object, use IPortletContext.getRemotePortalSession(). Note: The login token is new functionality in version 5.0; this method throws ProtocolNotSupportedException when used with any prior version of the portal.

Returns:
the login token
Throws:
NotGatewayedException - if the request is not gatewayed
ProtocolNotSupportedException - if used with a version of the portal earlier than 5.0
NotInRequestException - if the administrator has not configured the portal to send the login token to this Portlet

getRemoteAPIEndpoint

public java.net.URL getRemoteAPIEndpoint()
Returns the remote API endpoint from the portal request. The remote API endpoint can be used to access the portal's remote SOAP API. To instantiate an IRemoteSession object, use IPortletContext.getRemotePortalSession(). Note: The remote API endpoint is new functionality in version 5.0; this method throws ProtocolNotSupportedException when used with any prior version of the portal.

Returns:
the remote API endpoint, or null if the portlet is run as a job.
Throws:
NotGatewayedException - if the request is not gatewayed
ProtocolNotSupportedException - if used with a version of the portal earlier than 5.0

getPortletID

public int getPortletID()
Returns the Portlet ID for the current Portlet.

Returns:
the Portlet ID
Throws:
NotGatewayedException - if the request is not gatewayed

getGatewayConfigValue

public java.lang.String getGatewayConfigValue(java.lang.String valueName)
                                       throws NotInRequestException
Returns the requested value from the CSP-Gateway-Specific-Config header.

Parameters:
valueName - name of the requested header value.
Returns:
the requested value from the header.
Throws:
NotGatewayedException - if the request is not gatewayed.
NotInRequestException - if there is nothing in the header with the requested name.

getPortalUUID

public java.lang.String getPortalUUID()
Returns the portal UUID.

Returns:
the portal UUID
Throws:
NotGatewayedException - if the request is not gatewayed
ProtocolNotSupportedException - if used with a version of the portal that does not support this feature

getClassID

public int getClassID()
Returns the class ID.

Returns:
the class ID
Throws:
NotGatewayedException - if the request is not gatewayed
ProtocolNotSupportedException - if used with a version of the portal that does not support this feature

getPageID

public int getPageID()
              throws NotInRequestException
Returns the ID of the portal page on which the Portlet is currently displayed. This is a new feature in version 5.0; this method throws ProtocolNotSupportedException when used with any prior version of the portal. The administrator must configure the portal to send the Page ID to the Portlet.

Returns:
the page ID
Throws:
NotGatewayedException - if the request is not gatewayed
ProtocolNotSupportedException - if used with version of the portal earlier than 5.0
NotInRequestException - if the administrator has not configured the portal to send the Page ID to the Portlet

getCommunityID

public int getCommunityID()
Returns the ID of the Community in which the Portlet is currently displayed.

Returns:
the Community ID
Throws:
NotGatewayedException - if the request is not gatewayed
NotInCommunityException - if the Portlet is not displayed in a Community page

getReturnURI

public java.net.URL getReturnURI()
Returns the URI for the portal page to return to when done. This URI is typically used when a Portlet's Preferences page is finished processing; the Portlet should always return the user to the portal page. Note: You can also use IPortletResponse.returnToPortal to return the user to the portal page.

Returns:
the URI for the portal page, or null if the portlet is run as a job.
Throws:
NotGatewayedException - if the request is not gatewayed

getHostPageURI

public java.net.URL getHostPageURI()
Returns the URI for the portal page in which the Portlet is currently displayed.

Returns:
the URI for the portal page, or null if the portlet is run as a job.
Throws:
NotGatewayedException - if the request is not gatewayed

getStylesheetURI

public java.net.URL getStylesheetURI()
Returns the URI for the stylesheet currently being used by the portal user.

Returns:
the URI for the stylesheet, or null if the portlet is run as a job.
Throws:
NotGatewayedException - if the request is not gatewayed

getImageServerURI

public java.net.URL getImageServerURI()
Returns the URI for the portal Image Server.

Returns:
the URI for the Image Server, or null if the portlet is run as a job.
Throws:
NotGatewayedException - if the request is not gatewayed

getAggregationMode

public AggregationMode getAggregationMode()
Returns the current AggregationMode for the Portlet. The aggregation mode indicates whether the Portlet is alone on the page or displayed with other Portlets.

Returns:
AggregationMode
Throws:
NotGatewayedException - if the request is not gatewayed
ProtocolNotSupportedException - if used with a version of the portal that does not support this feature

getProtocolVersion

public java.lang.String getProtocolVersion()
Returns the current version of the protocol being used by the portal to communicate with this Portlet.

Note: This will be returned in the en-us locale, i.e. '1.2'.

Returns:
the protocol version
Throws:
NotGatewayedException - if the request is not gatewayed

isGatewayed

public boolean isGatewayed()
Checks if the request is gatewayed.

Returns:
true if the request is gatewayed and false otherwise

getSubPortalID

public int getSubPortalID()
                   throws NotInRequestException
Returns the ID of the subportal that the accessing user belongs to.

Returns:
the subportal ID.
Throws:
NotGatewayedException - if the request is not gatewayed.
ProtocolNotSupportedException - if used with a version of the portal that does not support this feature.
NotInRequestException - if the administrator has not configured the portal to send the subportal ID to this portlet.

isInCommunity

public boolean isInCommunity()
Checks if Portlet is currently displayed in a Community page.

Returns:
true if the Portlet is displayed in a Community page and false otherwise
Throws:
NotGatewayedException - if the request is not gatewayed

getBasicAuthUsername

public java.lang.String getBasicAuthUsername()
                                      throws NotInRequestException
Returns the username from the HTTP Authorization header in the web request.

Returns:
the basic authentication username.
Throws:
NotInRequestException - if no Basic Auth username is present in the web request.

getBasicAuthPassword

public java.lang.String getBasicAuthPassword()
                                      throws NotInRequestException
Returns the password from the HTTP Authorization header in the web request.

Returns:
the basic authentication password.
Throws:
NotInRequestException - if no Basic Auth password is present in the web request.

hasBasicAuth

public boolean hasBasicAuth()
Returns whether the request has basic auth. Throws no exceptions as the auth may be present on a non-gatewayed request.

Returns:
true if and only if this request includes basic authorization information.

getAlignment

public Alignment getAlignment()
Returns the alignment of the portlet.

Returns:
the alignment.
Throws:
NotGatewayedException - if the request is not gatewayed.
ProtocolNotSupportedException - if used with a version of the portal that does not support this feature.

getHostPageURLQueryString

public java.lang.String getHostPageURLQueryString()
Gets the query string portion of the URL that was used to access this portal's hosting page.

Returns:
the query string
Throws:
NotGatewayedException - if the request is not gatewayed.
ProtocolNotSupportedException - if used with a version of the portal that does not support this feature.


For additional information on the IDK, including tutorials, blogs, code samples and more,see the AquaLogic User Interaction Developer Center on BEA dev2dev.

Copyright ©2007 BEA Systems, Inc. All Rights Reserved.