Results 1 to 6 of 6

Thread: 2.3 servlet container and session scope issue

  1. #1
    Join Date
    May 2007
    Posts
    24

    Default 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. #2
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    452

    Default

    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

  3. #3
    Join Date
    May 2007
    Posts
    24

    Default

    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?

  4. #4
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Lightbulb

    Quote 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

  5. #5
    Join Date
    May 2007
    Posts
    24

    Default

    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.

  6. #6
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    Quote 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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •