cziegeler    01/04/20 06:05:08

  Modified:    .        Tag: xml-cocoon2 changes.xml todo.xml
               src/org/apache/cocoon Tag: xml-cocoon2 Constants.java
               src/org/apache/cocoon/components/url Tag: xml-cocoon2
                        ContextURLFactory.java
               src/org/apache/cocoon/environment/http Tag: xml-cocoon2
                        HttpCookie.java HttpEnvironment.java
                        HttpRequest.java
               src/org/apache/cocoon/selection Tag: xml-cocoon2
                        HostSelectorFactory.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
  Log:
  Finished environment cleanup. We are now as independant of the
  servlet classes as possible (at this stage...)
  
  Cleaned up javadocs and added missing author
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.35  +5 -1      xml-cocoon/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/changes.xml,v
  retrieving revision 1.9.2.34
  retrieving revision 1.9.2.35
  diff -u -r1.9.2.34 -r1.9.2.35
  --- changes.xml       2001/04/18 12:05:44     1.9.2.34
  +++ changes.xml       2001/04/20 13:04:56     1.9.2.35
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes
  -  $Id: changes.xml,v 1.9.2.34 2001/04/18 12:05:44 cziegeler Exp $
  +  $Id: changes.xml,v 1.9.2.35 2001/04/20 13:04:56 cziegeler Exp $
   -->
   
   <changes title="History of Changes">
  @@ -24,6 +24,10 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="CZ" type="update">
  +  Finished cleanup of the environment. We are now as independant of 
  +  the javax.servlet package as possible.
  +  </action>
     <action dev="CZ" type="add">
      Creating wrappers for Session and Cookie.
      The creation of these wrapper classes allow us to be independent
  
  
  
  1.6.2.31  +1 -5      xml-cocoon/todo.xml
  
  Index: todo.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/todo.xml,v
  retrieving revision 1.6.2.30
  retrieving revision 1.6.2.31
  diff -u -r1.6.2.30 -r1.6.2.31
  --- todo.xml  2001/04/19 13:11:39     1.6.2.30
  +++ todo.xml  2001/04/20 13:04:57     1.6.2.31
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes
  -  $Id: todo.xml,v 1.6.2.30 2001/04/19 13:11:39 cziegeler Exp $
  +  $Id: todo.xml,v 1.6.2.31 2001/04/20 13:04:57 cziegeler Exp $
   -->
   
   
  @@ -27,10 +27,6 @@
    </devs>
   
    <actions priority="high">
  -  <action context="code" assigned-to="open">
  -   Remove dependencies to the javax.servlet classes.
  -  </action>
  -
     <action context="code" assigned-to="open">
      Reloading of jar-files.
      The class-path for the Cocoon-Servlet is only build once when the servlet
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.19  +2 -2      xml-cocoon/src/org/apache/cocoon/Attic/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Constants.java,v
  retrieving revision 1.1.2.18
  retrieving revision 1.1.2.19
  diff -u -r1.1.2.18 -r1.1.2.19
  --- Constants.java    2001/04/02 13:53:06     1.1.2.18
  +++ Constants.java    2001/04/20 13:04:59     1.1.2.19
  @@ -10,7 +10,7 @@
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.18 $ $Date: 2001/04/02 13:53:06 $
  + * @version CVS $Revision: 1.1.2.19 $ $Date: 2001/04/20 13:04:59 $
    */
   
   public interface Constants {
  @@ -56,7 +56,7 @@
       String ERROR_NAMESPACE_URI = "http://apache.org/cocoon/"; + CONF_VERSION 
+ "/error";
       String ERROR_NAMESPACE_PREFIX = "error";
   
  -    String CONTEXT_SERVLET_CONTEXT = "servlet-context";
  +    String CONTEXT_ENVIRONMENT_CONTEXT = "environment-context";
       String CONTEXT_ROOT_PATH       = "root-path";
       String CONTEXT_CLASS_LOADER    = "class-loader";
       String CONTEXT_WORK_DIR        = "work-directory";
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +10 -12    
xml-cocoon/src/org/apache/cocoon/components/url/Attic/ContextURLFactory.java
  
  Index: ContextURLFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/url/Attic/ContextURLFactory.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- ContextURLFactory.java    2001/03/23 12:26:07     1.1.2.4
  +++ ContextURLFactory.java    2001/04/20 13:05:00     1.1.2.5
  @@ -10,24 +10,22 @@
   import java.net.URL;
   import java.net.MalformedURLException;
   
  -import javax.servlet.ServletContext;
  -
  -import org.apache.cocoon.Constants;
  -
  -import org.apache.avalon.Context;
   import org.apache.avalon.Contextualizable;
   import org.apache.avalon.AbstractLoggable;
   
  +import org.apache.cocoon.Constants;
  +import org.apache.cocoon.environment.Context;
  +
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
  - * @version $Id: ContextURLFactory.java,v 1.1.2.4 2001/03/23 12:26:07 dims 
Exp $
  + * @version $Id: ContextURLFactory.java,v 1.1.2.5 2001/04/20 13:05:00 
cziegeler Exp $
    */
   public class ContextURLFactory extends AbstractLoggable implements 
URLFactory, Contextualizable {
   
       /**
        * The context
        */
  -    protected Context context;
  +    protected org.apache.avalon.Context context;
   
       /**
        * Create a URL from a location. This method supports the
  @@ -39,12 +37,12 @@
        * @exception MalformedURLException If the location is malformed
        */
       public URL getURL(String location) throws MalformedURLException {
  -        ServletContext servletContext = 
(ServletContext)context.get(Constants.CONTEXT_SERVLET_CONTEXT);
  -        if (servletContext == null) {
  -            getLogger().warn("no servlet-context in application context 
(making an absolute URL)");
  +        Context envContext = 
(Context)this.context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
  +        if (envContext == null) {
  +            getLogger().warn("no environment-context in application context 
(making an absolute URL)");
               return new URL(location);
           }
  -        URL u = 
((ServletContext)context.get("servlet-context")).getResource(location);
  +        URL u = envContext.getResource(location);
           if (u != null)
               return u;
           else {
  @@ -60,7 +58,7 @@
       /**
        * Get the context
        */
  -    public void contextualize(Context context) {
  +    public void contextualize(org.apache.avalon.Context context) {
           if (this.context == null) {
               this.context = context;
           }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +3 -3      
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpCookie.java
  
  Index: HttpCookie.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpCookie.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- HttpCookie.java   2001/04/18 12:05:58     1.1.2.1
  +++ HttpCookie.java   2001/04/20 13:05:02     1.1.2.2
  @@ -24,7 +24,7 @@
    * of your servlets.
    *
    * <p>The servlet sends cookies to the browser by using the
  - * [EMAIL PROTECTED] Response#addCookie} method, which adds
  + * [EMAIL PROTECTED] HttpResponse#addCookie} method, which adds
    * fields to HTTP response headers to send cookies to the
    * browser, one at a time. The browser is expected to
    * support 20 cookies for each Web server, 300 cookies total, and
  @@ -32,7 +32,7 @@
    *
    * <p>The browser returns cookies to the servlet by adding
    * fields to HTTP request headers. Cookies can be retrieved
  - * from a request by using the [EMAIL PROTECTED] Request#getCookies} method.
  + * from a request by using the [EMAIL PROTECTED] HttpRequest#getCookies} 
method.
    * Several cookies might have the same name but different path attributes.
    *
    * <p>Cookies affect the caching of the Web pages that use them.
  @@ -46,7 +46,7 @@
    *
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/04/18 12:05:58 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/04/20 13:05:02 $
    *
    */
   
  
  
  
  1.1.2.26  +3 -2      
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java
  
  Index: HttpEnvironment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java,v
  retrieving revision 1.1.2.25
  retrieving revision 1.1.2.26
  diff -u -r1.1.2.25 -r1.1.2.26
  --- HttpEnvironment.java      2001/04/20 12:03:22     1.1.2.25
  +++ HttpEnvironment.java      2001/04/20 13:05:02     1.1.2.26
  @@ -50,13 +50,14 @@
        */
       public HttpEnvironment (String uri, HttpServletRequest req,
                               HttpServletResponse res,
  -                            ServletContext servletContext)
  +                            ServletContext servletContext,
  +                            HttpContext context)
       throws MalformedURLException, IOException {
           super(uri, req.getParameter(Constants.VIEW_PARAM), 
servletContext.getRealPath("/"), req.getParameter(Constants.ACTION_PARAM));
   
           this.request = new HttpRequest (req, this);
           this.response = new HttpResponse (res);
  -        this.context = new HttpContext (servletContext);
  +        this.context = context;
           this.outputStream = response.getOutputStream();
           this.objectModel.put(Constants.REQUEST_OBJECT, this.request);
           this.objectModel.put(Constants.RESPONSE_OBJECT, this.response);
  
  
  
  1.1.2.10  +4 -4      
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpRequest.java
  
  Index: HttpRequest.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpRequest.java,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- HttpRequest.java  2001/04/19 13:11:46     1.1.2.9
  +++ HttpRequest.java  2001/04/20 13:05:02     1.1.2.10
  @@ -28,7 +28,7 @@
    * to provide request information for HTTP servlets.
    *
    * @author <a href="mailto:[EMAIL PROTECTED],org">Giacomo Pati</a>
  - * @version CVS $Id: HttpRequest.java,v 1.1.2.9 2001/04/19 13:11:46 
cziegeler Exp $
  + * @version CVS $Id: HttpRequest.java,v 1.1.2.10 2001/04/20 13:05:02 
cziegeler Exp $
    */
   
   public class HttpRequest implements Request {
  @@ -187,8 +187,8 @@
   
       /**
        * @deprecated           As of Version 2.1 of the Java Servlet
  -     *                               API, use [EMAIL PROTECTED] 
#isRequestedSessionIdFromURL}
  -     *                               instead.
  +     * API, use [EMAIL PROTECTED] #isRequestedSessionIdFromURL}
  +     *instead.
        */
       public boolean isRequestedSessionIdFromUrl() {
           return this.req.isRequestedSessionIdFromUrl();
  @@ -286,7 +286,7 @@
   
       /**
        * @deprecated   As of Version 2.1 of the Java Servlet API,
  -     *                       use [EMAIL PROTECTED] 
javax.servlet.ServletContext#getRealPath} instead.
  +     * use [EMAIL PROTECTED] javax.servlet.ServletContext#getRealPath} 
instead.
        */
       public String getRealPath(String path) {
           return this.req.getRealPath(path);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +3 -3      
xml-cocoon/src/org/apache/cocoon/selection/Attic/HostSelectorFactory.java
  
  Index: HostSelectorFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/selection/Attic/HostSelectorFactory.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- HostSelectorFactory.java  2001/03/23 19:38:19     1.1.2.3
  +++ HostSelectorFactory.java  2001/04/20 13:05:06     1.1.2.4
  @@ -20,7 +20,7 @@
   import org.apache.cocoon.CodeFactory;
   
   /**
  - * This class generates source code to implement a selector that 
  + * This class generates source code to implement a selector that
    * matches a string from within the host parameter of the HTTP request
    *
    *  <map:selector name="host" 
factory="org.apache.cocoon.selection.HostSelectorFactory">
  @@ -37,8 +37,8 @@
    *       </map:otherwise>
    *   </map:select>
    *
  - * @author 
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/03/23 19:38:19 $
  + * @author <a href="mailto:[EMAIL PROTECTED]">Colin Britton</a>
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/04/20 13:05:06 $
   */
   
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.84  +16 -12    
xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
  retrieving revision 1.1.4.83
  retrieving revision 1.1.4.84
  diff -u -r1.1.4.83 -r1.1.4.84
  --- CocoonServlet.java        2001/04/20 07:16:16     1.1.4.83
  +++ CocoonServlet.java        2001/04/20 13:05:07     1.1.4.84
  @@ -41,6 +41,8 @@
   import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.environment.http.HttpEnvironment;
   import org.apache.cocoon.environment.http.RequestWrapper;
  +import org.apache.cocoon.environment.http.HttpContext;
  +import org.apache.cocoon.environment.Context;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.util.ClassUtils;
   import org.apache.cocoon.util.NetUtils;
  @@ -63,7 +65,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.4.83 $ $Date: 2001/04/20 07:16:16 $
  + * @version CVS $Revision: 1.1.4.84 $ $Date: 2001/04/20 13:05:07 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -85,6 +87,8 @@
       private static final boolean SILENTLY_RENAME = true;
       private File uploadDir;
   
  +    protected ServletContext servletContext;
  +
       /**
        * Initialize this <code>CocoonServlet</code> instance.  You will
        * notice that I have broken the init into sub methods to make it
  @@ -102,33 +106,32 @@
   
           super.init(conf);
           ClassLoader classloader = buildInitClassLoader();
  -        ServletContext context = conf.getServletContext();
  +        this.servletContext = conf.getServletContext();
   
           ClassUtils.setClassLoader(classloader);
           this.appContext.put(Constants.CONTEXT_CLASS_LOADER, classloader);
  -
  -        this.appContext.put(Constants.CONTEXT_SERVLET_CONTEXT, context);
   
  -        this.initLogger(context);
  +        this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, new 
HttpContext(this.servletContext));
  +        this.initLogger(this.servletContext);
   
  -        this.appContext.put(Constants.CONTEXT_CLASSPATH, 
this.getClassPath(context));
  +        this.appContext.put(Constants.CONTEXT_CLASSPATH, 
this.getClassPath(this.servletContext));
   
           this.forceLoad(conf.getInitParameter("load-class"));
   
           File workDir = null;
           String workDirParam = conf.getInitParameter("work-directory");
           if ((workDirParam != null) && (workDirParam.trim().equals("") == 
false)) {
  -            workDir = IOUtils.createFile( new File(context.getRealPath("/")) 
, workDirParam);
  +            workDir = IOUtils.createFile( new 
File(this.servletContext.getRealPath("/")) , workDirParam);
               workDir.mkdirs();
           } else {
  -            workDir = (File) 
context.getAttribute("javax.servlet.context.tempdir");
  +            workDir = (File) 
this.servletContext.getAttribute("javax.servlet.context.tempdir");
           }
   
           this.appContext.put(Constants.CONTEXT_WORK_DIR, workDir);
   
           String uploadDirParam = conf.getInitParameter("upload-directory");
           if ((uploadDirParam != null) && (uploadDirParam.trim().equals("") == 
false)) {
  -            this.uploadDir = IOUtils.createFile( new 
File(context.getRealPath("/")) , uploadDirParam);
  +            this.uploadDir = IOUtils.createFile( new 
File(this.servletContext.getRealPath("/")) , uploadDirParam);
           } else       {
               this.uploadDir = IOUtils.createFile(workDir, "image-dir" + 
File.separator);
           }
  @@ -137,9 +140,9 @@
           this.uploadDir.mkdirs();
   
           this.appContext.put(Constants.CONTEXT_CONFIG_URL,
  -                this.getConfigFile(conf.getInitParameter("configurations"), 
context));
  +                this.getConfigFile(conf.getInitParameter("configurations"), 
this.servletContext));
   
  -        this.appContext.put(Constants.CONTEXT_ROOT_PATH, 
context.getRealPath("/"));
  +        this.appContext.put(Constants.CONTEXT_ROOT_PATH, 
this.servletContext.getRealPath("/"));
   
           // get allow reload parameter, default is true
           String value = conf.getInitParameter("allow-reload");
  @@ -499,7 +502,8 @@
           env = new HttpEnvironment(uri,
                                     req,
                                     res,
  -                                  (ServletContext) 
this.appContext.get(Constants.CONTEXT_SERVLET_CONTEXT));
  +                                  this.servletContext,
  +                                  
(HttpContext)this.appContext.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT));
           env.setLogger(this.log);
           return env;
       }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to