Author: veithen
Date: Tue Dec 23 13:51:17 2008
New Revision: 729135

URL: http://svn.apache.org/viewvc?rev=729135&view=rev
Log:
SYNAPSE-494: Take into account the return value of RESTUtil#processURLRequest 
in ServerWorker and properly terminate the request if RESTUtil can't decode it.

Modified:
    
synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/nhttp/ServerWorker.java

Modified: 
synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/nhttp/ServerWorker.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/nhttp/ServerWorker.java?rev=729135&r1=729134&r2=729135&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/nhttp/ServerWorker.java
 (original)
+++ 
synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/nhttp/ServerWorker.java
 Tue Dec 23 13:51:17 2008
@@ -483,13 +483,19 @@
 
         } else {
             try {
-                RESTUtil.processURLRequest(
+                if (RESTUtil.processURLRequest(
                         msgContext, os, (request.getFirstHeader(SOAPACTION) != 
null ?
                         request.getFirstHeader(SOAPACTION).getValue() : null),
-                        request.getRequestLine().getUri(), cfgCtx, parameters);
-                // do not let the output stream close (as by default below) 
since
-                // we are serving this GET request through the Synapse engine
-                return;
+                        request.getRequestLine().getUri(), cfgCtx, 
parameters)) {
+                    // If RestUtil succesfully decoded the request, do not let 
the output
+                    // stream close (as by default below) since we are serving 
this GET request
+                    // through the Synapse engine
+                    return;
+                } else {
+                    response.setStatusCode(HttpStatus.SC_MOVED_PERMANENTLY);
+                    response.addHeader(LOCATION, servicePath + "/");
+                    serverHandler.commitResponseHideExceptions(conn, response);
+                }
                     
             } catch (AxisFault axisFault) {
                 handleException("Error processing GET request for: " +


Reply via email to