📄 httpheaderresult.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: HttpHeaderResult.java
package org.apache.struts2.dispatcher;
import com.opensymphony.xwork2.*;
import com.opensymphony.xwork2.util.TextParseUtil;
import java.util.*;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;
public class HttpHeaderResult
implements Result
{
private static final long serialVersionUID = 0x2b715b09f41be4eL;
public static final String DEFAULT_PARAM = "status";
private boolean parse;
private Map headers;
private int status;
public HttpHeaderResult()
{
parse = true;
status = -1;
headers = new HashMap();
}
public HttpHeaderResult(int status)
{
this();
this.status = status;
parse = false;
}
public Map getHeaders()
{
return headers;
}
public void setParse(boolean parse)
{
this.parse = parse;
}
public void setStatus(int status)
{
this.status = status;
}
public void addHeader(String name, String value)
{
headers.put(name, value);
}
public void execute(ActionInvocation invocation)
throws Exception
{
HttpServletResponse response = ServletActionContext.getResponse();
if (status != -1)
response.setStatus(status);
if (headers != null)
{
com.opensymphony.xwork2.util.ValueStack stack = ActionContext.getContext().getValueStack();
java.util.Map.Entry entry;
String finalValue;
for (Iterator iterator = headers.entrySet().iterator(); iterator.hasNext(); response.addHeader((String)entry.getKey(), finalValue))
{
entry = (java.util.Map.Entry)iterator.next();
String value = (String)entry.getValue();
finalValue = parse ? TextParseUtil.translateVariables(value, stack) : value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -