axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Russell Butek" <bu...@us.ibm.com>
Subject Re: Removing --messageContext from Wsdl2java (re: cvs commit: xml-axis/java/test/RPCDispatch Service.java TestRPC.java)
Date Wed, 05 Dec 2001 16:32:43 GMT
Thanks, Steve.  I was hoping to hear from you.

Russell Butek
butek@us.ibm.com


Steve Graham/Raleigh/IBM@IBMUS on 12/05/2001 08:02:39 AM

Please respond to axis-dev@xml.apache.org

To:   axis-dev@xml.apache.org
cc:
Subject:  Re: Removing --messageContext from Wsdl2java (re: cvs commit:
      xml-axis/java/test/RPCDispatch Service.java TestRPC.java)



Since I was the one that rabble roused to have access to the
messageContext, I suppose I should pipe up.
The solution Sam proposed sounds fine, so I support the removal.

sgg

++++++++
Steve Graham
sggraham@us.ibm.com
(919)254-0615 (T/L 444)
Emerging Technologies
++++++++


Russell Butek/Austin/IBM@IBMUS on 12/05/2001 08:47:43 AM

Please respond to axis-dev@xml.apache.org

To:   axis-dev@xml.apache.org
cc:
Subject:  Removing --messageContext from Wsdl2java (re:  cvs commit:
      xml-axis/java/test/RPCDispatch Service.java TestRPC.java)



With Sam's changes below, we no longer need the --messageContext option in
Wsdl2java.  Unless someone has some serious reservations, I plan to remove
it in the next couple days.

Russell Butek
butek@us.ibm.com
---------------------- Forwarded by Russell Butek/Austin/IBM on 12/05/2001
07:43 AM ---------------------------





rubys@apache.org on 12/04/2001 06:27:18 PM

Please respond to axis-dev@xml.apache.org

To:   xml-axis-cvs@apache.org
cc:

Subject:  cvs commit: xml-axis/java/test/RPCDispatch Service.java
      TestRPC.java




rubys       01/12/04 16:27:18

  Modified:    java/src/org/apache/axis AxisEngine.java MessageContext.java
               java/src/org/apache/axis/client AxisClient.java
               java/src/org/apache/axis/server AxisServer.java
               java/test/RPCDispatch Service.java TestRPC.java
  Log:
  Implement an alternate means by which the current active message context
  can be retrieved by a web service.  Previously this was accomplished with
  an optional first parameter - which is still supported for the moment
  (I'd deprecate it if I could see a way to do it).

  The active message context is defined as the one passed to last
  AxisEngine.invoke on the call stack.

  The active message context can be retrieved using either of the following
  static methods:
    AxisEngine.getCurrentMessageContext();
    MessageContext.getCurrentContext();

  Revision  Changes    Path
  1.59      +24 -0     xml-axis/java/src/org/apache/axis/AxisEngine.java

  Index: AxisEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- AxisEngine.java    2001/12/03 22:49:22  1.58
  +++ AxisEngine.java    2001/12/05 00:27:18  1.59
  @@ -119,6 +119,30 @@
       protected WSDDGlobalConfiguration myGlobalConfig = null;

       /**
  +     * Thread local storage used for locating the active message
context.
  +     * This information is only valid for the lifetime of this request.
  +     */
  +    private static ThreadLocal currentMessageContext = new ThreadLocal
();
  +
  +    /**
  +     * Set the active message context.
  +     *
  +     * @param mc - the new active message context.
  +     */
  +    protected static void setCurrentMessageContext(MessageContext mc) {
  +        currentMessageContext.set(mc);
  +    }
  +
  +    /**
  +     * Get the active message context.
  +     *
  +     * @return the current active message context
  +     */
  +    public static MessageContext getCurrentMessageContext() {
  +        return (MessageContext) currentMessageContext.get();
  +    }
  +
  +    /**
        * No-arg constructor.
        *
        */



  1.67      +8 -1
xml-axis/java/src/org/apache/axis/MessageContext.java

  Index: MessageContext.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- MessageContext.java     2001/11/27 04:08:59  1.66
  +++ MessageContext.java     2001/12/05 00:27:18  1.67
  @@ -156,10 +156,17 @@
        */
       private Hashtable bag ;

  +    /**
  +     * Get the active message context.
  +     * @return the current active message context
  +     */
  +    public static MessageContext getCurrentContext() {
  +       return AxisEngine.getCurrentMessageContext();
  +    }
  +
       public MessageContext(AxisEngine engine) {
           this.axisEngine = engine;
       }
  -

       /**
        * Mappings of QNames to serializers/deserializers (and therfore



  1.34      +12 -2
xml-axis/java/src/org/apache/axis/client/AxisClient.java

  Index: AxisClient.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/client/AxisClient.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- AxisClient.java    2001/12/03 22:49:23  1.33
  +++ AxisClient.java    2001/12/05 00:27:18  1.34
  @@ -110,7 +110,13 @@
           String  hName = null ;
           Handler h     = null ;

  +        // save previous context
  +        MessageContext previousContext = getCurrentMessageContext();
  +
           try {
  +            // set active context
  +            setCurrentMessageContext(msgContext);
  +
               hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER
);
               if (category.isDebugEnabled()) {
                   category.debug( "EngineHandler: " + hName );
  @@ -187,11 +193,15 @@
                   // Do SOAP Semantics checks here - this needs to be a
call to
                   // a pluggable object/handler/something
               }
  -        }
  -        catch( Exception e ) {
  +
  +        } catch( Exception e ) {
               // Should we even bother catching it ?
               category.error( e );
               throw AxisFault.makeFault(e);
  +
  +        } finally {
  +            // restore previous state
  +            setCurrentMessageContext(previousContext);
           }

           if (category.isDebugEnabled()) {



  1.50      +10 -0
xml-axis/java/src/org/apache/axis/server/AxisServer.java

  Index: AxisServer.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/server/AxisServer.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- AxisServer.java    2001/12/03 22:49:24  1.49
  +++ AxisServer.java    2001/12/05 00:27:18  1.50
  @@ -148,7 +148,13 @@
           String  hName = null ;
           Handler h     = null ;

  +        // save previous context
  +        MessageContext previousContext = getCurrentMessageContext();
  +
           try {
  +            // set active context
  +            setCurrentMessageContext(msgContext);
  +
               hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER
);
               if ( hName != null ) {
                   if ( (h = getHandler(hName)) == null ) {
  @@ -271,6 +277,10 @@
           } catch (Exception e) {
               // Should we even bother catching it ?
               throw AxisFault.makeFault(e);
  +
  +        } finally {
  +            // restore previous state
  +            setCurrentMessageContext(previousContext);
           }

           if (category.isDebugEnabled()) {



  1.9       +8 -1      xml-axis/java/test/RPCDispatch/Service.java

  Index: Service.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/Service.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Service.java  2001/11/28 12:04:12  1.8
  +++ Service.java  2001/12/05 00:27:18  1.9
  @@ -35,8 +35,15 @@
       /**
        * Return the target service (should be this!)
        */
  -    public String targetService(MessageContext mc) throws Exception {
  +    public String targetServiceExplicit(MessageContext mc) throws
Exception {
          return mc.getTargetService();
  +    }
  +
  +    /**
  +     * Return the target service (should be this!)
  +     */
  +    public String targetServiceImplicit() throws Exception {
  +       return MessageContext.getCurrentContext().getTargetService();
       }

       /**



  1.30      +19 -3     xml-axis/java/test/RPCDispatch/TestRPC.java

  Index: TestRPC.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestRPC.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- TestRPC.java  2001/12/03 22:49:24  1.29
  +++ TestRPC.java  2001/12/05 00:27:18  1.30
  @@ -137,15 +137,31 @@
       /**
        * Test a simple method that returns a field from the message
context
        */
  -    public void testMessageContext() throws Exception {
  +    public void testMessageContextImplicit() throws Exception {
           // Register the targetService service
           SOAPService tgtSvc = new SOAPService(RPCDispatcher);
           tgtSvc.setOption("className", "test.RPCDispatch.Service");
  -        tgtSvc.setOption("methodName", "targetService");
  +        tgtSvc.setOption("methodName", "targetServiceImplicit");
           engine.deployService(SOAPAction, tgtSvc);

           // invoke the service and verify the result
  -        assertEquals("SOAP Action did not equal the targetService.",
SOAPAction, rpc("targetService", new Object[] {}));
  +        assertEquals("SOAP Action did not equal the targetService.",
  +            SOAPAction, rpc("targetServiceImplicit", new Object[] {}));
  +    }
  +
  +    /**
  +     * Test a simple method that returns a field from the message
context
  +     */
  +    public void testMessageContextExplicit() throws Exception {
  +        // Register the targetService service
  +        SOAPService tgtSvc = new SOAPService(RPCDispatcher);
  +        tgtSvc.setOption("className", "test.RPCDispatch.Service");
  +        tgtSvc.setOption("methodName", "targetServiceExplicit");
  +        engine.deployService(SOAPAction, tgtSvc);
  +
  +        // invoke the service and verify the result
  +        assertEquals("SOAP Action did not equal the targetService.",
  +            SOAPAction, rpc("targetServiceExplicit", new Object[] {}));
       }

       /**






Mime
View raw message