org.springframework.web.WebApplicationInitializer Java Examples
The following examples show how to use
org.springframework.web.WebApplicationInitializer.
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: SpringBootLambdaContainerHandler.java From aws-serverless-java-container with Apache License 2.0 | 6 votes |
/** * Creates a new container handler with the given reader and writer objects * * @param requestTypeClass The class for the incoming Lambda event * @param requestReader An implementation of `RequestReader` * @param responseWriter An implementation of `ResponseWriter` * @param securityContextWriter An implementation of `SecurityContextWriter` * @param exceptionHandler An implementation of `ExceptionHandler` * @param springBootInitializer {@code SpringBootServletInitializer} class * @throws ContainerInitializationException If an error occurs while initializing the Spring framework */ public SpringBootLambdaContainerHandler(Class<RequestType> requestTypeClass, Class<ResponseType> responseTypeClass, RequestReader<RequestType, HttpServletRequest> requestReader, ResponseWriter<AwsHttpServletResponse, ResponseType> responseWriter, SecurityContextWriter<RequestType> securityContextWriter, ExceptionHandler<ResponseType> exceptionHandler, Class<? extends WebApplicationInitializer> springBootInitializer, InitializationWrapper init) throws ContainerInitializationException { super(requestTypeClass, responseTypeClass, requestReader, responseWriter, securityContextWriter, exceptionHandler); Timer.start("SPRINGBOOT_CONTAINER_HANDLER_CONSTRUCTOR"); initialized = false; this.springBootInitializer = springBootInitializer; setInitializationWrapper(init); SpringBootLambdaContainerHandler.setInstance(this); Timer.stop("SPRINGBOOT_CONTAINER_HANDLER_CONSTRUCTOR"); }
Example #2
Source File: TomcatWebSocketTestServer.java From bearchoke with Apache License 2.0 | 6 votes |
public void deployConfig(Class<? extends WebApplicationInitializer>... initializers) { this.context = this.tomcatServer.addContext("", System.getProperty("java.io.tmpdir")); // Add Tomcat's DefaultServlet Wrapper defaultServlet = this.context.createWrapper(); defaultServlet.setName("default"); defaultServlet.setServletClass("org.apache.catalina.servlets.DefaultServlet"); this.context.addChild(defaultServlet); // Ensure WebSocket support this.context.addApplicationListener(WsContextListener.class.getName()); this.context.addServletContainerInitializer( new SpringServletContainerInitializer(), new HashSet<Class<?>>(Arrays.asList(initializers))); }
Example #3
Source File: SpringBootLambdaContainerHandler.java From aws-serverless-java-container with Apache License 2.0 | 5 votes |
/** * Creates a default SpringLambdaContainerHandler initialized with the `AwsProxyRequest` and `AwsProxyResponse` objects and the given Spring profiles * @param springBootInitializer {@code SpringBootServletInitializer} class * @param profiles A list of Spring profiles to activate * @return An initialized instance of the `SpringLambdaContainerHandler` * @throws ContainerInitializationException If an error occurs while initializing the Spring framework */ public static SpringBootLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> getAwsProxyHandler(Class<? extends WebApplicationInitializer> springBootInitializer, String... profiles) throws ContainerInitializationException { return new SpringBootProxyHandlerBuilder<AwsProxyRequest>() .defaultProxy() .initializationWrapper(new InitializationWrapper()) .springBootApplication(springBootInitializer) .profiles(profiles) .buildAndInitialize(); }
Example #4
Source File: SpringBootLambdaContainerHandler.java From aws-serverless-java-container with Apache License 2.0 | 5 votes |
/** * Creates a default SpringLambdaContainerHandler initialized with the `HttpApiV2ProxyRequest` and `AwsProxyResponse` objects and the given Spring profiles * @param springBootInitializer {@code SpringBootServletInitializer} class * @param profiles A list of Spring profiles to activate * @return An initialized instance of the `SpringLambdaContainerHandler` * @throws ContainerInitializationException If an error occurs while initializing the Spring framework */ public static SpringBootLambdaContainerHandler<HttpApiV2ProxyRequest, AwsProxyResponse> getHttpApiV2ProxyHandler(Class<? extends WebApplicationInitializer> springBootInitializer, String... profiles) throws ContainerInitializationException { return new SpringBootProxyHandlerBuilder<HttpApiV2ProxyRequest>() .defaultHttpApiV2Proxy() .initializationWrapper(new InitializationWrapper()) .springBootApplication(springBootInitializer) .profiles(profiles) .buildAndInitialize(); }
Example #5
Source File: SpringBootProxyHandlerBuilder.java From aws-serverless-java-container with Apache License 2.0 | 4 votes |
public SpringBootProxyHandlerBuilder<RequestType> springBootApplication(Class<? extends WebApplicationInitializer> app) { springBootInitializer = app; return self(); }