You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/03/13 11:55:45 UTC

DO NOT REPLY [Bug 17950] - Defect of the jax-rpc handler impl on the processing model

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17950>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17950

Defect of the jax-rpc handler impl on the processing model





------- Additional Comments From kimuratsy@nttdata.co.jp  2003-03-13 10:55 -------
  I'd like to propose the following approach to solve
this problem.  Could you please refer to the ml archive
if you want to know the detail of the background ?

***** The additional rule of the flow definition *****
.........*.........*.........*.........*.........*.........*
 a)Adds a special parameter for "*.wsdd" to setting up
   a user specific response flow in case of 'return false'.
 b)The name of the parameter is "onFalseRestartAt".
 c)It can optionally appear under the '<handlerInfoChain>'
   as the child node of the "<handlerInfo>".
   (If not set, the default rule will be applied.  In other
    words, the respose handler chain starts processing from
    the same Handler instance that returned false.)
 d)The appropriate value is an integer (-1, 0, 1, 2, ...)
   to indicate the starting point index of response flow.
   (Exceptionally, the '-1' indicates the runtime doesn't
   invoke any handleResponse methods and directly sends back
   the response message from handleRequest to the client.)
.........*.........*.........*.........*.........*.........*


***** A sample definition of deploy.wsdd *****
(--- How to use "onFalseRestartAt" parameter. ---)
.........*.........*.........*.........*.........*.........*
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
  xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

 <service name="testWebService" provider="java:RPC">
  <parameter name="className" value="webservices.testWebService"/>
  <parameter name="allowedMethods" value="*"/>

  <handlerInfoChain>
   <handlerInfo classname="samples.jaxrpc.hello.ServerHandlerA">
    <parameter name="onFalseRestartAt" value="0"/>
   </handlerInfo>

   <handlerInfo classname="samples.jaxrpc.hello.ServerHandlerB">
    <parameter name="onFalseRestartAt" value="-1"/>
   </handlerInfo>
 </handlerInfoChain>

 </service>
</deployment>
.........*.........*.........*.........*.........*.........*


*****  Tha patch for HandlerChainImpl.java *****
.........*.........*.........*.........*.........*.........*
--- xml-axis/java/src/org/apache/axis/handlers/HandlerChainImpl.java
                        	Wed Dec 11 22:38:18 2002 UTC 
+++ HandlerChainImpl.java	Thu Mar 13 19:23:44 2003 JST
@@ -118,15 +118,18 @@
         return true;
     }
 
+    private int falseIndex;
+
     public boolean handleRequest(MessageContext _context) {
         SOAPMessageContext context = (SOAPMessageContext) _context;
 
-        boolean processFault = false;
+        falseIndex = -1;
 
         for (int i = 0; i < size(); i++) {
             Handler currentHandler = getHandlerInstance(i);
             try {
                 if (currentHandler.handleRequest(context) == false) {
+                    falseIndex = i;
                     return false;
                 }
             } catch (SOAPFaultException sfe) {
@@ -137,7 +140,20 @@
     }
 
     public boolean handleResponse(MessageContext context) {
-        for (int i = size() - 1; i >= 0; i--)
+        int endIdx = this.handlerInfos.size() - 1;
+        
+        if (falseIndex != -1) {
+            HandlerInfo info = (HandlerInfo)this.handlerInfos.get(falseIndex);
+            String st = (String)info.getHandlerConfig().get
("onFalseRestartAt");
+            
+            if (st != null) {
+                endIdx = Integer.parseInt(st);
+            } else {
+                endIdx = falseIndex;
+            }
+        }
+        
+        for (int i = endIdx; i >= 0; i--)
             if (getHandlerInstance(i).handleResponse(context) == false)
                 return false;
         return true;
.........*.........*.........*.........*.........*.........*

Best Regards,

  Toshi (Toshiyuki Kimura) <ki...@nttdata.co.jp>
  R&D Headquarters
  NTT DATA Corporation