FileDocCategorySizeDatePackage
ProfilingActivationInterceptor.javaAPI DocExample3427Mon Jul 23 13:26:52 BST 2007org.apache.struts2.interceptor

ProfilingActivationInterceptor

public class ProfilingActivationInterceptor extends com.opensymphony.xwork2.interceptor.AbstractInterceptor
Allows profiling to be enabled or disabled via request parameters, when devMode is enabled.
  • profilingKey
none


// to change the profiling key

...

profilingKey

...



version
$Date: 2006-11-23 12:31:52 -0500 (Thu, 23 Nov 2006) $ $Id: ProfilingActivationInterceptor.java 478625 2006-11-23 17:31:52Z wsmoak $

Fields Summary
private String
profilingKey
private boolean
devMode
Constructors Summary
Methods Summary
public java.lang.StringgetProfilingKey()

return
the profilingKey


            
       
        return profilingKey;
    
public java.lang.Stringintercept(com.opensymphony.xwork2.ActionInvocation invocation)

        if (devMode) {
            Object val = invocation.getInvocationContext().getParameters().get(profilingKey);
            if (val != null) {
                String sval = (val instanceof String ? (String)val : ((String[])val)[0]);
                boolean enable = "yes".equalsIgnoreCase(sval) || "true".equalsIgnoreCase(sval);
                UtilTimerStack.setActive(enable);
                invocation.getInvocationContext().getParameters().remove(profilingKey);
            }
        }
        return invocation.invoke();

    
public voidsetDevMode(java.lang.String mode)

        this.devMode = "true".equals(mode);
    
public voidsetProfilingKey(java.lang.String profilingKey)

param
profilingKey the profilingKey to set

        this.profilingKey = profilingKey;