⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 portletactioncontext.java

📁 struts 2 核心包 的源码 有错误是难免的
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   PortletActionContext.java

package org.apache.struts2.portlet.context;

import com.opensymphony.xwork2.ActionContext;
import java.util.Map;
import javax.portlet.*;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.portlet.PortletActionConstants;

public class PortletActionContext
	implements PortletActionConstants
{

	public PortletActionContext()
	{
	}

	public static PortletConfig getPortletConfig()
	{
		return (PortletConfig)getContext().get("struts.portlet.config");
	}

	public static RenderRequest getRenderRequest()
	{
		if (!isRender())
			throw new IllegalStateException("RenderRequest cannot be obtained in event phase");
		else
			return (RenderRequest)getContext().get("struts.portlet.request");
	}

	public static RenderResponse getRenderResponse()
	{
		if (!isRender())
			throw new IllegalStateException("RenderResponse cannot be obtained in event phase");
		else
			return (RenderResponse)getContext().get("struts.portlet.response");
	}

	public static ActionRequest getActionRequest()
	{
		if (!isEvent())
			throw new IllegalStateException("ActionRequest cannot be obtained in render phase");
		else
			return (ActionRequest)getContext().get("struts.portlet.request");
	}

	public static ActionResponse getActionResponse()
	{
		if (!isEvent())
			throw new IllegalStateException("ActionResponse cannot be obtained in render phase");
		else
			return (ActionResponse)getContext().get("struts.portlet.response");
	}

	public static String getPortletNamespace()
	{
		return (String)getContext().get("struts.portlet.portletNamespace");
	}

	public static PortletRequest getRequest()
	{
		return (PortletRequest)getContext().get("struts.portlet.request");
	}

	public static PortletResponse getResponse()
	{
		return (PortletResponse)getContext().get("struts.portlet.response");
	}

	public static Integer getPhase()
	{
		return (Integer)getContext().get("struts.portlet.phase");
	}

	public static boolean isRender()
	{
		return PortletActionConstants.RENDER_PHASE.equals(getPhase());
	}

	public static boolean isEvent()
	{
		return PortletActionConstants.EVENT_PHASE.equals(getPhase());
	}

	private static ActionContext getContext()
	{
		return ActionContext.getContext();
	}

	public static boolean isPortletRequest()
	{
		return getRequest() != null;
	}

	public static ActionMapping getDefaultActionForMode()
	{
		return (ActionMapping)getContext().get("struts.portlet.defaultActionForMode");
	}

	public static Map getModeNamespaceMap()
	{
		return (Map)getContext().get("struts.portlet.modeNamespaceMap");
	}

	public static PortletContext getPortletContext()
	{
		return (PortletContext)getContext().get("struts.portlet.context");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -