Changeset 3908

Show
Ignore:
Timestamp:
09/25/08 11:05:01 (3 months ago)
Author:
mtld
Message:

fixed session-timeout NPE, cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pfixcore/ChangeLog

    r3907 r3908  
     12008-09-25  Martin Leidig  <mleidig@schlund.de> 
     2 
     3        Removed unnecessary injection of ServerContextImpl: 
     4        * src/org/pustefixframework/http/PustefixContextDirectOutputRequestHandler.java: 
     5        * src/org/pustefixframework/http/PustefixContextXMLRequestHandler.java 
     6        * src/org/pustefixframework/config/project/parser/PustefixContextDirectOutputRequestHandlerParsingHandler.java 
     7        * src/org/pustefixframework/config/project/parser/PustefixContextXMLRequestHandlerParsingHandler.java 
     8 
     9        * src/org/pustefixframework/config/contextxmlservice/parser/ContextXMLParsingHandler.java: 
     10        add init method to bean definition 
     11        * src/de/schlund/pfixcore/workflow/context/SessionContextImpl.java: 
     12        fixed NullPointerException occurring on session timeout 
     13        * src/de/schlund/pfixcore/workflow/ContextImpl.java: 
     14        call SessionContextImpl.init from init method called by Spring 
     15        * src/de/schlund/pfixcore/util/DummyContextFactory.java: 
     16        removed, unit tests now should be done by Spring means (setting up a 
     17        PustefixWebApplicationContext) 
     18 
    1192008-09-24  Martin Leidig  <mleidig@schlund.de> 
    220 
  • trunk/pfixcore/src/de/schlund/pfixcore/workflow/ContextImpl.java

    r3893 r3908  
    2222 
    2323import javax.servlet.http.Cookie; 
    24 import javax.servlet.http.HttpSession; 
    2524import javax.servlet.http.HttpSessionBindingEvent; 
    2625import javax.servlet.http.HttpSessionBindingListener; 
     
    5453    } 
    5554     
    56     //TODO: rework 
    57     public void setSession(HttpSession session) throws PustefixApplicationException, PustefixCoreException { 
    58         sessioncontext.init(this, session); 
     55    public void init() throws PustefixCoreException, PustefixApplicationException{ 
     56        sessioncontext.init(this); 
    5957    } 
    6058     
     
    314312    // Notification on session binding / unbinding 
    315313 
    316     //TODO: remove 
    317314    public void valueBound(HttpSessionBindingEvent ev) { 
    318315        this.sessioncontext.setSession(ev.getSession()); 
    319316    } 
    320     //TODO: remove 
     317 
    321318    public void valueUnbound(HttpSessionBindingEvent ev) { 
    322319        if (ev.getSession() == this.sessioncontext.getSession()) { 
  • trunk/pfixcore/src/de/schlund/pfixcore/workflow/context/SessionContextImpl.java

    r3797 r3908  
    6565    } 
    6666 
    67     public void init(Context context, HttpSession session) throws PustefixApplicationException, PustefixCoreException { 
     67    public void init(Context context) throws PustefixApplicationException, PustefixCoreException { 
    6868         
    69         //TODO: rework session stuff 
    7069        synchronized(this) { 
    7170            if(authentication == null) { 
     
    101100    public void setSession(HttpSession session) { 
    102101        this.session = session; 
    103         initSession(session); 
     102        if(session != null) initSession(session); 
    104103    } 
    105104 
  • trunk/pfixcore/src/org/pustefixframework/config/contextxmlservice/parser/ContextXMLParsingHandler.java

    r3897 r3908  
    159159            beanBuilder = BeanDefinitionBuilder.genericBeanDefinition(ContextImpl.class); 
    160160            beanBuilder.setScope("session"); 
     161            beanBuilder.setInitMethodName("init"); 
    161162            beanBuilder.addPropertyReference("serverContext", ServerContextImpl.class.getName()); 
    162163            beanBuilder.addPropertyReference("contextResourceManager", ContextResourceManagerImpl.class.getName()); 
  • trunk/pfixcore/src/org/pustefixframework/config/project/parser/PustefixContextDirectOutputRequestHandlerParsingHandler.java

    r3899 r3908  
    5555 
    5656import de.schlund.pfixcore.workflow.ContextImpl; 
    57 import de.schlund.pfixcore.workflow.context.ServerContextImpl; 
    5857import de.schlund.pfixxml.config.includes.IncludesResolver; 
    5958import de.schlund.pfixxml.resources.ResourceUtil; 
     
    136135        beanBuilder.setInitMethodName("init"); 
    137136        beanBuilder.addPropertyValue("handlerURI", path + "/**"); 
    138         beanBuilder.addPropertyValue("serverContext", new RuntimeBeanReference(ServerContextImpl.class.getName())); 
    139137        beanBuilder.addPropertyValue("context", new RuntimeBeanReference(ContextImpl.class.getName())); 
    140138        beanBuilder.addPropertyValue("stateMap", new RuntimeBeanReference(mapBeanName)); 
  • trunk/pfixcore/src/org/pustefixframework/config/project/parser/PustefixContextXMLRequestHandlerParsingHandler.java

    r3906 r3908  
    5252 
    5353import de.schlund.pfixcore.workflow.ContextImpl; 
    54 import de.schlund.pfixcore.workflow.context.ServerContextImpl; 
    5554import de.schlund.pfixxml.config.BuildTimeProperties; 
    5655import de.schlund.pfixxml.resources.FileResource; 
     
    121120        beanBuilder.addPropertyValue("dependFile", dependFile); 
    122121        beanBuilder.addPropertyValue("handlerURI", path + "/**"); 
    123         beanBuilder.addPropertyValue("serverContext", new RuntimeBeanReference(ServerContextImpl.class.getName())); 
    124122        beanBuilder.addPropertyValue("context", new RuntimeBeanReference(ContextImpl.class.getName())); 
    125123        beanBuilder.addPropertyValue("configuration", config); 
  • trunk/pfixcore/src/org/pustefixframework/http/PustefixContextDirectOutputRequestHandler.java

    r3822 r3908  
    3737import de.schlund.pfixcore.workflow.DirectOutputState; 
    3838import de.schlund.pfixcore.workflow.PageRequest; 
    39 import de.schlund.pfixcore.workflow.context.ServerContextImpl; 
    4039import de.schlund.pfixxml.PfixServletRequest; 
    4140import de.schlund.pfixxml.resources.FileResource; 
     
    7271    private Map<String, DirectOutputState> stateMap; 
    7372     
    74     private ServerContextImpl serverContext; 
    7573    private ContextImpl context; 
    7674     
     
    125123          
    126124         // Make sure the context is initialized and deinitialized this thread 
    127          context.setServerContext(serverContext); 
    128125         context.prepareForRequest(); 
    129126         try { 
    130127             if (config.isSynchronized()) { 
    131128                 synchronized (context) { 
    132                      doProcess(preq, res, serverContext, context); 
     129                     doProcess(preq, res, context); 
    133130                 } 
    134131             } else { 
    135                  doProcess(preq, res, serverContext, context); 
     132                 doProcess(preq, res, context); 
    136133             } 
    137134         } finally { 
     
    140137    } 
    141138     
    142     protected void doProcess(PfixServletRequest preq, HttpServletResponse res, ServerContextImpl servercontext, ContextImpl context) throws Exception { 
     139    protected void doProcess(PfixServletRequest preq, HttpServletResponse res, ContextImpl context) throws Exception { 
    143140         ContextResourceManager crm = context.getContextResourceManager(); 
    144141          
     
    204201    } 
    205202     
    206     public void setServerContext(ServerContextImpl serverContext) { 
    207         this.serverContext = serverContext; 
    208     } 
    209      
    210203    public void setContext(ContextImpl context) { 
    211204        this.context = context; 
  • trunk/pfixcore/src/org/pustefixframework/http/PustefixContextXMLRequestHandler.java

    r3906 r3908  
    4242import de.schlund.pfixcore.workflow.ExtendedContext; 
    4343import de.schlund.pfixcore.workflow.context.RequestContextImpl; 
    44 import de.schlund.pfixcore.workflow.context.ServerContextImpl; 
    4544import de.schlund.pfixxml.PfixServletRequest; 
    4645import de.schlund.pfixxml.PfixServletRequestImpl; 
     
    6564    private ContextXMLServletConfig config = null; 
    6665 
    67     private ServerContextImpl servercontext = null; 
    6866    private ContextImpl context = null; 
    6967     
     
    233231            throw new PustefixRuntimeException("No valid session found! Aborting..."); 
    234232        } 
    235  
    236         //TODO: remove 
    237         synchronized (session) { 
    238                 context.setServerContext(servercontext); 
    239                 context.setSession(session); 
    240         } 
    241          
    242233        return context; 
    243234    } 
     
    265256    } 
    266257 
    267     public void setServerContext(ServerContextImpl servercontext) { 
    268         this.servercontext = servercontext; 
    269     } 
    270      
    271258    public void setContext(ContextImpl context) { 
    272259        this.context = context;