axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sami...@apache.org
Subject svn commit: r405456 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http: SOAPOverHTTPSender.java util/SOAPUtil.java
Date Tue, 09 May 2006 16:06:29 GMT
Author: saminda
Date: Tue May  9 09:06:27 2006
New Revision: 405456

URL: http://svn.apache.org/viewcvs?rev=405456&view=rev
Log:
hadling useragent header in server

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/util/SOAPUtil.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java?rev=405456&r1=405455&r2=405456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
Tue May  9 09:06:27 2006
@@ -132,7 +132,7 @@
     }
 
     private String getUserAgent(MessageContext messageContext) {
-        String userAgentString = "Axis/2.0";
+        String userAgentString = "Axis2";
         boolean locked = false;
         if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null){
             OMElement userAgentElement = messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement();

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/util/SOAPUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/util/SOAPUtil.java?rev=405456&r1=405455&r2=405456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/util/SOAPUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/util/SOAPUtil.java
Tue May  9 09:06:27 2006
@@ -20,6 +20,7 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.HTTPTransportUtils;
+import org.apache.axiom.om.OMElement;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -47,6 +48,7 @@
                                       HttpServletResponse response) throws AxisFault {
         try {
             response.setHeader("Content-Type","text/html");
+            response.addHeader(HTTPConstants.HEADER_USER_AGENT, getUserAgent(msgContext));
             String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
             HTTPTransportUtils.processHTTPPostRequest(msgContext,
                                                       request.getInputStream(),
@@ -61,6 +63,7 @@
             response.setContentType("text/xml; charset="
                                     + msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING));
 
+
             if ((contextWritten == null) || !Constants.VALUE_TRUE.equals(contextWritten))
{
                 response.setStatus(HttpServletResponse.SC_ACCEPTED);
             }
@@ -68,5 +71,17 @@
         } catch (IOException ioException) {
             throw new AxisFault(ioException);
         }
+    }
+
+    private String getUserAgent(MessageContext messageContext) {
+        String userAgentString = "Axis2";
+        if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null){
+            OMElement userAgentElement = messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement();
+            return userAgentElement.getText().trim();
+
+        }
+
+
+        return userAgentString;
     }
 }



Mime
View raw message