use of org.springframework.ws.transport.http.MessageDispatcherServlet in project webservices-axiom by apache.
the class ScenarioTestCase method setUp.
@Override
protected void setUp() throws Exception {
server = new Server();
// Set up a custom thread pool to improve thread names (for logging purposes)
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setName("jetty");
server.setThreadPool(threadPool);
Connector connector = new SelectChannelConnector();
connector.setPort(0);
server.setConnectors(new Connector[] { connector });
ServletContextHandler handler = new ServletContextHandler(server, "/");
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setContextClass(GenericWebApplicationContext.class);
servlet.setContextInitializers(new ApplicationContextInitializer<ConfigurableApplicationContext>() {
public void initialize(ConfigurableApplicationContext applicationContext) {
configureContext((GenericWebApplicationContext) applicationContext, config.getServerMessageFactoryConfigurator(), new ClassPathResource("server.xml", ScenarioTestCase.this.getClass()));
}
});
ServletHolder servletHolder = new ServletHolder(servlet);
servletHolder.setName("spring-ws");
servletHolder.setInitOrder(1);
handler.addServlet(servletHolder, "/*");
server.start();
context = new GenericXmlApplicationContext();
MockPropertySource propertySource = new MockPropertySource("client-properties");
propertySource.setProperty("port", connector.getLocalPort());
context.getEnvironment().getPropertySources().replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, propertySource);
configureContext(context, config.getClientMessageFactoryConfigurator(), new ClassPathResource("client.xml", getClass()));
context.refresh();
}
use of org.springframework.ws.transport.http.MessageDispatcherServlet in project spring-boot by spring-projects.
the class WebServicesAutoConfiguration method messageDispatcherServlet.
@Bean
public ServletRegistrationBean<MessageDispatcherServlet> messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
String path = this.properties.getPath();
String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
ServletRegistrationBean<MessageDispatcherServlet> registration = new ServletRegistrationBean<>(servlet, urlMapping);
WebServicesProperties.Servlet servletProperties = this.properties.getServlet();
registration.setLoadOnStartup(servletProperties.getLoadOnStartup());
for (Map.Entry<String, String> entry : servletProperties.getInit().entrySet()) {
registration.addInitParameter(entry.getKey(), entry.getValue());
}
return registration;
}
Aggregations