com.ibm.portal.state
Interface PortletPreProcessor

All Superinterfaces:
ProcessingPhase

public interface PortletPreProcessor
extends ProcessingPhase

A PortletPreProcessor can be used to validate the state holder on a LayoutControl basis. A PortletPreProcessor is called for every layout control (representing an instance of the portlet that registered the portlet preprocessor) that can be found on the currently selected ContentPage. If there is no such layout control on the selected page, the preprocessor will not be called. Like global preprocessors implementing the PreProcessor interface, portlet preprocessors are also called at state decoding time after the state has been decoded from the URL, the session or the persistent store. They allow to apply validations or resolve inconsistencies in the navigational state with respect to session or persistent state. The state that becomes valid for the request is the state after applying modifications by the preprocessor.

Preprocessors will not be invoked concurrently by the framework. Typically the framework will use different preprocessor instances per thread, but different framework implementations could also use synchronization to guarantee this contract. The same java instance of preprocessors can however be used by different threads sequentially. Implementations of preprocessors should pre-calculate all thread-independent information, such as the result of JNDI lookups, in the constructor and store this data in instance variables.

To register a preprocessor for a portlet, declare an init parameter INIT_PARAMETER_KEY in the portlet deployment descriptor. The value of the init parameter references the preprocessor that has been registered as an extension for the extension point EXTENSION_POINT_ID in plugin.xml. See the example below for more details.

 portlet.xml:
 ...
     <init-param>
         <name>com.ibm.portal.model.PortletPreProcessor</name>
         <value>com.mycompany.portal.MyPortletPreProcessor</value>
     </init-param>
 ...
 
 plugin.xml:
     <?xml version="1.0" encoding="UTF-8"?>
     <?eclipse version="3.0"?>
     <plugin id="com.mycompany.portal.plugin" name="Portal Plug-in" version="1.0.0" provider-name="My Company">
         <extension point="com.ibm.portal.model.PortletPreProcessor">
             <preprocessor id="com.mycompany.portal.MyPortletPreProcessor" class="com.mycompany.portal.preprocessors.MyPortletPreProcessorImpl" />
         </extension>
     </plugin>
 
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:
6.1.0.3

Field Summary
static java.lang.String EXTENSION_POINT_ID
          Extension point to register portlet preprocessors.
static java.lang.String IMPLEMENTATION_CLASS
          Name of the attribute specifying the qualified implementation class.
static java.lang.String IMPLEMENTATION_ID
          Name of the attribute specifying the implementation identifier.
static java.lang.String INIT_PARAMETER_KEY
          Key of the init parameter that references the implementation identifier specified in plugin.xml.
 
Method Summary
 void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, StateHolderController state, LayoutControl layoutControl, ContentPage page)
          Performs validation operations on the given state holder for the addressed layout control.
 

Field Detail

EXTENSION_POINT_ID

static final java.lang.String EXTENSION_POINT_ID
Extension point to register portlet preprocessors.

See Also:
Constant Field Values

IMPLEMENTATION_ID

static final java.lang.String IMPLEMENTATION_ID
Name of the attribute specifying the implementation identifier.

See Also:
Constant Field Values

IMPLEMENTATION_CLASS

static final java.lang.String IMPLEMENTATION_CLASS
Name of the attribute specifying the qualified implementation class.

See Also:
Constant Field Values

INIT_PARAMETER_KEY

static final java.lang.String INIT_PARAMETER_KEY
Key of the init parameter that references the implementation identifier specified in plugin.xml.

See Also:
Constant Field Values
Method Detail

process

void process(javax.servlet.http.HttpServletRequest request,
             javax.servlet.http.HttpServletResponse response,
             StateHolderController state,
             LayoutControl layoutControl,
             ContentPage page)
             throws PortletPreProcessorException
Performs validation operations on the given state holder for the addressed layout control.

Parameters:
request - The current HttpServletRequest. Must not be null.
response - The current HttpServletResponse. Must not be null.
state - Modifiable copy of the state to operate on. Must not be null.
layoutControl - The LayoutControl representing an instance of the portlet that registered the preprocessor. Must not be null.
page - The ContentPage that is currently selected. The LayoutModel of the page contains the layout control that has been passed in via the layoutControl argument. Must not be null.
Throws:
PortletPreProcessorException - The state could not be validated, the request processing should be aborted.