PortletActionContext. ActionContext thread local for the portlet environment.
Method from org.apache.struts2.portlet.context.PortletActionContext Detail: |
public static ActionMapping getActionMapping() {
return (ActionMapping) getContext().get(ACTION_MAPPING);
}
Gets the action mapping for this context |
public static ActionRequest getActionRequest() {
if (!isEvent()) {
throw new IllegalStateException(
"ActionRequest cannot be obtained in render phase");
}
return (ActionRequest) getContext().get(REQUEST);
}
Get the ActionRequest. Can only be invoked in the event phase. |
public static ActionResponse getActionResponse() {
if (!isEvent()) {
throw new IllegalStateException(
"ActionResponse cannot be obtained in render phase");
}
return (ActionResponse) getContext().get(RESPONSE);
}
Get the ActionRequest. Can only be invoked in the event phase. |
public static ActionMapping getDefaultActionForMode() {
return (ActionMapping)getContext().get(DEFAULT_ACTION_FOR_MODE);
}
Get the default action mapping for the current mode. |
public static Map getModeNamespaceMap() {
return (Map)getContext().get(MODE_NAMESPACE_MAP);
}
Get the namespace to mode mappings. |
public static Integer getPhase() {
return (Integer) getContext().get(PHASE);
}
Get the phase that the portlet is executing in. |
public static PortletConfig getPortletConfig() {
return (PortletConfig) getContext().get(PORTLET_CONFIG);
}
Get the PortletConfig of the portlet that is executing. |
public static PortletContext getPortletContext() {
return (PortletContext)getContext().get(StrutsStatics.STRUTS_PORTLET_CONTEXT);
}
|
public static String getPortletNamespace() {
return (String)getContext().get(PORTLET_NAMESPACE);
}
Get the action namespace of the portlet. Used to organize actions for multiple portlets in
the same portlet application. |
public static RenderRequest getRenderRequest() {
if (!isRender()) {
throw new IllegalStateException(
"RenderRequest cannot be obtained in event phase");
}
return (RenderRequest) getContext().get(REQUEST);
}
Get the RenderRequest. Can only be invoked in the render phase. |
public static RenderResponse getRenderResponse() {
if (!isRender()) {
throw new IllegalStateException(
"RenderResponse cannot be obtained in event phase");
}
return (RenderResponse) getContext().get(RESPONSE);
}
Get the RenderResponse. Can only be invoked in the render phase. |
public static PortletRequest getRequest() {
return (PortletRequest) getContext().get(REQUEST);
}
Get the current PortletRequest. |
public static PortletResponse getResponse() {
return (PortletResponse) getContext().get(RESPONSE);
}
Get the current PortletResponse |
public static boolean isEvent() {
return PortletActionConstants.EVENT_PHASE.equals(getPhase());
}
|
public static boolean isPortletRequest() {
return getRequest() != null;
}
Check to see if the current request is a portlet request. |
public static boolean isRender() {
return PortletActionConstants.RENDER_PHASE.equals(getPhase());
}
|
public static void setPortletContext(PortletContext context) {
getContext().put(StrutsStatics.STRUTS_PORTLET_CONTEXT, context);
}
Convenience setter for the portlet context. |
public static void setRequest(PortletRequest request) {
getContext().put(REQUEST, request);
}
Convenience setter for the portlet request. |
public static void setResponse(PortletResponse response) {
getContext().put(RESPONSE, response);
}
Convenience setter for the portlet response. |