You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by dl...@apache.org on 2004/05/19 04:15:49 UTC

cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request JetspeedRequestContextComponent.java

dlestrat    2004/05/18 19:15:49

  Modified:    portal/src/java/org/apache/jetspeed/request
                        JetspeedRequestContextComponent.java
  Log:
  Continuing PLT 17 - user info. Integrating UserInfoManager with the request.getAttribute().
  
  Revision  Changes    Path
  1.4       +29 -16    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JetspeedRequestContextComponent.java	31 Mar 2004 06:19:08 -0000	1.3
  +++ JetspeedRequestContextComponent.java	19 May 2004 02:15:49 -0000	1.4
  @@ -23,7 +23,9 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +
   import org.apache.jetspeed.container.session.NavigationalStateComponent;
  +import org.apache.jetspeed.userinfo.UserInfoManager;
   
   /**
    * JetspeedRequestContextComponent
  @@ -31,24 +33,29 @@
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
    * @version $Id$
    */
  -public class JetspeedRequestContextComponent implements RequestContextComponent 
  +public class JetspeedRequestContextComponent implements RequestContextComponent
   {
       private String contextClassName = null;
       private Class contextClass = null;
       private NavigationalStateComponent nav;
  -    
  +    /** The user info manager. */
  +    private UserInfoManager userInfoMgr;
  +
       private final static Log log = LogFactory.getLog(JetspeedRequestContextComponent.class);
   
  -    
       public JetspeedRequestContextComponent(NavigationalStateComponent nav, String contextClassName)
       {
  -        this.nav = nav;        
  -        this.contextClassName = contextClassName;        
  +        this(nav, contextClassName, null);
       }
  -    
  -    public RequestContext create(HttpServletRequest req,
  -                                 HttpServletResponse resp, 
  -                                 ServletConfig config)
  +
  +    public JetspeedRequestContextComponent(NavigationalStateComponent nav, String contextClassName, UserInfoManager userInfoMgr)
  +    {
  +        this.nav = nav;
  +        this.contextClassName = contextClassName;
  +        this.userInfoMgr = userInfoMgr;
  +    }
  +
  +    public RequestContext create(HttpServletRequest req, HttpServletResponse resp, ServletConfig config)
       {
           RequestContext context = null;
   
  @@ -60,12 +67,18 @@
               }
   
               // TODO: we could use a pooled object implementation here
  -            Constructor constructor = contextClass.getConstructor(new Class[] 
  -                          {HttpServletRequest.class, HttpServletResponse.class, ServletConfig.class, NavigationalStateComponent.class});
  -            context = (RequestContext) constructor.newInstance(new Object[] {req, resp, config, nav});
  +            Constructor constructor =
  +                contextClass.getConstructor(
  +                    new Class[] {
  +                        HttpServletRequest.class,
  +                        HttpServletResponse.class,
  +                        ServletConfig.class,
  +                        NavigationalStateComponent.class,
  +                        UserInfoManager.class });
  +            context = (RequestContext) constructor.newInstance(new Object[] { req, resp, config, nav, userInfoMgr });
   
           }
  -        catch(Exception e)
  +        catch (Exception e)
           {
               String msg = "JetspeedRequestContextComponent: Failed to create a Class object for RequestContext: " + e.toString();
               log.error(msg);
  @@ -74,7 +87,7 @@
           return context;
       }
   
  -    public void release(RequestContext context) 
  +    public void release(RequestContext context)
       {
       }
   
  @@ -89,5 +102,5 @@
       {
           return (RequestContext) request.getAttribute(JetspeedRequestContext.REQUEST_PORTALENV);
       }
  -    
  +
   }
  
  
  

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