FileDocCategorySizeDatePackage
PortletActionContext.javaAPI DocExample6569Mon Jul 23 13:26:38 BST 2007org.apache.struts2.portlet.context

PortletActionContext

public class PortletActionContext extends Object implements org.apache.struts2.portlet.PortletActionConstants
PortletActionContext. ActionContext thread local for the portlet environment.
version
$Revision: 495502 $ $Date: 2007-01-12 02:15:43 -0500 (Fri, 12 Jan 2007) $

Fields Summary
Constructors Summary
Methods Summary
public static javax.portlet.ActionRequestgetActionRequest()
Get the ActionRequest. Can only be invoked in the event phase.

return
The current ActionRequest.
throws
IllegalStateException If the method is invoked in the wrong phase.

        if (!isEvent()) {
            throw new IllegalStateException(
                    "ActionRequest cannot be obtained in render phase");
        }
        return (ActionRequest) getContext().get(REQUEST);
    
public static javax.portlet.ActionResponsegetActionResponse()
Get the ActionRequest. Can only be invoked in the event phase.

return
The current ActionRequest.
throws
IllegalStateException If the method is invoked in the wrong phase.

        if (!isEvent()) {
            throw new IllegalStateException(
                    "ActionResponse cannot be obtained in render phase");
        }
        return (ActionResponse) getContext().get(RESPONSE);
    
private static com.opensymphony.xwork2.ActionContextgetContext()

return
The current ActionContext.

        return ActionContext.getContext();
    
public static org.apache.struts2.dispatcher.mapper.ActionMappinggetDefaultActionForMode()
Get the default action mapping for the current mode.

return
The default action mapping for the current portlet mode.

        return (ActionMapping)getContext().get(DEFAULT_ACTION_FOR_MODE);
    
public static java.util.MapgetModeNamespaceMap()
Get the namespace to mode mappings.

return
The map of the namespaces for each mode.

        return (Map)getContext().get(MODE_NAMESPACE_MAP);
    
public static java.lang.IntegergetPhase()
Get the phase that the portlet is executing in.

return
{@link PortletActionConstants#RENDER_PHASE} in render phase, and {@link PortletActionConstants#EVENT_PHASE} in the event phase.

        return (Integer) getContext().get(PHASE);
    
public static javax.portlet.PortletConfiggetPortletConfig()
Get the PortletConfig of the portlet that is executing.

return
The PortletConfig of the executing portlet.

        return (PortletConfig) getContext().get(PORTLET_CONFIG);
    
public static java.lang.StringgetPortletNamespace()
Get the action namespace of the portlet. Used to organize actions for multiple portlets in the same portlet application.

return
The portlet namespace as defined in portlet.xml and struts.xml

        return (String)getContext().get(PORTLET_NAMESPACE);
    
public static javax.portlet.RenderRequestgetRenderRequest()
Get the RenderRequest. Can only be invoked in the render phase.

return
The current RenderRequest.
throws
IllegalStateException If the method is invoked in the wrong phase.

        if (!isRender()) {
            throw new IllegalStateException(
                    "RenderRequest cannot be obtained in event phase");
        }
        return (RenderRequest) getContext().get(REQUEST);
    
public static javax.portlet.RenderResponsegetRenderResponse()
Get the RenderResponse. Can only be invoked in the render phase.

return
The current RenderResponse.
throws
IllegalStateException If the method is invoked in the wrong phase.

        if (!isRender()) {
            throw new IllegalStateException(
                    "RenderResponse cannot be obtained in event phase");
        }
        return (RenderResponse) getContext().get(RESPONSE);
    
public static javax.portlet.PortletRequestgetRequest()
Get the current PortletRequest.

return
The current PortletRequest.

        return (PortletRequest) getContext().get(REQUEST);
    
public static javax.portlet.PortletResponsegetResponse()
Get the current PortletResponse

return
The current PortletResponse.

        return (PortletResponse) getContext().get(RESPONSE);
    
public static booleanisEvent()

return
true if the Portlet is executing in the event phase.

        return PortletActionConstants.EVENT_PHASE.equals(getPhase());
    
public static booleanisPortletRequest()
Check to see if the current request is a portlet request.

return
true if the current request is a portlet request.

        return getRequest() != null;
    
public static booleanisRender()

return
true if the Portlet is executing in render phase.

        return PortletActionConstants.RENDER_PHASE.equals(getPhase());