Announcement Announcement Module
Collapse
No announcement yet.
parentContextKey and MessageDispatcherServlet Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • parentContextKey and MessageDispatcherServlet

    Hello,
    I'm trying to get ear "shared context" (link) working, but no luck. Is it possible to use spring parentContextKey in web.xml while using MessageDispatcherServlet? I've tried so, but my shared context xml never got loaded. In airplane example I can see how to mix spring-mvc with spring-ws, but our web UI application should be in another war inside same ear.

  • #2
    This is really not my area of expertise, but the usage of a parentContextKey has nothing to do with the MessageDispatcherServlet, but rather with the ContextLoaderListener. If you look at the sample project attached to the Joris' blog entry, you will see that he has his own Servlets: FirstServlet and SecondServlet, and he doesn't use Spring's DispatcherServlet, or MessageDispatcherServlet.

    Comment


    • #3
      Thanks, I've used configs from Joris' ear and it worked.
      Now I'm just curious about in what relation are those contexts. One is build from implicit spring-ws-servlet.xml and one is build from location specified by contextConfigLocation web context-param.
      Do these two together make one context (like import) or one is parent context of the another?
      Code:
      	<context-param>
      		<param-name>locatorFactorySelector</param-name>
      		<param-value>classpath*:META-INF/spring-ref-ctx.xml</param-value>
      	</context-param>
      	
      	<context-param>
      		<param-name>parentContextKey</param-name>
      		<param-value>sis2.tmodule.common</param-value>
      	</context-param>
      	
      	<context-param>
      		<param-name>contextConfigLocation</param-name>
      		<param-value>WEB-INF/spring-dummy.xml</param-value>
      	</context-param>
      
      	<listener>
      		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      	</listener>
      
      	<servlet>
      		<servlet-name>spring-ws</servlet-name>
      		<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
      		<load-on-startup>1</load-on-startup>
      	</servlet>

      Comment


      • #4
        Originally posted by anthavio View Post
        Thanks, I've used configs from Joris' ear and it worked.
        Now I'm just curious about in what relation are those contexts. One is build from implicit spring-ws-servlet.xml and one is build from location specified by contextConfigLocation web context-param.
        Do these two together make one context (like import) or one is parent context of the another?
        If you're using a (Message)DispatcherServlet, a ContextLoaderListener and a parentContextKey param, then you end up with 3 contexts in a hierarchy: the root will be the context referred to by the parentContextKey, the context created by the ContextLoaderListener sits in the middle and the context created for the DispatcherServlet is the leaf context.

        Comment


        • #5
          Sounds reasonable. Thank you for clarification.

          Comment

          Working...
          X