portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine AbstractEngine.java
Date Thu, 11 Nov 2004 19:20:45 GMT
taylor      2004/11/11 11:20:45

  Modified:    portal/src/java/org/apache/jetspeed/request
                        JetspeedRequestContextComponent.java
               portal/src/java/org/apache/jetspeed/engine
                        AbstractEngine.java
  Log:
  abstracted threadlocal into request context component
  
  Revision  Changes    Path
  1.8       +12 -3     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
  
  Index: JetspeedRequestContextComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JetspeedRequestContextComponent.java	17 Oct 2004 14:02:38 -0000	1.7
  +++ JetspeedRequestContextComponent.java	11 Nov 2004 19:20:45 -0000	1.8
  @@ -38,15 +38,16 @@
       private Class contextClass = null;
       /** The user info manager. */
       private UserInfoManager userInfoMgr;
  +    private ThreadLocal tlRequestContext = new ThreadLocal();
   
       private final static Log log = LogFactory.getLog(JetspeedRequestContextComponent.class);
   
       public JetspeedRequestContextComponent(String contextClassName)
       {
  -        this(contextClassName, null);
       }
   
  -    public JetspeedRequestContextComponent(String contextClassName, UserInfoManager userInfoMgr)
  +    public JetspeedRequestContextComponent(String contextClassName, 
  +                                           UserInfoManager userInfoMgr)
       {
           this.contextClassName = contextClassName;
           this.userInfoMgr = userInfoMgr;
  @@ -80,11 +81,14 @@
               log.error(msg);
           }
   
  +        tlRequestContext.set(context);
  +        
           return context;
       }
   
       public void release(RequestContext context)
       {
  +        tlRequestContext.set(null);
       }
   
       /**
  @@ -97,6 +101,11 @@
       public RequestContext getRequestContext(HttpServletRequest request)
       {
           return (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
  +    }
  +    
  +    public RequestContext getRequestContext()
  +    {
  +        return (RequestContext) tlRequestContext.get();        
       }
   
   }
  
  
  
  1.11      +8 -4      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/AbstractEngine.java
  
  Index: AbstractEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/AbstractEngine.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AbstractEngine.java	24 Aug 2004 21:35:07 -0000	1.10
  +++ AbstractEngine.java	11 Nov 2004 19:20:45 -0000	1.11
  @@ -25,6 +25,7 @@
   import org.apache.commons.configuration.Configuration;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.apache.jetspeed.Jetspeed;
   import org.apache.jetspeed.JetspeedPortalContext;
   import org.apache.jetspeed.PortalContext;
   import org.apache.jetspeed.PortalReservedParameters;
  @@ -33,6 +34,7 @@
   import org.apache.jetspeed.exception.JetspeedException;
   import org.apache.jetspeed.pipeline.Pipeline;
   import org.apache.jetspeed.request.RequestContext;
  +import org.apache.jetspeed.request.RequestContextComponent;
   import org.apache.log4j.PropertyConfigurator;
   import org.apache.ojb.broker.util.ClassHelper;
   import org.apache.pluto.PortletContainer;
  @@ -65,7 +67,6 @@
           private static final Log log = LogFactory.getLog(AbstractEngine.class);
       private static final Log console = LogFactory.getLog(CONSOLE_LOGGER);
       /** stores the most recent RequestContext on a per thread basis */
  -    private ThreadLocal tlRequestContext = new ThreadLocal();
       protected boolean useInternalJNDI;
       protected String defaultPipelineName;
   
  @@ -238,7 +239,7 @@
               {                
                   targetPipeline = (String)context.getAttribute(PortalReservedParameters.PIPELINE);
               
               }
  -            tlRequestContext.set(context);
  +            // tlRequestContext.set(context);
               Pipeline pipeline = getPipeline();
               if (targetPipeline != null)
               {
  @@ -337,7 +338,10 @@
        */
       public RequestContext getCurrentRequestContext()
       {
  -        return (RequestContext) tlRequestContext.get();
  +        RequestContextComponent contextComponent = (RequestContextComponent) Jetspeed.getComponentManager()
  +            .getComponent(RequestContextComponent.class);
  +        return contextComponent.getRequestContext();
  +        //return (RequestContext) tlRequestContext.get();
       }
   
       public ComponentManager getComponentManager()
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message