Oracle Fusion Middleware
Java API Reference for Oracle PDK Java
11g Release 1 (11.1.1)
E10691-01

oracle.portal.provider.v2.render.http
Class StrutsRenderer

java.lang.Object
  extended by oracle.portal.provider.v2.render.ManagedRenderer
      extended by oracle.portal.provider.v2.render.http.BaseManagedRenderer
          extended by oracle.portal.provider.v2.render.http.AbstractResourceRenderer
              extended by oracle.portal.provider.v2.render.http.StrutsRenderer
All Implemented Interfaces:
Validateable, InitializableXMLObject

public class StrutsRenderer
extends AbstractResourceRenderer

This class is used as an adapter to a Struts application.

There are two modes of behaviour for this renderer chosen by calling setActionInSession with true or false.

In the default (false) mode the Struts action is passed into the renderer as a persistent parameter generated by one of the PDK specific navigation tags. This then becomes a resource path to which the request is forwarded.

The first time a portlet instance using this renderer is called there is no Struts action in the request and the action specified in the method setDefaultAction is used instead.

If setActionInSession is called with true, as well as the behaviour described above, the Struts action is saved as a session attribute. This enables the state or page of a Struts portlet to be stored when a user navigates away from a page containing a Struts portlet. It does of course mean that the provider must be session based to use this feature.


Field Summary
static java.lang.String STRUTS_ACTION
          The Struts action parameter name
 
Constructor Summary
StrutsRenderer()
          This constructor is called by a RenderManager object.
 
Method Summary
 java.lang.String getDefaultAction()
          Returns the default Struts servlet action.
 java.lang.String getRequestResourcePath(PortletRenderRequest prr)
          Returns a context relative path pointing to the resource to be rendered, in this case it is a Struts action path.
 void setActionInSession(boolean storeAction)
          Sets the flag to choose whether or not to store the Struts action in the provider session.
 void setActionInSession(java.lang.String storeAction)
          Sets the flag to choose whether or not to store the Struts action in the provider session.
 void setDefaultAction(java.lang.String action)
          Sets the default Struts servlet action to be used if none is present in the portlet request.
 void validate(java.lang.String context, ValidationError errors)
          Called by the framework when the provider definition is loaded or refreshed in response to a Portal message or when the test page is called.
 
Methods inherited from class oracle.portal.provider.v2.render.http.AbstractResourceRenderer
getCharSet, getContext, prepareResponse, renderBody, setCharSet
 
Methods inherited from class oracle.portal.provider.v2.render.http.BaseManagedRenderer
addParameter, getContentType, getGeneratesESI, postInitialize, preInitialize, setContentType, setGeneratesESI, setGeneratesESI, setPageExpires, setPageExpires, setUseInvalidationCaching, setUseInvalidationCaching
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRUTS_ACTION

public static final java.lang.String STRUTS_ACTION
The Struts action parameter name

See Also:
Constant Field Values
Constructor Detail

StrutsRenderer

public StrutsRenderer()
This constructor is called by a RenderManager object. Pre- initialisation checks are carried out by the framework in BaseManagedRenderer.preInitialize(java.lang.Object).

Method Detail

validate

public void validate(java.lang.String context,
                     ValidationError errors)
Called by the framework when the provider definition is loaded or refreshed in response to a Portal message or when the test page is called.

Specified by:
validate in interface Validateable
Overrides:
validate in class BaseManagedRenderer
Parameters:
context - The context of the calling instance.
errors - The current list of errors.

setDefaultAction

public void setDefaultAction(java.lang.String action)
Sets the default Struts servlet action to be used if none is present in the portlet request.

Most likely to be called when the provider definition is loaded.

Parameters:
action - the default action name. The code uses an action name starting with the '/' character but will add one if none is present.

getDefaultAction

public java.lang.String getDefaultAction()
Returns the default Struts servlet action.

Returns:
the default action

setActionInSession

public void setActionInSession(boolean storeAction)
Sets the flag to choose whether or not to store the Struts action in the provider session.

If set to true and if a user navigates away from a Portal page that includes a Struts portlet and then back again, the Struts application state is stored as a session attribute. By default, this flag is false.

Parameters:
storeAction - action stored in session if set to true

setActionInSession

public void setActionInSession(java.lang.String storeAction)
Sets the flag to choose whether or not to store the Struts action in the provider session.

If set to true and if a user navigates away from a Portal page that includes a Struts portlet and then back again, the Struts application state is restored. By default, this flag is set to false.

Parameters:
storeAction - action stored in session if set to "true" or "TRUE"

getRequestResourcePath

public java.lang.String getRequestResourcePath(PortletRenderRequest prr)
                                        throws PortletException
Returns a context relative path pointing to the resource to be rendered, in this case it is a Struts action path.

The first time the renderer is called the default action will be returned. Subsequent calls will contain the Struts action as a parameter unless the renderer is set to store the action as a session attribute.

Specified by:
getRequestResourcePath in class AbstractResourceRenderer
Parameters:
prr - the portlet request
Throws:
PortletException

Oracle Fusion Middleware
Java API Reference for Oracle PDK Java
11g Release 1 (11.1.1)
E10691-01

Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.