Announcement Announcement Module
Collapse
No announcement yet.
2.3 servlet container and session scope issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 2.3 servlet container and session scope issue

    Hi,

    I'm trying to use a session scoped bean and inject it into singleton scoped components. I am doing this with the <aop:scoped-proxy/> tag in my session scoped bean. My problem is I now have to deploy this application to a servlet 2.3 container and so I have to switch back to DTD based configuration as opposed to Schema based. So my question is, how do I utilize this functionality when I can't define the aop namespace? Maybe I don't understand XML enough to solve this on my own and I apologize for that. But I could really use some help.

    Thanks

  • #2
    Hi,

    of course you can use the aop namespace. The only thing that you have to mention is that you can't use the listeners, but you have to use the filters instead.

    Code:
    <web-app>
      ..
      <filter> 
        <filter-name>requestContextFilter</filter-name> 
        <filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
      </filter> 
      <filter-mapping> 
        <filter-name>requestContextFilter</filter-name> 
        <url-pattern>/*</url-pattern>
      </filter-mapping>
      ...
    </web-app>
    You can use the full functionality of spring, even if you're using a servlet 2.3 compliant container.

    regars
    agim

    Comment


    • #3
      I've already included this context Filter instead of using the listener. My issue is in my local-servlet.xml file. I have to use DTD instead of schema with 2.3 container correct? If so, then how do I use the aop:scoped-proxy tag, since the aop namespace is not defined? Is there a way to define it using DTD structure? Here's what I have at the beginning of my local-servlet.xml file:

      Code:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
      		  "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
      <!--
        - Application context definition for "springapp" DispatcherServlet.
        -->
      
      <beans>
      ...
      Instead of what I used to have:
      Code:
      <?xml version="1.0" encoding="UTF-8"?>
      
      <beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	   xmlns:aop="http://www.springframework.org/schema/aop"
      	   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
      		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
      Did I clarify the issue I'm having?

      Comment


      • #4
        Originally posted by kmandeville View Post
        My issue is in my local-servlet.xml file. I have to use DTD instead of schema with 2.3 container correct? ...
        I do not think so.

        Spring context file(s) has nothing to do with container.

        Your web.xml has to use DTD, but context - not. Context file is interpreted solely by Spring without any assistance from container. You may remember that conext files may be used in standalone applications as well, when no container is present.

        So continue to use schema-based configuration.

        Regards,
        Oleksandr

        Comment


        • #5
          Thanks for the help. I split my single local-servlet.xml config file into two separate ones, one for the SpringMVC stuff (which needs to be DTD based or deploying application will fail) and an applicationContext.xml file that holds all my service and dao beans. My applicationContext.xml now is able to be Schema based so I can make use of session scope bean injection.

          Thanks for the help.

          Comment


          • #6
            Originally posted by kmandeville View Post
            Thanks for the help. I split my single local-servlet.xml config file into two separate ones, one for the SpringMVC stuff (which needs to be DTD based or deploying application will fail)....
            May you kindly explain how exactly it fails?

            Comment

            Working...
            X