axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asan...@apache.org
Subject svn commit: r673651 - in /webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http: CommonsHTTPTransportSender.java ServletBasedOutTransportInfo.java
Date Thu, 03 Jul 2008 11:28:34 GMT
Author: asankha
Date: Thu Jul  3 04:28:33 2008
New Revision: 673651

URL: http://svn.apache.org/viewvc?rev=673651&view=rev
Log:
fix AXIS2-3887 by setting the HTTP status code to 500 if returning a fault

Modified:
    webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
    webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java

Modified: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=673651&r1=673650&r2=673651&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
(original)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
Thu Jul  3 04:28:33 2008
@@ -41,6 +41,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import javax.xml.stream.FactoryConfigurationError;
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
@@ -253,6 +254,12 @@
         if (transportInfo instanceof ServletBasedOutTransportInfo) {
             servletBasedOutTransportInfo =
                     (ServletBasedOutTransportInfo) transportInfo;
+
+            // if sending a fault, set HTTP status code to 500
+            if (msgContext.isFault()) {
+                servletBasedOutTransportInfo.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+            }
+
             Object customHeaders = msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
             if (customHeaders != null) {
                 if (customHeaders instanceof List) {

Modified: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java?rev=673651&r1=673650&r2=673651&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java
(original)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java
Thu Jul  3 04:28:33 2008
@@ -38,4 +38,8 @@
     public void addHeader(String headerName, String headerValue) {
         response.addHeader(headerName, headerValue);
     }
+
+    public void setStatus(int status) {
+        response.setStatus(status);
+    }
 }



Mime
View raw message