You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Rich Johns <rj...@vignette.com> on 2000/08/14 15:12:27 UTC

1st pass: http provider gets context

I've taken a stab at the first pass implementation of handing
off context to service providers over http. My experiments
absolutely require it, so I'd like to get this on the table for
discussion.

The concept is that a service provider might require context information
that is normally available to a servlet. The changes I made try to honor
the concept of a loose coupling between the soap-layer and the provider
class. Here is a list of the changes I made, PLEASE  see the code for comments
rationale, and details. (I have attached the 2 files I changed: RPCRouterServlet.java
and RPCRouter.java). There are very few changes and I believe they are unobtrusive.

-------------------------------------change
list------------------------------------------------------

1. In RPCRouterServlet.java:

    - passing in the context to rpcRouter.invoke(...)

      // invoke the method on the target object. Pass into the rpcRouter a
      // context that can optionally be handed to the service provider.
      resp = rpcRouter.invoke (call, targetObject, makeHttpContext( req, context ) );

   - added a method called makeHttpContext which packages up the HttpServletRequest and
     the ServletContext in a HashMap.


2. In the RPCRouter.java:

    - only for provider types of  PROVIDER_JAVA I attempt to set the context on the
      provider instance:

     // before invoking call, offer context to target object
     setContext( targetObject, context );
     result = new Bean (m.getReturnType (), m.invoke (targetObject, args));

   - added a setContext method (please see code for comments and details)

--------------------------------------------end change
list------------------------------------------

Jean-Noel, I almost put these changes in your code, as I believe the refactoring you are doing
is going in the right direction, but I decided to wait until you get farther
down the road. Actually, if you agree with these changes perhaps you could pick them up, they are'nt

extensive at all. If nothing else, I hope this first pass attempt gets the issue of provider classes

and context on the table. I realize my approach is specific for Http, but I'm not sure what
context means for other transports.

Thanks