You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Nicola Ken Barozzi <ni...@apache.org> on 2002/12/19 11:44:42 UTC

Servlet Generator, what do we need it for?

In the block refactoring, I've come across Servlet Generator. Whatever 
the name tells you, it seems to have nothing to do with Servlets. 
Probably it's due to the includion of the environment abstraction.

Why not simply move these methods in ComposerGenerator and make classes 
using this use the ComposerGenerator directly?
It would eliminate the confusion and shorten the stacktrace.

Here is the class:

public abstract class ServletGenerator extends ComposerGenerator {

     protected Request request=null;
     protected Response response=null;
     protected Context context=null;

     public void setup(SourceResolver resolver, Map objectModel, String 
src, Parameters par)
         throws ProcessingException, SAXException, IOException {

       super.setup(resolver, objectModel, src, par);
       this.request = ObjectModelHelper.getRequest(objectModel);
       this.response = ObjectModelHelper.getResponse(objectModel);
       this.context = ObjectModelHelper.getContext(objectModel);
     }

     /**
      * Recycle the generator by removing references
      */
     public void recycle() {
         super.recycle();
         this.request = null;
         this.response = null;
         this.context = null;
     }
}


-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


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