You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Leo Sutic <le...@inspireinfrastructure.com> on 2002/07/04 17:05:39 UTC

The Abomination that is RequestFactory

Since the RequestFactory class keeps an instance of the selected request
factory in a private static variable, different cocoon webapps in the
same classloader can not have different request factories.

I tried to fix this, but then I came across this line in
HttpServletRequest:

    public Object get(String name) {
        return RequestFactory.getRequestFactory(null).get(this.req,
name);
    }

And I haven't been able to figure out what to do from here. The
HttpServletRequest should have a reference to the factory used to create
the embedded req. Or something.

The ugly part is that the request factory isn't creating anything with a
get() method, instead relying on the factory's get() method to extract
the object.

Any pointers on how to proceed are welcome.

One idea is this:
  Extend HttpServletRequest with a class that has a get() method. 
   public class ObjectHttpServletRequest extends HttpServletRequest {
       public Object get(String name);
   }
  
  Have the request factory return instances of that type instead. 
    public abstract ObjectHttpServletRequest getServletRequest( ...
  
  Then rework the HttpServletRequest to call that get method.
     return this.req.get(name);

Any major problems with the above?

/LS


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