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

📄 invocationsessionstore.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:   InvocationSessionStore.java

package org.apache.struts2.util;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class InvocationSessionStore
{
	private static class InvocationContext
		implements Serializable
	{

		private static final long serialVersionUID = 0xfc0571fdd3b2e2a0L;
		ActionInvocation invocation;
		String token;

		public InvocationContext(ActionInvocation invocation, String token)
		{
			this.invocation = invocation;
			this.token = token;
		}
	}


	private static final String INVOCATION_MAP_KEY = "org.apache.struts2.util.InvocationSessionStore.invocationMap";

	private InvocationSessionStore()
	{
	}

	public static ActionInvocation loadInvocation(String key, String token)
	{
		InvocationContext invocationContext = (InvocationContext)getInvocationMap().get(key);
		if (invocationContext == null || !invocationContext.token.equals(token))
		{
			return null;
		} else
		{
			com.opensymphony.xwork2.util.ValueStack stack = invocationContext.invocation.getStack();
			ActionContext.getContext().setValueStack(stack);
			return invocationContext.invocation;
		}
	}

	public static void storeInvocation(String key, String token, ActionInvocation invocation)
	{
		InvocationContext invocationContext = new InvocationContext(invocation, token);
		Map invocationMap = getInvocationMap();
		invocationMap.put(key, invocationContext);
		setInvocationMap(invocationMap);
	}

	static void setInvocationMap(Map invocationMap)
	{
		Map session = ActionContext.getContext().getSession();
		if (session == null)
		{
			throw new IllegalStateException("Unable to access the session.");
		} else
		{
			session.put("org.apache.struts2.util.InvocationSessionStore.invocationMap", invocationMap);
			return;
		}
	}

	static Map getInvocationMap()
	{
		Map session = ActionContext.getContext().getSession();
		if (session == null)
			throw new IllegalStateException("Unable to access the session.");
		Map invocationMap = (Map)session.get("org.apache.struts2.util.InvocationSessionStore.invocationMap");
		if (invocationMap == null)
		{
			invocationMap = new HashMap();
			setInvocationMap(invocationMap);
		}
		return invocationMap;
	}
}

⌨️ 快捷键说明

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