axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r499573 - /webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java
Date Wed, 24 Jan 2007 21:25:47 GMT
Author: nadiramra
Date: Wed Jan 24 13:25:47 2007
New Revision: 499573

URL: http://svn.apache.org/viewvc?view=rev&rev=499573
Log:
Add new feature in mock-server to handle ### in content-length resonse for non-chunked data.

Modified:
    webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java

Modified: webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java?view=diff&rev=499573&r1=499572&r2=499573
==============================================================================
--- webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java (original)
+++ webservices/axis/trunk/c/tests/utils/monitor/org/apache/test/Response.java Wed Jan 24
13:25:47 2007
@@ -149,32 +149,6 @@
                 message=modifiedResponse.toCharArray();
             }
         }
-//
-//        // Irrespective of platform ensure that all responses end with \r\n\r\n
-//        String request=new String(getMessage( ));
-//        // this pattern looks for any chars then any non whitespace followed
-//        // directly by the EOF
-//        Pattern pattern=Pattern.compile("(.*)(\\s)*$");
-//        Matcher matcher=pattern.matcher(request);
-//        StringBuffer stringBuffer=new StringBuffer("");
-//        // We should only find one occurence (if any) of the sequence
-//        if (matcher.find( ))
-//        {
-////            System.out.println("MATCHED");
-//            // and replace them with the proper sentence !
-//            matcher.appendReplacement(stringBuffer, "$1\r\n\r\n");
-//        }
-//        else
-//        {
-////            System.out.println("NOT MATCHED");
-//            // We did not find the sequence so just tack on the grouping we
-//            // need.
-//            stringBuffer.append(request);
-//            stringBuffer.append("\r\n\r\n");
-//
-//        }
-//        // Now put it back into the message
-//        message=stringBuffer.toString( ).toCharArray( );
     }
 
         /**
@@ -442,27 +416,13 @@
         if (chunked)
             return returnedResponse;
         else
-            return returnedResponse + response.substring(iIndex);
+        {
+            // Just in case HTTP header has ###, indication that 
+            // the Content-Length value needs to be set to the size
+            // of the body of the http response 
+            String returnedHttpBody = response.substring(iIndex);
+            returnedResponse.replaceFirst("###", new Integer(returnedHttpBody.length()).toString());
+            return returnedResponse + returnedHttpBody;
+        }
     }
-
-//    private static boolean isStringAHexNumber(String sValue)
-//    {
-//        boolean bOutcome=true;
-//        String sValidChars="0123456789ABCDEFabcdef";
-//        int iIndex=0;
-//
-//        while (bOutcome&&iIndex<sValue.length( ))
-//        {
-//            if (sValidChars.indexOf(sValue.substring(iIndex, iIndex+1))==-1)
-//            {
-//                bOutcome=false;
-//            }
-//            else
-//            {
-//                iIndex++;
-//            }
-//        }
-//
-//        return bOutcome;
-//    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message