Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.portal.struts.portlet
Class StrutsPortlet

    java.lang.Object
      GenericPortlet
          com.ibm.portal.struts.portlet.StrutsPortlet

    public class StrutsPortlet

extends GenericPortlet

Class specified in the portlet deployment descriptor for Struts-based portlets. This class can be subclassed to customize the behavior of the portlet. In general, the WpRequestProcessor should be subclassed to customize the behavior of the Struts applicaton, and this class should be subclassed to affect the Portal behavior.

Since:
  5.1

Field Summary
`protected static MessageResources` | `messages` The message resources for the Struts Portlet Framework.
`static java.lang.String` | `STRUTS_SERVLET_MAPPING_KEY` The key used to identify the Struts servlet mapping in the servlet context.

Constructor Summary
`StrutsPortlet()` StrutsPortlet constructor.

Method Summary
`protected WpActionServlet` | `createActionServlet(ServletContext servletContext, ServletConfig servletConfig, PortletConfig portletConfig, StrutsInfo strutsInfo)` Returns the ActionServlet.
`protected ViewCommandExecutionContext` | `createCommandExecutionContext(PortletContext portletContext, ModuleContext moduleContext, ServletContext servletContext)` Creates a ViewCommandExecutionContext to be used when executing a ViewCommand.
`protected PortletRequest` | `createPortletRequestWrapper(PortletRequest portletRequest)` Creates a portlet request wrapper.
`protected void` | `createWelcomeFileCommand(PortletRequest request, PortletResponse response)` Creates the welcome file command.
`void` | `destroy()` Called by the portlet container to indicate to a portlet that the portlet is being taken out of service.
`protected void` | `destroyCommandManagerPlugin(PortletConfig portletConfig)` Destroys a plugin by calling the destroy method of the plugin.
`void` | `doConfigure(RenderRequest request, RenderResponse response)` Render method for configure mode.
`protected void` | `doDispatch(RenderRequest request, RenderResponse response)` Support for config mode
`void` | `doEdit(RenderRequest request, RenderResponse response)` Render method for edit mode.
`void` | `doHelp(RenderRequest request, RenderResponse response)` Render method for help mode.
`protected void` | `doService(RenderRequest renderRequest, RenderResponse renderResponse)` The common processing for doView, doHelp, doConfigure and doEdit.
`void` | `doView(RenderRequest request, RenderResponse response)` Render method for view mode.
`WpActionServlet` | `getActionServlet()` Returns the ActionServlet object.
`protected ServletConfig` | `getServletConfigWrapper(PortletConfig portletConfig)` Gets the serlvet config wrapper.
`protected ServletContext` | `getServletContextWrapper()` Returns the Servlet Context Wrapper
`protected ServletContext` | `getServletContextWrapper(PortletConfig portletConfig, ServletContext servletContext)` Returns a servlet context that namescopes the attributes to the portlet.
`StrutsInfo` | `getStrutsInfo()` Returns the StrutsInfo object.
`java.lang.String` | `getStrutsRoot()` Returns the Struts context root.
`protected java.util.Vector` | `getWelcomeFileList(ServletContext servletContext)` Gets the welcome file list from the web.xml file.
`protected java.util.List` | `getWelcomeFileList(ServletContext servletContext, PortletContext portletContext, PortletRequest portletRequest)` Gets the welcome file list.
`void` | `init(PortletConfig portletConfig)` Called by the portlet container to indicate to a portlet that the portlet is being placed into service.
`protected void` | `initCommandManagerPlugin(PortletConfig portletConfig)` Initializes a plugin.
`void` | `processAction(ActionRequest aRequest, ActionResponse aResponse)` Called by the portlet container to allow the portlet to process an action request.
`protected void` | `processActionPerformed(PortletRequest pRequest, PortletResponse pResponse)` The processing for actionPerformed.
`protected void` | `processLocale(PortletRequest request)` Sets the locale for Jakarta Struts in session to the locale obtained from the portlet request object.
`void` | `processStrutsAction(PortletRequest aRequest, PortletResponse aResponse, java.lang.String strutsAction)` Calls the appropriate Struts request processor's process method for the specified Struts action.
`protected void` | `readInitParameters(ServletContext servletContext, PortletConfig portletConfig, StrutsInfo strutsInfo)` Reads the init parameters for this portlet from the web deployment descriptor and performs the appropriate configuration.
`void` | `setCommonsLogFactory()` Previously used to set a commons logger using the System property.
`protected static void` | `setupBase(PortletRequest request, PortletResponse response, PortletConfig config)` Allows BaseImplUtils to set up the processing.
`protected void` | `setupRenderPhase(PortletRequest request)` Sets up the render phase.
`protected void` | `setupRequestPhase(PortletRequest request)` Sets up the request phase.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### messages

    protected static MessageResources messages

  The message resources for the Struts Portlet Framework.

### STRUTS_SERVLET_MAPPING_KEY

    public static final java.lang.String STRUTS_SERVLET_MAPPING_KEY

  The key used to identify the Struts servlet mapping in the servlet context.

  See Also:
    Constant Field Values

Constructor Detail

### StrutsPortlet

    public StrutsPortlet()

  StrutsPortlet constructor.

Method Detail

### getActionServlet

    public WpActionServlet getActionServlet()

  Returns the ActionServlet object.

  Returns:
    returns the WpActionServlet object

### getStrutsInfo

    public StrutsInfo getStrutsInfo()

  Returns the StrutsInfo object.

  Returns:
    returns the StrutsInfo object

### getStrutsRoot

    public java.lang.String getStrutsRoot()

  Returns the Struts context root.

  Returns:
    returns the Struts context root

### getServletContextWrapper

    protected ServletContext getServletContextWrapper()

  Returns the Servlet Context Wrapper

  Returns:
    returns the Servlet Context object

### init

    public void init(PortletConfig portletConfig)
              throws PortletException

  Called by the portlet container to indicate to a portlet that the portlet is being placed into service. The ActionServlet init is called to digest the Struts configuration, and the init parameters are read to set up the portlet.

  Parameters:
    `portletConfig` - the portlet configuration
  Throws:
    `PortletException` - if an exception has occurred that interferes with the portlet normal operation

### createActionServlet

    protected WpActionServlet createActionServlet(ServletContext servletContext,
                                                  ServletConfig servletConfig,
                                                  PortletConfig portletConfig,
                                                  StrutsInfo strutsInfo)

  Returns the ActionServlet. This method can be overridden so an ActionServlet subclass can be created for custom processing.

  Parameters:
    `servletConfig` - the ServletConfig object
    `servletContext` - the ServletContext object
    `portletConfig` - the PortletConfig object
    `strutsInfo` - the StrutsInfo object
  Returns:
    returns the ActionServlet object

### readInitParameters

    protected void readInitParameters(ServletContext servletContext,
                                      PortletConfig portletConfig,
                                      StrutsInfo strutsInfo)

  Reads the init parameters for this portlet from the web deployment descriptor and performs the appropriate configuration. Supported init parameters
  - INIT_PARAM_STRUTS_SERVLET_MAPPING
  - INIT_PARAM_MODULE_SEARCH_PATH
  - INIT_PARAM_EDIT_MODE
  - INIT_PARAM_HELP_MODE
  - INIT_PARAM_VIEW_MODE
  - INIT_PARAM_INCLUDES_SEARCH_PATH
  - INIT_PARAM_USE_GROUPS_FOR_ACCESS
  - INIT_PARAM_NAMESCOPE_FORM_NAME
  - INIT_PARAM_USE_PORTALS_LOCALE
  - INIT_PARAM_PROCESSING_PHASE_SUPPORTED
  - INIT_PARAM_HIDE_PARAMS_IN_RENDER
  - INIT_PARAM_PORTLET_SESSION_MODE
  - INIT_PARAM_WELCOME_FILE_SEARCH_PATH

  Parameters:
    `servletContext` - the servlet context
    `portletConfig` - the portlet config
    `strutsInfo` - the struts inf object

### doService

    protected void doService(RenderRequest renderRequest,
                             RenderResponse renderResponse)
                      throws PortletException,
                             java.io.IOException

  The common processing for doView, doHelp, doConfigure and doEdit. The `StrutsViewCommand` is obtained from the `CommandManagerFactory`. If the command is found, then it is executed to render the view. If a `StrutsViewCommand` is not found then the welcome file processing is used for the initial view.

  Parameters:
    `request` - the render request object
    `response` - the render response object
  Throws:
    `PortletException` - if the portlet cannot fulfill the request
    `java.io.IOException` - if the streaming causes an I/O problem

### doView

    public void doView(RenderRequest request,
                       RenderResponse response)
                throws PortletException,
                       java.io.IOException

  Render method for view mode. The default implementation of this method calls the doService method.

  Parameters:
    `request` - the render request object
    `response` - the render response object
  Throws:
    `PortletException` - if the portlet cannot fulfill the request
    `java.io.IOException` - if the streaming causes an I/O problem

### doHelp

    public void doHelp(RenderRequest request,
                       RenderResponse response)
                throws PortletException,
                       java.io.IOException

  Render method for help mode. The default implementation of this method calls the doService method.

  Parameters:
    `request` - the render request object
    `response` - the render response object
  Throws:
    `PortletException` - if the portlet cannot fulfill the request
    `java.io.IOException` - if the streaming causes an I/O problem

### doEdit

    public void doEdit(RenderRequest request,
                       RenderResponse response)
                throws PortletException,
                       java.io.IOException

  Render method for edit mode. The default implemention of this method calls the doService method.

  Parameters:
    `request` - the render request object
    `response` - the render response object
  Throws:
    `PortletException` - if the portlet cannot fulfill the request
    `java.io.IOException` - if the streaming causes an I/O problem

### doConfigure

    public void doConfigure(RenderRequest request,
                            RenderResponse response)
                     throws PortletException,
                            java.io.IOException

  Render method for configure mode. The default implementation of this method calls the doService method.

  Parameters:
    `request` - the render request object
    `response` - the render response object
  Throws:
    `PortletException` - if the portlet cannot fulfill the request
    `java.io.IOException` - if the streaming causes an I/O problem

### createWelcomeFileCommand

    protected void createWelcomeFileCommand(PortletRequest request,
                                            PortletResponse response)
                                     throws PortletException

  Creates the welcome file command. The welcome file list can be obtained from the welcome file list in the web.xml, or can be configured per portlet. This method will use the ModuleSearch path to find the welcome file for the portlet mode, and other configurable parameters.

  Parameters:
    `request` - the request object
    `response` - the response object
  Throws:
    `PortletException` - if the portlet cannot fulfill the request

### destroy

    public void destroy()

  Called by the portlet container to indicate to a portlet that the portlet is being taken out of service.

### processAction

    public void processAction(ActionRequest aRequest,
                              ActionResponse aResponse)
                       throws PortletException,
                              java.io.IOException

  Called by the portlet container to allow the portlet to process an action request. This method is called if the client request was originated by a URL created (by the portlet) with the RenderResponse.createActionURL() method.

  Parameters:
    `request` - the action request object
    `response` - the action response object
  Throws:
    `PortletException` - if the portlet cannot fulfill the request
    `java.io.IOException` - if the streaming causes an I/O problem

### processActionPerformed

    protected void processActionPerformed(PortletRequest pRequest,
                                          PortletResponse pResponse)
                                   throws java.io.IOException,
                                          PortletException

  The processing for actionPerformed. This is a separate method so it can be called from processAction and processStrutsAction or for an action welcome file.

  Parameters:
    `request` - the request object
    `response` - the portlet response object
  Throws:
    `PortletException` - if the portlet cannot fulfill the request
    `java.io.IOException` - if the streaming causes an I/O problem

### createCommandExecutionContext

    protected ViewCommandExecutionContext createCommandExecutionContext(PortletContext portletContext,
                                                                        ModuleContext moduleContext,
                                                                        ServletContext servletContext)

  Creates a ViewCommandExecutionContext to be used when executing a ViewCommand. This can be overridden to supply execution context that is particular to the Portal environment.

  Parameters:
    `portletContext` - the PortletContext object
    `moduleContext` - the module context object
    `servletContext` - the servlet context object
  Returns:
    ViewCommandExecutionContext the ViewCommandExecutionContext object

### getWelcomeFileList

    protected java.util.List getWelcomeFileList(ServletContext servletContext,
                                                PortletContext portletContext,
                                                PortletRequest portletRequest)

  Gets the welcome file list. The list will first contain entries configured in with the portlet and then the welcome file list values from the web.xml.

  Parameters:
    `ServletContext` - servletContext
    `PortletConfig` - portletConfig
    `portletRequest` - the portlet request objects
  Returns:
    Vector welcome files

### getWelcomeFileList

    protected java.util.Vector getWelcomeFileList(ServletContext servletContext)

  Gets the welcome file list from the web.xml file.

  Parameters:
    `ServletContext` - servletContext
  Returns:
    Vector welcome files

### createPortletRequestWrapper

    protected PortletRequest createPortletRequestWrapper(PortletRequest portletRequest)

  Creates a portlet request wrapper. The request wrapper will be used to implement request features unique to the Struts Portlet Framework.

  Parameters:
    `portletRequest` - the portlet request
  Returns:
    PortletRequest the portlet request wrapper

### processStrutsAction

    public void processStrutsAction(PortletRequest aRequest,
                                    PortletResponse aResponse,
                                    java.lang.String strutsAction)
                             throws PortletException

  Calls the appropriate Struts request processor's process method for the specified Struts action. Note: The ActionServlet doPost/doGet is not used to invoke the request processor, the request processor is called directly.

  Parameters:
    `request` - the request object
    `strutsAction` - the struts action
  Throws:
    `PortletException` - if the portlet cannot fulfill the request

### setupBase

    protected static void setupBase(PortletRequest request,
                                    PortletResponse response,
                                    PortletConfig config)

  Allows BaseImplUtils to set up the processing.

  Parameters:
    `request` - the request object
    `response` - the response object
    `config` - the config parameter

### processLocale

    protected void processLocale(PortletRequest request)

  Sets the locale for Jakarta Struts in session to the locale obtained from the portlet request object. The locale object is stored in session under the Globals.LOCALE_KEY and used by Struts components. Note: The Struts request processor implementation will only set a locale if a locale object is not already set. This method effectively defeats the Struts implementation. Struts actions can also set the locale object in session, so the usePortalsLocale must be set to false for those applications to work.

  Parameters:
    `request` - the portlet request object

### setupRenderPhase

    protected void setupRenderPhase(PortletRequest request)

  Sets up the render phase. Sets request attributes that can be used by the processor to determine the Portal phase.

  Parameters:
    `request` - the portlet request object

### setupRequestPhase

    protected void setupRequestPhase(PortletRequest request)

  Sets up the request phase. Sets request attributes that can be used by the processor to determine the Portal phase.

  Parameters:
    `request` - the portlet request

### setCommonsLogFactory

    public void setCommonsLogFactory()

  Previously used to set a commons logger using the System property. The suggested solution is to set the commons logger in the commons-logging.properties file. The default logger will log all messages to the Portal log file.

### getServletContextWrapper

    protected ServletContext getServletContextWrapper(PortletConfig portletConfig,
                                                      ServletContext servletContext)

  Returns a servlet context that namescopes the attributes to the portlet.

  Parameters:
    `portletConfig` - the portlet config
    `servletContext` - the real servlet context
  Returns:
    ServletContext the wrapper servlet context

### initCommandManagerPlugin

    protected void initCommandManagerPlugin(PortletConfig portletConfig)

  Initializes a plugin. A Struts plugin can be specified in the portlet deployment descriptor. This will allow a plugin to execute once per Struts application instead of once per Struts module.

  Parameters:
    `portletConfig` - the portlet config

### destroyCommandManagerPlugin

    protected void destroyCommandManagerPlugin(PortletConfig portletConfig)

  Destroys a plugin by calling the destroy method of the plugin.

  Parameters:
    `portletConfig` - the portlet config

### getServletConfigWrapper

    protected ServletConfig getServletConfigWrapper(PortletConfig portletConfig)

  Gets the serlvet config wrapper.

  Parameters:
    `PortletConfig` - portlet config
  Returns:
    returns the servlet config wrapper

### doDispatch

    protected void doDispatch(RenderRequest request,
                              RenderResponse response)
                       throws PortletException,
                              java.io.IOException

  Support for config mode

  Throws:
    `PortletException`
    `java.io.IOException`

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD