.addMapping("/").setAsyncSupported(true); DeploymentInfo servletBuilder = deployment() .setClassLoader(UndertowTestServer.class.getClassLoader())
s.setAsyncSupported(servlet.isAsyncSupported()) .setJspFile(servlet.getJspFile()) .setEnabled(servlet.isEnabled());
if (!mapping.equals("/*")) prefix = mapping.substring(0, mapping.length() - 2); ServletInfo resteasyServlet = servlet("ResteasyServlet", HttpServlet30Dispatcher.class) .setAsyncSupported(true) .setLoadOnStartup(1) .addMapping(mapping);
@Override public void setAsyncSupported(final boolean isAsyncSupported) { servletInfo.setAsyncSupported(isAsyncSupported); }
@Override public ServletInfo clone() { ServletInfo info = new ServletInfo(name, servletClass, instanceFactory) .setJspFile(jspFile) .setLoadOnStartup(loadOnStartup) .setEnabled(enabled) .setAsyncSupported(asyncSupported) .setRunAs(runAs) .setMultipartConfig(multipartConfig) .setExecutor(executor) .setRequireWelcomeFileMapping(requireWelcomeFileMapping); info.mappings.addAll(mappings); info.initParams.putAll(initParams); info.securityRoleRefs.addAll(securityRoleRefs); info.handlerChainWrappers.addAll(handlerChainWrappers); if (servletSecurityInfo != null) { info.servletSecurityInfo = servletSecurityInfo.clone(); } return info; }
public ServletContextBuilder jaxrs(final String name, final Class<? extends Application> applicationClass, final Consumer<ServletInfo> servletInfoHook) { final ServletInfo servletInfo = new ServletInfo(StringUtils.isEmpty(name) ? applicationClass.getName() : name, ServletContainer.class).addInitParam(ServletProperties.JAXRS_APPLICATION_CLASS, applicationClass.getName()); final ApplicationPath path = AnnotationsUtils.getFirstAnnotation(applicationClass, ApplicationPath.class); if (path != null) servletInfo.addMapping(path.value()); servletInfo.setAsyncSupported(true).setLoadOnStartup(1); addServlet(servletInfo, servletInfoHook); return this; }
public ServletContextBuilder jaxrs(final String name, final ApplicationBuilder applicationBuilder, final Consumer<ServletInfo> servletInfoHook) { final JaxRsServlet jaxRsServlet = new JaxRsServlet(applicationBuilder.build()); final ServletInfo servletInfo = new ServletInfo( StringUtils.isEmpty(name) ? applicationBuilder.getClass() + "@" + applicationBuilder.hashCode() : name, jaxRsServlet.getClass(), GenericFactory.fromInstance(jaxRsServlet)); if (applicationBuilder.applicationPaths != null) { servletInfo.addMappings(applicationBuilder.applicationPaths); applicationBuilder.forEachEndPoint(endPoints::add); } servletInfo.setAsyncSupported(true).setLoadOnStartup(1); return addServlet(servletInfo, servletInfoHook); }
servletInfo.addMapping(urlPattern); servletInfo.setAsyncSupported(annotation.asyncSupported()); return servletInfo; })
@Override public DeploymentInfo configuration(ServerDescriptor descriptor) { try { App app = descriptor.getApp(); Set<Class<?>> handles = descriptor.getHandlesType(); String name = descriptor.getTestClassName(); ServletContainerInitializer initializer = descriptor.getServletContainerInitializer(); ImmediateInstanceFactory<ServletContainerInitializer> factory = new ImmediateInstanceFactory<>(initializer); URI uri = URI.create("http://0.0.0.0:0/"); ServletContainerInitializerInfo initInfo = new ServletContainerInitializerInfo(initializer.getClass(), factory, handles); ServletInfo servletInfo = Servlets.servlet(name, DefaultServlet.class) .setAsyncSupported(true); DeploymentInfo deploymentInfo = Servlets.deployment() .addServletContainerInitalizer(initInfo) .setClassLoader(descriptor.getTestClass().getClassLoader()) .setHostName(uri.getHost()) .setContextPath(uri.getPath()) .setDeploymentName(name) .addServlet(servletInfo); return deploymentInfo; } catch (Exception e) { throw new IllegalStateException(e); } }
@Override public DeploymentInfo getDeploymentInfo( String contextRoot, Application application ) { final ServletInfo servletInfo = Servlets.servlet( "DotMaven", DotMavenServlet.class ) .setAsyncSupported( true ) .setLoadOnStartup( 3 ) .addMapping( "/mavdav*" ) .addMapping( "/mavdav/*" ); servletInfo.setInstanceFactory( new ImmediateInstanceFactory<Servlet>( servlet ) ); return new DeploymentInfo().addServlet( servletInfo ); } }
@Override public DeploymentInfo getDeploymentInfo() { final ServletInfo servletInfo = Servlets.servlet( "DotMaven", DotMavenServlet.class ) .setAsyncSupported( true ) .setLoadOnStartup( 3 ) .addMapping( "/mavdav*" ) .addMapping( "/mavdav/*" ); servletInfo.setInstanceFactory( new ImmediateInstanceFactory<Servlet>( servlet ) ); return new DeploymentInfo().addServlet( servletInfo ); } }
servletInfo.setAsyncSupported(true);
private ServletInfo convertServletInfo(YggdrasilServletInfo servlet) { ServletInfo result = Servlets.servlet(servlet.getName(), servlet.getClazz()).setLoadOnStartup(servlet.getLoadOnStartup()) .setAsyncSupported(servlet.getAsyncSupported()).setRequireWelcomeFileMapping(servlet.getRequireWelcomeFileMapping()); for (String mapping : servlet.getMappings()) { result.addMapping(mapping); } return result; }
@Override public ServletInfo apply(ServletDescriptor servletDescriptor) { ServletInfo servletInfo = Servlets.servlet(servletDescriptor.name(), servletDescriptor.servletClass()) .setAsyncSupported(servletDescriptor.asyncSupported()) .setLoadOnStartup(servletDescriptor.loadOnStartup()) .addMappings(servletDescriptor.urlPatterns()); if(servletDescriptor.initParams() != null) { for(WebInitParam param : servletDescriptor.initParams()) { servletInfo.addInitParam(param.name(), param.value()); } } return servletInfo; } }
@Override public ServletInfo apply(ServletDescriptor servletDescriptor) { ServletInfo servletInfo = Servlets.servlet(servletDescriptor.name(), servletDescriptor.servletClass()) .setAsyncSupported(servletDescriptor.asyncSupported()) .setLoadOnStartup(servletDescriptor.loadOnStartup()) .addMappings(servletDescriptor.urlPatterns()); if(servletDescriptor.initParams() != null) { for(WebInitParam param : servletDescriptor.initParams()) { servletInfo.addInitParam(param.name(), param.value()); } } return servletInfo; } }
protected DeploymentManager createFathomDeploymentManager() throws ServletException { DeploymentInfo info = Servlets.deployment(); info.setDeploymentName("Fathom"); info.setClassLoader(this.getClass().getClassLoader()); info.setContextPath(settings.getContextPath()); info.setIgnoreFlush(true); info.setDefaultEncoding("UTF-8"); FilterInfo guiceFilter = new FilterInfo("GuiceFilter", GuiceFilter.class); guiceFilter.setAsyncSupported(true); info.addFilterUrlMapping("GuiceFilter", "/*", DispatcherType.REQUEST); info.addFilters(guiceFilter); ServletInfo defaultServlet = new ServletInfo("DefaultServlet", DefaultServlet.class); defaultServlet.setAsyncSupported(true); defaultServlet.addMapping("/"); ServletContextListener fathomListener = new ServletContextListener(settings); info.addListeners(new ListenerInfo(ServletContextListener.class, new ImmediateInstanceFactory<>(fathomListener))); MultipartConfigElement multipartConfig = new MultipartConfigElement(settings.getUploadFilesLocation(), settings.getUploadFilesMaxSize(), -1L, 0); defaultServlet.setMultipartConfig(multipartConfig); info.addServlets(defaultServlet); DeploymentManager deploymentManager = Servlets.defaultContainer().addDeployment(info); deploymentManager.deploy(); return deploymentManager; }
.setAsyncSupported( true ) .setLoadOnStartup( 1 ) .addMapping( "/api*" ) .setAsyncSupported( true ) .setLoadOnStartup( 99 ) .addMappings( UIServlet.PATHS );
protected void run() { try { final DeploymentInfo servletBuilder = deployment() .setClassLoader(AbstractUndertowServer.class.getClassLoader()) .setContextPath(contextPath) .setDeploymentName("sse-test") .addServlets( servlet("MessageServlet", CXFNonSpringJaxrsServlet.class) .addInitParam("jaxrs.providers", JacksonJsonProvider.class.getName()) .addInitParam("jaxrs.serviceClasses", BookStore.class.getName()) .setAsyncSupported(true) .setLoadOnStartup(1) .addMapping("/rest/*") ); final DeploymentManager manager = defaultContainer().addDeployment(servletBuilder); manager.deploy(); PathHandler path = Handlers .path(Handlers.redirect("/")) .addPrefixPath("/", manager.start()); server = Undertow.builder() .addHttpListener(port, "localhost") .setHandler(path) .build(); server.start(); } catch (final Exception ex) { ex.printStackTrace(); fail(ex.getMessage()); } }