You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Berin Loritsch <bl...@apache.org> on 2001/10/23 17:05:04 UTC

Re: cvs commit: xml-cocoon2/src/org/apache/cocoon/servlet CocoonServlet.java

cziegeler@apache.org wrote:
> 
> cziegeler    01/10/23 04:40:24
> 
>   Modified:    src/org/apache/cocoon Main.java
>                src/org/apache/cocoon/serialization SVGSerializer.java
>                src/org/apache/cocoon/servlet CocoonServlet.java
>   Removed:     src/META-INF/services
>                         org.apache.batik.util.ParsedURLProtocolHandler


WHY!?!

This code was working, and it provides a predictable environment for
people using Batik.  Why are you removing it?  What are you doing to
ensure that the functionality is there, if the code isn't?

Please enlighten me, because this repeal from HEAD seems ludicrous.
Help me understand, because I _really_ don't like this.  I *want*
to be able to use the same URL whether I am running in a servlet
environment or not.  I NEED this ability for the functionality that
my side business is building off of.  Please do NOT remove the
functionality.

>   Log:
>   Cleaned up code for batik protocols
> 
>   Revision  Changes    Path
>   1.27      +1 -3      xml-cocoon2/src/org/apache/cocoon/Main.java
> 
>   Index: Main.java
>   ===================================================================
>   RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Main.java,v
>   retrieving revision 1.26
>   retrieving revision 1.27
>   diff -u -r1.26 -r1.27
>   --- Main.java 2001/10/22 09:09:55     1.26
>   +++ Main.java 2001/10/23 11:40:24     1.27
>   @@ -24,7 +24,6 @@
>    import org.apache.cocoon.util.IOUtils;
>    import org.apache.cocoon.util.MIMEUtils;
>    import org.apache.cocoon.util.NetUtils;
>   -import org.apache.cocoon.components.url.ParsedContextURLProtocolHandler;
>    import org.apache.log.Hierarchy;
>    import org.apache.log.Logger;
>    import org.apache.log.Priority;
>   @@ -36,7 +35,7 @@
>     * Command line entry point.
>     *
>     * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
>   - * @version CVS $Revision: 1.26 $ $Date: 2001/10/22 09:09:55 $
>   + * @version CVS $Revision: 1.27 $ $Date: 2001/10/23 11:40:24 $
>     */
> 
>    public class Main {
>   @@ -262,7 +261,6 @@
>                CommandlineContext clContext = new CommandlineContext(contextDir);
>                clContext.setLogger(log);
>                appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, clContext);
>   -            ParsedContextURLProtocolHandler.setContext(clContext);
>                DefaultLogKitManager logKitManager = null;
>                if(logKit != null) {
>                    final FileInputStream fis = new FileInputStream(logKit);
> 
> 
> 
>   1.7       +12 -4     xml-cocoon2/src/org/apache/cocoon/serialization/SVGSerializer.java
> 
>   Index: SVGSerializer.java
>   ===================================================================
>   RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/serialization/SVGSerializer.java,v
>   retrieving revision 1.6
>   retrieving revision 1.7
>   diff -u -r1.6 -r1.7
>   --- SVGSerializer.java        2001/10/23 11:10:02     1.6
>   +++ SVGSerializer.java        2001/10/23 11:40:24     1.7
>   @@ -14,11 +14,15 @@
>    import org.apache.avalon.framework.configuration.Configurable;
>    import org.apache.avalon.framework.configuration.Configuration;
>    import org.apache.avalon.framework.configuration.ConfigurationException;
>   +import org.apache.avalon.framework.context.Context;
>   +import org.apache.avalon.framework.context.ContextException;
>   +import org.apache.avalon.framework.context.Contextualizable;
>    import org.apache.batik.transcoder.Transcoder;
>    import org.apache.batik.transcoder.TranscoderInput;
>    import org.apache.batik.transcoder.TranscoderOutput;
>    import org.apache.batik.transcoder.TranscodingHints;
>    import org.apache.batik.util.ParsedURL;
>   +import org.apache.cocoon.Constants;
>    import org.apache.cocoon.caching.CacheValidity;
>    import org.apache.cocoon.caching.Cacheable;
>    import org.apache.cocoon.caching.NOPCacheValidity;
>   @@ -44,13 +48,17 @@
>     *
>     * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
>     * @author <a href="mailto:rossb@apache.org">Ross Burton</a>
>   - * @version CVS $Revision: 1.6 $ $Date: 2001/10/23 11:10:02 $
>   + * @version CVS $Revision: 1.7 $ $Date: 2001/10/23 11:40:24 $
>     */
>    public class SVGSerializer extends SVGBuilder
>   -implements Composable, Serializer, Configurable, Poolable, Cacheable {
>   +implements Composable, Serializer, Configurable, Poolable, Cacheable, Contextualizable {
> 
>   -    // add cocoon specific protocols
>   -    static {
>   +    /**
>   +     * Get the context
>   +     */
>   +    public void contextualize(Context context) throws ContextException {
>   +        ParsedContextURLProtocolHandler.setContext(
>   +            (org.apache.cocoon.environment.Context)context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT));
>            ParsedURL.registerHandler(new ParsedContextURLProtocolHandler());
>            ParsedURL.registerHandler(new ParsedResourceURLProtocolHandler());
>        }
> 
> 
> 
>   1.45      +2 -6      xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
> 
>   Index: CocoonServlet.java
>   ===================================================================
>   RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
>   retrieving revision 1.44
>   retrieving revision 1.45
>   diff -u -r1.44 -r1.45
>   --- CocoonServlet.java        2001/10/11 14:34:44     1.44
>   +++ CocoonServlet.java        2001/10/23 11:40:24     1.45
>   @@ -17,7 +17,6 @@
>    import org.apache.avalon.framework.logger.Loggable;
>    import org.apache.cocoon.*;
>    import org.apache.cocoon.components.classloader.RepositoryClassLoader;
>   -import org.apache.cocoon.components.url.ParsedContextURLProtocolHandler;
>    import org.apache.cocoon.environment.Environment;
>    import org.apache.cocoon.environment.http.HttpContext;
>    import org.apache.cocoon.environment.http.HttpEnvironment;
>   @@ -59,7 +58,7 @@
>     * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
>     * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
>     * @author <a href="mailto:leo.sutic@inspireinfrastructure.com">Leo Sutic</a>
>   - * @version CVS $Revision: 1.44 $ $Date: 2001/10/11 14:34:44 $
>   + * @version CVS $Revision: 1.45 $ $Date: 2001/10/23 11:40:24 $
>     */
> 
>    public class CocoonServlet extends HttpServlet {
>   @@ -124,10 +123,7 @@
>            String value;
> 
>            this.servletContext = conf.getServletContext();
>   -        HttpContext envContext = new HttpContext(this.servletContext);
>   -        this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, envContext);
>   -        ParsedContextURLProtocolHandler.setContext(envContext);
>   -
>   +        this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, new HttpContext(this.servletContext);
>            this.initLogger();
> 
>            this.forceLoadParameter = conf.getInitParameter("load-class");
> 
> 
> 
> 
> ----------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-cvs-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: cvs commit: xml-cocoon2/src/org/apache/cocoon/servlet CocoonServlet.java

Posted by Berin Loritsch <bl...@apache.org>.
Carsten Ziegeler wrote:
> 
> Hi Berin,
> 
> just relax. Everything is still working as it was before, you
> can use the cocoon: and the resource: url inside svg/batik!
> Why?
> When using services everything was working fine using the cli,
> but using cocoon as a servlet (e.g. inside Tomcat) this
> was not working, as the services file was never found.
> So instead of using the services, the protocols are now added
> to batik by the SVGSerializer. And this works in all cases.
> This also makes everything more maintanable, as you don't
> need any initialization for the protocol handlers in either
> Main or CocoonServlet. Everything for Batik is done
> in the SVGSerializer.
> 
> So, really, no case to worry about. Just test it, and you
> will see all the beautiful documentation as it was before.

I tested it with Tomcat 3.3 on my machine--but since you came
up with a better solution, thank you.

BTW, it isn't just documentation, it's a site that lets you
preview a theme (on that site) before you buy it.

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: cvs commit: xml-cocoon2/src/org/apache/cocoon/servlet CocoonServlet.java

Posted by Carsten Ziegeler <cz...@sundn.de>.
Hi Berin,

just relax. Everything is still working as it was before, you
can use the cocoon: and the resource: url inside svg/batik!
Why?
When using services everything was working fine using the cli,
but using cocoon as a servlet (e.g. inside Tomcat) this
was not working, as the services file was never found.
So instead of using the services, the protocols are now added
to batik by the SVGSerializer. And this works in all cases.
This also makes everything more maintanable, as you don't
need any initialization for the protocol handlers in either
Main or CocoonServlet. Everything for Batik is done
in the SVGSerializer.

So, really, no case to worry about. Just test it, and you
will see all the beautiful documentation as it was before.

Carsten

Berin Loritsch wrote:
>
> cziegeler@apache.org wrote:
> >
> > cziegeler    01/10/23 04:40:24
> >
> >   Modified:    src/org/apache/cocoon Main.java
> >                src/org/apache/cocoon/serialization SVGSerializer.java
> >                src/org/apache/cocoon/servlet CocoonServlet.java
> >   Removed:     src/META-INF/services
> >                         org.apache.batik.util.ParsedURLProtocolHandler
>
>
> WHY!?!
>
> This code was working, and it provides a predictable environment for
> people using Batik.  Why are you removing it?  What are you doing to
> ensure that the functionality is there, if the code isn't?
>
> Please enlighten me, because this repeal from HEAD seems ludicrous.
> Help me understand, because I _really_ don't like this.  I *want*
> to be able to use the same URL whether I am running in a servlet
> environment or not.  I NEED this ability for the functionality that
> my side business is building off of.  Please do NOT remove the
> functionality.
>
> >   Log:
> >   Cleaned up code for batik protocols
> >
> >   Revision  Changes    Path
> >   1.27      +1 -3      xml-cocoon2/src/org/apache/cocoon/Main.java
> >
> >   Index: Main.java
> >   ===================================================================
> >   RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Main.java,v
> >   retrieving revision 1.26
> >   retrieving revision 1.27
> >   diff -u -r1.26 -r1.27
> >   --- Main.java 2001/10/22 09:09:55     1.26
> >   +++ Main.java 2001/10/23 11:40:24     1.27
> >   @@ -24,7 +24,6 @@
> >    import org.apache.cocoon.util.IOUtils;
> >    import org.apache.cocoon.util.MIMEUtils;
> >    import org.apache.cocoon.util.NetUtils;
> >   -import
> org.apache.cocoon.components.url.ParsedContextURLProtocolHandler;
> >    import org.apache.log.Hierarchy;
> >    import org.apache.log.Logger;
> >    import org.apache.log.Priority;
> >   @@ -36,7 +35,7 @@
> >     * Command line entry point.
> >     *
> >     * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
> >   - * @version CVS $Revision: 1.26 $ $Date: 2001/10/22 09:09:55 $
> >   + * @version CVS $Revision: 1.27 $ $Date: 2001/10/23 11:40:24 $
> >     */
> >
> >    public class Main {
> >   @@ -262,7 +261,6 @@
> >                CommandlineContext clContext = new
> CommandlineContext(contextDir);
> >                clContext.setLogger(log);
> >
> appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, clContext);
> >   -            ParsedContextURLProtocolHandler.setContext(clContext);
> >                DefaultLogKitManager logKitManager = null;
> >                if(logKit != null) {
> >                    final FileInputStream fis = new
> FileInputStream(logKit);
> >
> >
> >
> >   1.7       +12 -4
> xml-cocoon2/src/org/apache/cocoon/serialization/SVGSerializer.java
> >
> >   Index: SVGSerializer.java
> >   ===================================================================
> >   RCS file:
> /home/cvs/xml-cocoon2/src/org/apache/cocoon/serialization/SVGSeria
> lizer.java,v
> >   retrieving revision 1.6
> >   retrieving revision 1.7
> >   diff -u -r1.6 -r1.7
> >   --- SVGSerializer.java        2001/10/23 11:10:02     1.6
> >   +++ SVGSerializer.java        2001/10/23 11:40:24     1.7
> >   @@ -14,11 +14,15 @@
> >    import org.apache.avalon.framework.configuration.Configurable;
> >    import org.apache.avalon.framework.configuration.Configuration;
> >    import
> org.apache.avalon.framework.configuration.ConfigurationException;
> >   +import org.apache.avalon.framework.context.Context;
> >   +import org.apache.avalon.framework.context.ContextException;
> >   +import org.apache.avalon.framework.context.Contextualizable;
> >    import org.apache.batik.transcoder.Transcoder;
> >    import org.apache.batik.transcoder.TranscoderInput;
> >    import org.apache.batik.transcoder.TranscoderOutput;
> >    import org.apache.batik.transcoder.TranscodingHints;
> >    import org.apache.batik.util.ParsedURL;
> >   +import org.apache.cocoon.Constants;
> >    import org.apache.cocoon.caching.CacheValidity;
> >    import org.apache.cocoon.caching.Cacheable;
> >    import org.apache.cocoon.caching.NOPCacheValidity;
> >   @@ -44,13 +48,17 @@
> >     *
> >     * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
> >     * @author <a href="mailto:rossb@apache.org">Ross Burton</a>
> >   - * @version CVS $Revision: 1.6 $ $Date: 2001/10/23 11:10:02 $
> >   + * @version CVS $Revision: 1.7 $ $Date: 2001/10/23 11:40:24 $
> >     */
> >    public class SVGSerializer extends SVGBuilder
> >   -implements Composable, Serializer, Configurable, Poolable,
> Cacheable {
> >   +implements Composable, Serializer, Configurable, Poolable,
> Cacheable, Contextualizable {
> >
> >   -    // add cocoon specific protocols
> >   -    static {
> >   +    /**
> >   +     * Get the context
> >   +     */
> >   +    public void contextualize(Context context) throws
> ContextException {
> >   +        ParsedContextURLProtocolHandler.setContext(
> >   +
> (org.apache.cocoon.environment.Context)context.get(Constants.CONTE
XT_ENVIRONMENT_CONTEXT));
> >            ParsedURL.registerHandler(new
> ParsedContextURLProtocolHandler());
> >            ParsedURL.registerHandler(new
> ParsedResourceURLProtocolHandler());
> >        }
> >
> >
> >
> >   1.45      +2 -6
> xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
> >
> >   Index: CocoonServlet.java
> >   ===================================================================
> >   RCS file:
> /home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
> >   retrieving revision 1.44
> >   retrieving revision 1.45
> >   diff -u -r1.44 -r1.45
> >   --- CocoonServlet.java        2001/10/11 14:34:44     1.44
> >   +++ CocoonServlet.java        2001/10/23 11:40:24     1.45
> >   @@ -17,7 +17,6 @@
> >    import org.apache.avalon.framework.logger.Loggable;
> >    import org.apache.cocoon.*;
> >    import
> org.apache.cocoon.components.classloader.RepositoryClassLoader;
> >   -import
> org.apache.cocoon.components.url.ParsedContextURLProtocolHandler;
> >    import org.apache.cocoon.environment.Environment;
> >    import org.apache.cocoon.environment.http.HttpContext;
> >    import org.apache.cocoon.environment.http.HttpEnvironment;
> >   @@ -59,7 +58,7 @@
> >     * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
> >     * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
> >     * @author <a
> href="mailto:leo.sutic@inspireinfrastructure.com">Leo Sutic</a>
> >   - * @version CVS $Revision: 1.44 $ $Date: 2001/10/11 14:34:44 $
> >   + * @version CVS $Revision: 1.45 $ $Date: 2001/10/23 11:40:24 $
> >     */
> >
> >    public class CocoonServlet extends HttpServlet {
> >   @@ -124,10 +123,7 @@
> >            String value;
> >
> >            this.servletContext = conf.getServletContext();
> >   -        HttpContext envContext = new
> HttpContext(this.servletContext);
> >   -
> this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, envContext);
> >   -        ParsedContextURLProtocolHandler.setContext(envContext);
> >   -
> >   +
> this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, new
> HttpContext(this.servletContext);
> >            this.initLogger();
> >
> >            this.forceLoadParameter =
> conf.getInitParameter("load-class");
> >
> >
> >
> >
> > ----------------------------------------------------------------------
> > In case of troubles, e-mail:     webmaster@xml.apache.org
> > To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-cvs-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org