Java Code Examples for io.undertow.servlet.api.DeploymentInfo#setExceptionHandler()
The following examples show how to use
io.undertow.servlet.api.DeploymentInfo#setExceptionHandler() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AsyncListenerOnCompleteTest.java From quarkus-http with Apache License 2.0 | 5 votes |
@BeforeClass public static void setup() throws ServletException { final PathHandler root = new PathHandler(); final ServletContainer container = ServletContainer.Factory.newInstance(); ServletInfo f = new ServletInfo("asyncServlet", OnCompleteServlet.class) .addMapping("/async") .setAsyncSupported(true); ServletInfo a1 = new ServletInfo("message", MessageServlet.class) .setAsyncSupported(true) .addInitParam(MessageServlet.MESSAGE, "Hello") .addMapping("/message"); DeploymentInfo builder = new DeploymentInfo() .setClassLoader(AsyncListenerOnCompleteTest.class.getClassLoader()) .setContextPath("/servletContext") .setClassIntrospecter(TestClassIntrospector.INSTANCE) .setDeploymentName("servletContext.war") .addServlets(f, a1); builder.setExceptionHandler(LoggingExceptionHandler.builder() .add(IllegalStateException.class, "io.undertow", Logger.Level.DEBUG) .build()); DeploymentManager manager = container.addDeployment(builder); manager.deploy(); root.addPrefixPath(builder.getContextPath(), manager.start()); DefaultServer.setRootHandler(root); }
Example 2
Source File: AbstractResponseWrapperTestCase.java From quarkus-http with Apache License 2.0 | 5 votes |
@Before public void setup() throws ServletException { DeploymentInfo builder = new DeploymentInfo(); builder.setExceptionHandler(LoggingExceptionHandler.builder().add(IllegalArgumentException.class, "io.undertow", Logger.Level.DEBUG).build()); final PathHandler root = new PathHandler(); final ServletContainer container = ServletContainer.Factory.newInstance(); builder.addServlet(new ServletInfo("wrapperServlet", WrapperServlet.class) .addMapping("/*")); builder.addFilter(new FilterInfo("standard", StandardRequestWrappingFilter.class)); builder.addFilterUrlMapping("standard", "/standard", DispatcherType.REQUEST); builder.addFilter(new FilterInfo("nonstandard", NonStandardRequestWrappingFilter.class)); builder.addFilterUrlMapping("nonstandard", "/nonstandard", DispatcherType.REQUEST); builder.setClassIntrospecter(TestClassIntrospector.INSTANCE) .setClassLoader(AbstractResponseWrapperTestCase.class.getClassLoader()) .setContextPath("/servletContext") .setDeploymentName("servletContext.war") .setAllowNonStandardWrappers(isNonStandardAllowed()); final DeploymentManager manager = container.addDeployment(builder); manager.deploy(); root.addPrefixPath(builder.getContextPath(), manager.start()); DefaultServer.setRootHandler(root); }
Example 3
Source File: AsyncListenerOnErrorTest.java From quarkus-http with Apache License 2.0 | 4 votes |
@BeforeClass public static void setup() throws ServletException { final PathHandler root = new PathHandler(); final ServletContainer container = ServletContainer.Factory.newInstance(); ServletInfo f = new ServletInfo("faultyServlet", FaultyServlet.class) .addMapping("/faulty"); ServletInfo a1 = new ServletInfo("asyncServlet1", AsyncServlet1.class) .setAsyncSupported(true) .addMapping("/async1"); ServletInfo a2 = new ServletInfo("asyncServlet2", AsyncServlet2.class) .setAsyncSupported(true) .addMapping("/async2"); ServletInfo a3 = new ServletInfo("asyncServlet3", AsyncServlet3.class) .setAsyncSupported(true) .addMapping("/async3"); DeploymentInfo builder = new DeploymentInfo() .setClassLoader(AsyncListenerOnErrorTest.class.getClassLoader()) .setContextPath("/servletContext") .setClassIntrospecter(TestClassIntrospector.INSTANCE) .setDeploymentName("servletContext.war") .addServlets(f, a1, a2, a3); builder.setExceptionHandler(LoggingExceptionHandler.builder() .add(IllegalStateException.class, "io.undertow", Logger.Level.DEBUG) .build()); DeploymentManager manager = container.addDeployment(builder); manager.deploy(); root.addPrefixPath(builder.getContextPath(), manager.start()); DefaultServer.setRootHandler(root); }