You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2006/12/03 18:13:35 UTC

svn commit: r481819 - in /webservices/axis2/trunk/c: include/axis2_http_transport.h modules/core/transport/http/sender/rest_sender.c modules/core/transport/http/sender/soap_over_http_sender.c

Author: dinesh
Date: Sun Dec  3 09:13:34 2006
New Revision: 481819

URL: http://svn.apache.org/viewvc?view=rev&rev=481819
Log:
user can specify content-type of the message using hash map

Modified:
    webservices/axis2/trunk/c/include/axis2_http_transport.h
    webservices/axis2/trunk/c/modules/core/transport/http/sender/rest_sender.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c

Modified: webservices/axis2/trunk/c/include/axis2_http_transport.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_http_transport.h?view=diff&rev=481819&r1=481818&r2=481819
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_transport.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_transport.h Sun Dec  3 09:13:34 2006
@@ -133,6 +133,12 @@
 #define AXIS2_HTTP_HEADER_CONTENT_TYPE "Content-Type"
 
 /**
+ *USER DEFINED HEADER CONTENT TYPE
+ */
+
+#define AXIS2_USER_DEFINED_HTTP_HEADER_CONTENT_TYPE "User_Content_Type"
+
+/**
  * HEADER_CONTENT_TYPE
  */
 #define AXIS2_HTTP_HEADER_CONTENT_TYPE_MIME_BOUNDARY "boundary"

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/rest_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/sender/rest_sender.c?view=diff&rev=481819&r1=481818&r2=481819
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/rest_sender.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/rest_sender.c Sun Dec  3 09:13:34 2006
@@ -209,6 +209,9 @@
     axis2_bool_t send_via_get = AXIS2_FALSE;
     axis2_property_t *method = NULL;
 	axis2_char_t *method_value = NULL;
+	axis2_hash_t *content_type_hash;
+	char *content_type_value = NULL;
+	axis2_property_t *content_type_property;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
@@ -327,8 +330,25 @@
                     AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED);
             AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);
         }
-        /* TODO we need to set the content type with soap action header for soap12*/
-        content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML;
+        /* TODO we eed to set the content type with soap action header
+		 * for soap12*/
+		content_type_property  = (axis2_property_t *)AXIS2_MSG_CTX_GET_PROPERTY(
+			msg_ctx, env,
+			AXIS2_USER_DEFINED_HTTP_HEADER_CONTENT_TYPE, 
+			AXIS2_FALSE);
+
+		if (content_type_property)
+		{
+			content_type_hash = (axis2_hash_t *) AXIS2_PROPERTY_GET_VALUE (content_type_property, env);
+			if (content_type_hash)
+				content_type_value = (char *) axis2_hash_get (content_type_hash, AXIS2_HTTP_HEADER_CONTENT_TYPE, AXIS2_HASH_KEY_STRING);
+		}
+
+		if (content_type_value)
+			content_type = content_type_value;
+		else
+			content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML;
+
         http_header = axis2_http_header_create(env,
                 AXIS2_HTTP_HEADER_CONTENT_TYPE, content_type);
         AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c?view=diff&rev=481819&r1=481818&r2=481819
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c Sun Dec  3 09:13:34 2006
@@ -406,6 +406,7 @@
     }
 
     AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);
+
     if (0 == AXIS2_STRCMP(sender_impl->http_version,
             AXIS2_HTTP_HEADER_PROTOCOL_11))
     {



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