diff --git a/core/src/main/java/org/springframework/ws/transport/http/MessageDispatcherServlet.java b/core/src/main/java/org/springframework/ws/transport/http/MessageDispatcherServlet.java index ddc42cc7..2519a88a 100644 --- a/core/src/main/java/org/springframework/ws/transport/http/MessageDispatcherServlet.java +++ b/core/src/main/java/org/springframework/ws/transport/http/MessageDispatcherServlet.java @@ -25,6 +25,7 @@ import org.springframework.beans.factory.BeanInitializationException; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.context.ApplicationContext; +import org.springframework.web.context.WebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.FrameworkServlet; import org.springframework.web.util.WebUtils; @@ -120,8 +121,60 @@ public class MessageDispatcherServlet extends FrameworkServlet { private boolean transformSchemaLocations = false; - /** Public constructor, necessary for some Web application servers. */ + /** + * Public constructor, necessary for some Web application servers. + */ public MessageDispatcherServlet() { + this(null); + } + + /** + * Constructor to support programmatic configuration of the Servlet with the specified + * web application context. This constructor is useful in Servlet 3.0+ environments + * where instance-based registration of servlets is possible through the + * {@code ServletContext#addServlet} API. + *
Using this constructor indicates that the following properties / init-params + * will be ignored: + *
The given web application context may or may not yet be {@linkplain + * org.springframework.web.context.ConfigurableWebApplicationContext#refresh() refreshed}. + * If it has not already been refreshed (the recommended approach), then + * the following will occur: + *
See {@link org.springframework.web.WebApplicationInitializer} for usage examples. + * + * @param webApplicationContext the context to use + * @see FrameworkServlet#FrameworkServlet(WebApplicationContext) + * @see org.springframework.web.WebApplicationInitializer + * @see #initWebApplicationContext() + * @see #configureAndRefreshWebApplicationContext(org.springframework.web.context.ConfigurableWebApplicationContext) + */ + public MessageDispatcherServlet(WebApplicationContext webApplicationContext) { + super(webApplicationContext); defaultStrategiesHelper = new DefaultStrategiesHelper(MessageDispatcherServlet.class); }