Search in sources :

Example 1 with WebServiceListenerIT

use of com.creditease.uav.monitorframework.webservice.interceptors.WebServiceListenerIT in project uavstack by uavorg.

the class WebServiceListener method doInstallDProxy.

public void doInstallDProxy(ClassLoader webapploader, final String appid, String contextPath) {
    // like SMS, which uses the sun jax-ws RI/Metro-jax-ws RI bind webservices when the servlet starts should
    // profile in ComponentProfileHandler
    FastClasspathScanner fcs = new FastClasspathScanner(new ClassLoader[] { webapploader });
    fcs.scan();
    List<String> endPoints = fcs.getNamesOfDirectSubclassesOf("javax.xml.ws.Endpoint");
    if (!endPoints.isEmpty()) {
        dpInstall.setTargetClassLoader(webapploader);
        for (int i = 0; i < endPoints.size(); i++) {
            dpInstall.installProxy(endPoints.get(i), new String[] { "com.creditease.uav.monitorframework.webservice.interceptors" }, new DynamicProxyProcessor() {

                @Override
                public void process(DPMethod m) throws Exception {
                    if ("publish".equals(m.getName()) && m.getParameterTypes().length > 0 && m.getParameterTypes()[0].getSimpleName().equals("String")) {
                        dpInstall.defineLocalVal(m, "mObj", WebServiceListenerIT.class);
                        m.insertBefore("{mObj=new WebServiceListenerIT(\"" + appid + "\");mObj.obtainWsInfo($1,getImplementor());}");
                    }
                }
            }, false);
        }
        // release loader
        dpInstall.releaseTargetClassLoader();
    }
}
Also used : DPMethod(com.creditease.uav.monitorframework.dproxy.bytecode.DPMethod) FastClasspathScanner(io.github.lukehutch.fastclasspathscanner.FastClasspathScanner) DynamicProxyProcessor(com.creditease.uav.monitorframework.dproxy.DynamicProxyProcessor) WebServiceListenerIT(com.creditease.uav.monitorframework.webservice.interceptors.WebServiceListenerIT)

Aggregations

DynamicProxyProcessor (com.creditease.uav.monitorframework.dproxy.DynamicProxyProcessor)1 DPMethod (com.creditease.uav.monitorframework.dproxy.bytecode.DPMethod)1 WebServiceListenerIT (com.creditease.uav.monitorframework.webservice.interceptors.WebServiceListenerIT)1 FastClasspathScanner (io.github.lukehutch.fastclasspathscanner.FastClasspathScanner)1