com.ibm.portal.state.accessors.portlet
Interface PortletTargetAccessorController

All Superinterfaces:
Accessor, Disposable
All Known Subinterfaces:
LegacyPortletTargetAccessorController

public interface PortletTargetAccessorController
extends Accessor

Controller interface which allows for declaring an object as a target of a request. Typically the controller is used to declare a portlet window as a render-, action-, or resource-target in order to create render- action-, or resource-URLs. Action URLs are supposed to be executed using HTTP POST whereas render URLs are to be executed via HTTP GET. Resource URLs can be used in conjunction with HTTP GET or POST depending on the concrete use case they are used for.

Note that each URL can target one object only. If the setTarget() method is invoked multiple times for different objects, the controller will clear any target information which is already part of the state holder prior to writing the new target information.

Keep in mind that action URLs (URLs which encode an action target) are protected via the "Dangerous URL Protection (DUP)" feature of WebSphere Portal. DUP makes sure that each action URL is bound to the user session (if any) the URL was created in. As a consequence, DUP does not allow for executing such a URL in the scope of a different user session. If done anyway, DUP will refuse to execute the encoded action. DUP is not applied to action URLs which are created on public portal pages.

Action URLs that are mistakenly executed via HTTP GET can only be executed once to make sure that a click on the browser's Back, Forward, or Refresh button does not re-execute the action. This is important because actions are tyically used for unsafe operations a user can be held accountable for. This behavior can be customized via the portlet init parameter "wps.multiple.action.execution" in portlet.xml.

NOTE: This API may only be used in the scope of an HTTP request in WebSphere Portal, i.e. within a theme. The API can not be invoked directly by a custom servlet.

Since:
5.1

Method Summary
 java.util.Map<java.lang.String,java.lang.String[]> getParameters()
          Returns a modifiable map of target parameters (String -> String[]).
 void setActionTarget(javax.servlet.http.HttpServletRequest request, ObjectID id)
          Deprecated. Use setTarget(TargetType, ObjectID) instead.
 void setActionTarget(javax.servlet.http.HttpServletRequest request, java.lang.String uniqueName)
          Deprecated. Use setTarget(TargetType, String) instead.
 void setActionTarget(ObjectID id)
          Deprecated. Use setTarget(TargetType, ObjectID) instead.
 void setActionTarget(ObjectID id, java.lang.String actionID)
           
 void setActionTarget(java.lang.String uniqueName)
          Deprecated. Use setTarget(TargetType, String) instead.
 void setActionTarget(java.lang.String uniqueName, java.lang.String actionID)
           
 void setRenderTarget(ObjectID id)
          Deprecated. Use setTarget(TargetType, ObjectID) instead.
 void setRenderTarget(java.lang.String uniqueName)
          Deprecated. Use setTarget(TargetType, String) instead.
 void setResourceCacheability(java.lang.String resourceCacheability)
          Sets the resource cacheability.
 void setResourceID(java.lang.String resourceID)
          Sets a resource ID.
 void setTarget(TargetType targetType, ObjectID id)
          Declares the object with the given ObjectID as a request target.
 void setTarget(TargetType targetType, java.lang.String uniqueName)
          Declares the object with the given unique name as a request target.
 
Methods inherited from interface com.ibm.portal.Disposable
dispose
 

Method Detail

setTarget

void setTarget(TargetType targetType,
               ObjectID id)
Declares the object with the given ObjectID as a request target. Use this method for example to create portlet render-, action-, or resource URLs by passing in the appropriate TargetType.

Parameters:
targetType - The type of the target. Must not be null.
id - The ObjectID of the target object (typically a portlet window). Must not be null.
Since:
6.1.0

setActionTarget

void setActionTarget(ObjectID id,
                     java.lang.String actionID)

setActionTarget

void setActionTarget(java.lang.String uniqueName,
                     java.lang.String actionID)
                     throws MissingUniqueNameException,
                            UnknownUniqueNameException
Throws:
MissingUniqueNameException
UnknownUniqueNameException

setTarget

void setTarget(TargetType targetType,
               java.lang.String uniqueName)
               throws MissingUniqueNameException,
                      UnknownUniqueNameException
Declares the object with the given unique name as a request target. Use this method for example to create portlet render-, action-, or resource URLs by passing in the appropriate TargetType.

Parameters:
targetType - The type of the target. Must not be null.
uniqueName - String representing the unique name of the target object (typically a portlet window). Must not be null.
Throws:
MissingUniqueNameException
UnknownUniqueNameException
Since:
6.1.0

getParameters

java.util.Map<java.lang.String,java.lang.String[]> getParameters()
Returns a modifiable map of target parameters (String -> String[]). The parameter map is prefilled with the target parameters which are already encoded in the state the controller operates on.

Returns:
A modifiable map of target parameters. Not null.
Since:
6.1.0

setResourceID

void setResourceID(java.lang.String resourceID)
Sets a resource ID. This method is only applicable for targets that are of type TargetType.PORTLET_RESOURCE. Nevertheless this method does not explicitly prohibit to set a resource ID for other target types in cases where setTarget(TargetType, ObjectID) is called after this method.

Parameters:
resourceID - The resource ID to set. Must not be null.
Since:
6.1.0

setResourceCacheability

void setResourceCacheability(java.lang.String resourceCacheability)
Sets the resource cacheability. This method is only applicable for targets that are of type TargetType.PORTLET_RESOURCE. Nevertheless this method does not explicitly prohibit to set the resource cacheability for other target types in cases where setTarget(TargetType, ObjectID) is called after this method.

Parameters:
resourceCacheability - The resource cacheability to set. Must not be null.
Since:
6.1.0

setActionTarget

void setActionTarget(javax.servlet.http.HttpServletRequest request,
                     ObjectID id)
                     throws CannotSetTargetException
Deprecated. Use setTarget(TargetType, ObjectID) instead.

Declares the portlet window with the given ObjectID as an action target. Use this method to create a portlet action URL. Note that action URLs are subject to the security constraints outlined above.

Parameters:
id - The ObjectID of the portlet window that should be addressed. Must not be null.
request - The current HttpServletRequest or null.
Throws:
CannotSetTargetException - If the target information cannot be written to the underlying state.

setActionTarget

void setActionTarget(javax.servlet.http.HttpServletRequest request,
                     java.lang.String uniqueName)
                     throws MissingUniqueNameException,
                            UnknownUniqueNameException,
                            CannotSetTargetException
Deprecated. Use setTarget(TargetType, String) instead.

Declares the portlet window with the given unique name as an action target. Use this method to create a portlet action URL. Note that action URLs are subject to the security constraints outlined above.

Parameters:
uniqueName - String representing the unique name of the portlet window that should be addressed. Must not be null.
request - The current HttpServletRequest or null.
Throws:
CannotSetTargetException - If the target information cannot be written to the underlying state.
MissingUniqueNameException - If the unique name is missing
UnknownUniqueNameException - If the unique name cannot be converted into a ObjectID.

setActionTarget

void setActionTarget(ObjectID id)
Deprecated. Use setTarget(TargetType, ObjectID) instead.

Declares the portlet window with the given ObjectID as an action target. Use this method to create a portlet action URL. Note that action URLs are subject to the security constraints outlined above.

Parameters:
id - The ObjectID of the portlet window that should be addressed. Must not be null.

setActionTarget

void setActionTarget(java.lang.String uniqueName)
                     throws MissingUniqueNameException,
                            UnknownUniqueNameException
Deprecated. Use setTarget(TargetType, String) instead.

Declares the portlet window with the given unique name as an action target. Use this method to create a portlet action URL. Note that action URLs are subject to the security constraints outlined above.

Parameters:
uniqueName - String representing the unique name of the portlet window that should be addressed. Must not be null.
Throws:
MissingUniqueNameException - If the unique name is missing.
UnknownUniqueNameException - If the unique name cannot be converted into a ObjectID.

setRenderTarget

void setRenderTarget(ObjectID id)
Deprecated. Use setTarget(TargetType, ObjectID) instead.

Declares the portlet window with the given ObjectID as a render target. Use this method to create a portlet render URL.

Parameters:
id - The ObjectID of the portlet window that should be addressed. Must not be null.

setRenderTarget

void setRenderTarget(java.lang.String uniqueName)
                     throws MissingUniqueNameException,
                            UnknownUniqueNameException
Deprecated. Use setTarget(TargetType, String) instead.

Declares the portlet window with the given unique name as a render target. Use this method to create a portlet render URL.

Parameters:
uniqueName - String representing the unique name of the portlet window that should be addressed. Must not be null.
Throws:
MissingUniqueNameException - If the unique name is missing.
UnknownUniqueNameException - If the unique name cannot be converted into a ObjectID.