📄 profilingactivationinterceptor.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: ProfilingActivationInterceptor.java
package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
import java.util.Map;
public class ProfilingActivationInterceptor extends AbstractInterceptor
{
private String profilingKey;
private boolean devMode;
public ProfilingActivationInterceptor()
{
profilingKey = "profiling";
}
public String getProfilingKey()
{
return profilingKey;
}
public void setProfilingKey(String profilingKey)
{
this.profilingKey = profilingKey;
}
public void setDevMode(String mode)
{
devMode = "true".equals(mode);
}
public String intercept(ActionInvocation invocation)
throws Exception
{
if (devMode)
{
Object val = invocation.getInvocationContext().getParameters().get(profilingKey);
if (val != null)
{
String sval = (val instanceof String) ? (String)val : ((String[])(String[])val)[0];
boolean enable = "yes".equalsIgnoreCase(sval) || "true".equalsIgnoreCase(sval);
UtilTimerStack.setActive(enable);
invocation.getInvocationContext().getParameters().remove(profilingKey);
}
}
return invocation.invoke();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -