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

📄 contextutil.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:   ContextUtil.java

package org.apache.struts2.views.util;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.util.ValueStack;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.util.StrutsUtil;
import org.apache.struts2.views.jsp.ui.OgnlTool;

public class ContextUtil
{

	public static final String REQUEST = "request";
	public static final String REQUEST2 = "request";
	public static final String RESPONSE = "response";
	public static final String RESPONSE2 = "response";
	public static final String SESSION = "session";
	public static final String BASE = "base";
	public static final String STACK = "stack";
	public static final String OGNL = "ognl";
	public static final String STRUTS = "struts";
	public static final String ACTION = "action";
	public static boolean altSyntax;

	public ContextUtil()
	{
	}

	public static void setAltSyntax(String val)
	{
		altSyntax = "true".equals(val);
	}

	public static Map getStandardContext(ValueStack stack, HttpServletRequest req, HttpServletResponse res)
	{
		HashMap map = new HashMap();
		map.put("request", req);
		map.put("request", req);
		map.put("response", res);
		map.put("response", res);
		map.put("session", req.getSession(false));
		map.put("base", req.getContextPath());
		map.put("stack", stack);
		map.put("ognl", OgnlTool.getInstance());
		map.put("struts", new StrutsUtil(stack, req, res));
		ActionInvocation invocation = (ActionInvocation)stack.getContext().get("com.opensymphony.xwork2.ActionContext.actionInvocation");
		if (invocation != null)
			map.put("action", invocation.getAction());
		return map;
	}

	public static boolean isUseAltSyntax(Map context)
	{
		return altSyntax || context.containsKey("useAltSyntax") && context.get("useAltSyntax") != null && "true".equals(context.get("useAltSyntax").toString());
	}

	public static String getTemplateSuffix(Map context)
	{
		return context.containsKey("templateSuffix") ? (String)context.get("templateSuffix") : null;
	}
}

⌨️ 快捷键说明

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