Search in sources :

Example 1 with DynamicServletContextProcessor

use of com.creditease.monitor.jee.servlet30.DynamicServletContextProcessor in project uavstack by uavorg.

the class JettyPlusIT method onServletRegist.

/**
 * onServletRegist
 *
 * @param args
 * @return
 */
public ServletContext onServletRegist(Object... args) {
    ServletContext servletContext;
    ServletContextEvent sce;
    if (ServletContextEvent.class.isAssignableFrom(args[0].getClass())) {
        sce = (ServletContextEvent) args[0];
        servletContext = sce.getServletContext();
    } else {
        servletContext = (ServletContext) args[0];
    }
    ServletContext scProxy = (ServletContext) servletContext.getAttribute("com.creditease.uav.mof.tomcat.servletcontext");
    if (scProxy == null) {
        scProxy = JDKProxyInvokeUtil.newProxyInstance(ServletContext.class.getClassLoader(), new Class<?>[] { ServletContext.class }, new JDKProxyInvokeHandler<ServletContext>(servletContext, new DynamicServletContextProcessor()));
        servletContext.setAttribute("com.creditease.uav.mof.tomcat.servletcontext", scProxy);
    }
    return scProxy;
}
Also used : JDKProxyInvokeHandler(com.creditease.monitor.proxy.spi.JDKProxyInvokeHandler) DynamicServletContextProcessor(com.creditease.monitor.jee.servlet30.DynamicServletContextProcessor) ServletContext(javax.servlet.ServletContext) ServletContextEvent(javax.servlet.ServletContextEvent)

Example 2 with DynamicServletContextProcessor

use of com.creditease.monitor.jee.servlet30.DynamicServletContextProcessor in project uavstack by uavorg.

the class TomcatPlusIT method onServletRegist.

/**
 * onServletRegist
 *
 * @param args
 * @return
 */
public ServletContext onServletRegist(Object... args) {
    ServletContext servletContext = (ServletContext) args[0];
    // uav's inner app doesn't need Profiling,just return origin servletContext here.
    if ("/com.creditease.uav".equals(servletContext.getContextPath())) {
        return servletContext;
    }
    ServletContext scProxy = (ServletContext) servletContext.getAttribute("com.creditease.uav.mof.tomcat.servletcontext");
    if (scProxy == null) {
        scProxy = JDKProxyInvokeUtil.newProxyInstance(ServletContext.class.getClassLoader(), new Class<?>[] { ServletContext.class }, new JDKProxyInvokeHandler<ServletContext>(servletContext, new DynamicServletContextProcessor()));
        servletContext.setAttribute("com.creditease.uav.mof.tomcat.servletcontext", scProxy);
    }
    return scProxy;
}
Also used : JDKProxyInvokeHandler(com.creditease.monitor.proxy.spi.JDKProxyInvokeHandler) DynamicServletContextProcessor(com.creditease.monitor.jee.servlet30.DynamicServletContextProcessor) ServletContext(javax.servlet.ServletContext)

Aggregations

DynamicServletContextProcessor (com.creditease.monitor.jee.servlet30.DynamicServletContextProcessor)2 JDKProxyInvokeHandler (com.creditease.monitor.proxy.spi.JDKProxyInvokeHandler)2 ServletContext (javax.servlet.ServletContext)2 ServletContextEvent (javax.servlet.ServletContextEvent)1