use of org.commonjava.indy.bind.jaxrs.ui.UIServlet in project indy by Commonjava.
the class IndyDeployment method getDeployment.
public DeploymentInfo getDeployment(final String contextRoot) {
final ResteasyDeployment deployment = new ResteasyDeployment();
deployment.setApplication(this);
deployment.setInjectorFactoryClass(CdiInjectorFactoryImpl.class.getName());
final ServletInfo resteasyServlet = Servlets.servlet("REST", HttpServlet30Dispatcher.class).setAsyncSupported(true).setLoadOnStartup(1).addMapping("/api*").addMapping("/api/*").addMapping("/api-docs*").addMapping("/api-docs/*").addMapping("/swagger.json").addMapping("/swagger.yaml");
final BeanConfig beanConfig = new BeanConfig();
beanConfig.setResourcePackage("org.commonjava.indy");
beanConfig.setBasePath("/");
beanConfig.setLicense("ASLv2");
beanConfig.setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0");
beanConfig.setScan(true);
beanConfig.setVersion(versioning.getApiVersion());
final FilterInfo resourceManagementFilter = Servlets.filter("Naming and Resource Management", ResourceManagementFilter.class, new ImmediateInstanceFactory<ResourceManagementFilter>(this.resourceManagementFilter));
final DeploymentInfo di = new DeploymentInfo().addListener(Servlets.listener(RequestScopeListener.class)).setContextPath(contextRoot).addServletContextAttribute(ResteasyDeployment.class.getName(), deployment).addServlet(resteasyServlet).addFilter(resourceManagementFilter).addFilterUrlMapping(resourceManagementFilter.getName(), "/api/*", DispatcherType.REQUEST).setDeploymentName("Indy").setClassLoader(ClassLoader.getSystemClassLoader()).addOuterHandlerChainWrapper(new HeaderDebugger.Wrapper());
if (deploymentProviders != null) {
DeploymentInfoUtils.mergeFromProviders(di, deploymentProviders);
}
// Add UI servlet at the end so its mappings don't obscure any from add-ons.
final ServletInfo uiServlet = Servlets.servlet("UI", UIServlet.class).setAsyncSupported(true).setLoadOnStartup(99).addMappings(UIServlet.PATHS);
uiServlet.setInstanceFactory(new ImmediateInstanceFactory<Servlet>(ui));
di.addServlet(uiServlet);
return di;
}
Aggregations