private HttpHandler getAggregationHandler ( ) throws ServletException { DeploymentInfo deploymentInfo = Servlets . deployment ( ) . setClassLoader ( JashingServer . class . getClassLoader ( ) ) . setContextPath ( "/" ) . setDeploymentName ( "jashing" ) . addFilterUrlMapping ( "wro4j" , "/*" , DispatcherType . REQUEST ) . addFilter ( Servlets . filter ( "wro4j" , ConfigurableWroFilter . class , new InstanceFactory < ConfigurableWroFilter > ( ) { @ Override public InstanceHandle < ConfigurableWroFilter > createInstance ( ) throws InstantiationException { ConfigurableWroFilter filter = new ConfigurableWroFilter ( ) ; filter . setWroManagerFactory ( new WroManagerFactory ( ) ) ; return new ImmediateInstanceHandle <> ( filter ) ; } } ) ) ; DeploymentManager deployment = Servlets . defaultContainer ( ) . addDeployment ( deploymentInfo ) ; deployment . deploy ( ) ; return deployment . start ( ) ; }
Uses Wro4j Filter to pre - process resources Required for coffee scripts compilation and saas processing Wro4j uses Servlet API so we make fake Servlet Deployment here to emulate servlet - based environment