cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: Latest CocoonServlet and ParanoidServlet changes problem
Date Thu, 22 Feb 2001 14:45:50 GMT
Robert Marcano wrote:
> 
> Berin Loritsch wrote:
> 
> > Robert Marcano wrote:
> >
> >> The latest changes in this classes defines the method "getClassPath" as
> >> private, so the overriden in ParanoidServlet is never called
> >>
> >> See attached diff.txt
> >
> >
> > Thanks alot.  The patch is committed.
> 
> There is a problem using the RepositoryClassLoader, the overriden method
> getClasspath does not tell to ClassUtils about the new instance of
> RespositoryClassLoader
> 
> In order to no repeat the ClassUtil.setClassLoader method call, i
> created a somethng like a factory method called "buildInitClassLoader"
> in order to tell the servlet wich classLoader must intantiate if  required.


Done.

> 
> >
> 
>   ------------------------------------------------------------------------------------------------------------------------------------
> Index: ParanoidCocoonServlet.java
> ===================================================================
> RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/servlet/Attic/ParanoidCocoonServlet.java,v
> retrieving revision 1.1.2.4
> diff -u -r1.1.2.4 ParanoidCocoonServlet.java
> --- ParanoidCocoonServlet.java  2001/02/22 13:34:35     1.1.2.4
> +++ ParanoidCocoonServlet.java  2001/02/22 14:16:23
> @@ -38,6 +38,13 @@
>  public class ParanoidCocoonServlet extends CocoonServlet {
> 
>      /**
> +     * get the classloader to use for Cocoon instantiation
> +     */
> +     protected ClassLoader buildInitClassLoader() {
> +        return new RepositoryClassLoader(new URL[] {}, this.getClass().getClassLoader());
> +     }
> +
> +    /**
>       * This builds the important ClassPath used by this Servlet.  It
>       * does so in a Servlet Engine neutral way.  It uses the
>       * <code>ServletContext</code>'s <code>getRealPath</code>
method
> @@ -55,7 +62,7 @@
>       */
>       protected String getClassPath(final ServletContext context)
>       throws ServletException {
> -        RepositoryClassLoader classloader = new RepositoryClassLoader(new URL[] {},
(ClassLoader) this.appContext.get(Constants.CONTEXT_CLASS_LOADER));
> +        RepositoryClassLoader classloader = (RepositoryClassLoader)this.appContext.get(Constants.CONTEXT_CLASS_LOADER);
>          StringBuffer buildClassPath = new StringBuffer();
>          String classDirPath = getInitParameter("class-dir");
>          String libDirPath = getInitParameter("lib-dir");
> @@ -96,8 +103,6 @@
>                  }
>              }
>          }
> -
> -        this.appContext.put(Constants.CONTEXT_CLASS_LOADER, classloader);
> 
>          buildClassPath.append(File.pathSeparatorChar)
>                        .append(System.getProperty("java.class.path"));
> Index: CocoonServlet.java
> ===================================================================
> RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
> retrieving revision 1.1.4.65
> diff -u -r1.1.4.65 CocoonServlet.java
> --- CocoonServlet.java  2001/02/22 14:03:48     1.1.4.65
> +++ CocoonServlet.java  2001/02/22 14:16:24
> @@ -43,7 +43,6 @@
>  import org.apache.cocoon.util.ClassUtils;
>  import org.apache.cocoon.util.NetUtils;
>  import org.apache.cocoon.util.IOUtils;
> -import org.apache.cocoon.components.classloader.RepositoryClassLoader;
> 
>  import org.apache.log.Logger;
>  import org.apache.log.LogKit;
> @@ -98,7 +97,7 @@
>      throws ServletException {
> 
>          super.init(conf);
> -        ClassLoader classloader = this.getClass().getClassLoader();
> +       ClassLoader classloader = this.buildInitClassLoader();
>          ServletContext context = conf.getServletContext();
> 
>          ClassUtils.setClassLoader(classloader);
> @@ -124,6 +123,14 @@
> 
>          this.createCocoon();
>      }
> +
> +    /**
> +     * get the classloader to use for Cocoon instantiation
> +     */
> +     protected ClassLoader buildInitClassLoader() {
> +        return this.getClass().getClassLoader();
> +     }
> +
> 
>      /**
>       * This builds the important ClassPath used by this Servlet.  It
> 
>   ------------------------------------------------------------------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

Mime
View raw message