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 se...@apache.org on 2008/03/20 11:30:25 UTC
svn commit: r639233 -
/webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c
Author: senaka
Date: Thu Mar 20 03:30:11 2008
New Revision: 639233
URL: http://svn.apache.org/viewvc?rev=639233&view=rev
Log:
Adding support for handling application/x-www-form-urlencoded
Modified:
webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c
Modified: webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c?rev=639233&r1=639232&r2=639233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c Thu Mar 20 03:30:11 2008
@@ -223,6 +223,7 @@
axis2_char_t *soap_body_str = NULL;
axutil_stream_t *stream = NULL;
axis2_bool_t do_rest = AXIS2_FALSE;
+ axis2_bool_t run_as_get = AXIS2_FALSE;
axis2_char_t *soap_action = NULL;
unsigned int soap_action_len = 0;
axutil_property_t *http_error_property = NULL;
@@ -352,7 +353,7 @@
max_chunk_buffers_param = axis2_msg_ctx_get_parameter (msg_ctx,
env,
AXIS2_MTOM_MAX_CHUNK_BUFFERS);
- if(max_chunk_buffers_param)
+ if (max_chunk_buffers_param)
{
value_num =
(axis2_char_t *) axutil_param_get_value (max_chunk_buffers_param, env);
@@ -369,7 +370,7 @@
axis2_http_transport_utils_on_data_request,
(void *) callback_ctx,
mime_boundary);
- if(!binary_data_map)
+ if (!binary_data_map)
{
return AXIS2_FAILURE;
}
@@ -501,6 +502,7 @@
{
/* REST support */
do_rest = AXIS2_TRUE;
+ run_as_get = AXIS2_TRUE;
}
else
{
@@ -523,12 +525,15 @@
axiom_soap_body_t *def_body = NULL;
axiom_document_t *om_doc = NULL;
axiom_node_t *root_node = NULL;
- soap_envelope = axiom_soap_envelope_create_default_soap_envelope
- (env, AXIOM_SOAP11);
- def_body = axiom_soap_envelope_get_body(soap_envelope, env);
- om_doc = axiom_stax_builder_get_document(om_builder, env);
- root_node = axiom_document_build_all(om_doc, env);
- axiom_soap_body_add_child(def_body, env, root_node);
+ if (!run_as_get)
+ {
+ soap_envelope = axiom_soap_envelope_create_default_soap_envelope
+ (env, AXIOM_SOAP11);
+ def_body = axiom_soap_envelope_get_body(soap_envelope, env);
+ om_doc = axiom_stax_builder_get_document(om_builder, env);
+ root_node = axiom_document_build_all(om_doc, env);
+ axiom_soap_body_add_child(def_body, env, root_node);
+ }
axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_TRUE);
axis2_msg_ctx_set_rest_http_method(msg_ctx, env, AXIS2_HTTP_POST);
}
@@ -543,6 +548,31 @@
}
}
+ if (run_as_get)
+ {
+ axis2_char_t *buffer = NULL;
+ axis2_char_t *new_url = NULL;
+ buffer = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (content_length + 1));
+ if (!buffer)
+ {
+ return AXIS2_FAILURE;
+ }
+ axis2_http_transport_utils_on_data_request(buffer, content_length, (void *) callback_ctx);
+
+ new_url = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
+ ((int)(strlen(request_uri) + strlen(buffer)) + 2));
+ if (!new_url)
+ {
+ return AXIS2_FAILURE;
+ }
+ sprintf(new_url, "%s?%s", request_uri, buffer);
+ AXIS2_FREE(env->allocator, buffer);
+
+ soap_envelope =
+ axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
+ axis2_http_transport_utils_get_request_params(env, new_url), AXIS2_HTTP_POST);
+ }
+
if (binary_data_map)
{
axiom_soap_builder_set_mime_body_parts(soap_builder, env,
@@ -656,6 +686,7 @@
axis2_char_t *soap_body_str = NULL;
axutil_stream_t *stream = NULL;
axis2_bool_t do_rest = AXIS2_FALSE;
+ axis2_bool_t run_as_get = AXIS2_FALSE;
axutil_property_t *http_error_property = NULL;
AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
@@ -761,7 +792,7 @@
max_chunk_buffers_param = axis2_msg_ctx_get_parameter (msg_ctx,
env,
AXIS2_MTOM_MAX_CHUNK_BUFFERS);
- if(max_chunk_buffers_param)
+ if (max_chunk_buffers_param)
{
value_num =
(axis2_char_t *) axutil_param_get_value (max_chunk_buffers_param, env);
@@ -778,7 +809,7 @@
axis2_http_transport_utils_on_data_request,
(void *) callback_ctx,
mime_boundary);
- if(!binary_data_map)
+ if (!binary_data_map)
{
return AXIS2_FAILURE;
}
@@ -878,6 +909,7 @@
{
/* REST support */
do_rest = AXIS2_TRUE;
+ run_as_get = AXIS2_TRUE;
}
else
{
@@ -900,12 +932,15 @@
axiom_soap_body_t *def_body = NULL;
axiom_document_t *om_doc = NULL;
axiom_node_t *root_node = NULL;
- soap_envelope = axiom_soap_envelope_create_default_soap_envelope
- (env, AXIOM_SOAP11);
- def_body = axiom_soap_envelope_get_body(soap_envelope, env);
- om_doc = axiom_stax_builder_get_document(om_builder, env);
- root_node = axiom_document_build_all(om_doc, env);
- axiom_soap_body_add_child(def_body, env, root_node);
+ if (!run_as_get)
+ {
+ soap_envelope = axiom_soap_envelope_create_default_soap_envelope
+ (env, AXIOM_SOAP11);
+ def_body = axiom_soap_envelope_get_body(soap_envelope, env);
+ om_doc = axiom_stax_builder_get_document(om_builder, env);
+ root_node = axiom_document_build_all(om_doc, env);
+ axiom_soap_body_add_child(def_body, env, root_node);
+ }
axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_TRUE);
axis2_msg_ctx_set_rest_http_method(msg_ctx, env, AXIS2_HTTP_PUT);
}
@@ -918,6 +953,31 @@
{
return AXIS2_FAILURE;
}
+ }
+
+ if (run_as_get)
+ {
+ axis2_char_t *buffer = NULL;
+ axis2_char_t *new_url = NULL;
+ buffer = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (content_length + 1));
+ if (!buffer)
+ {
+ return AXIS2_FAILURE;
+ }
+ axis2_http_transport_utils_on_data_request(buffer, content_length, (void *) callback_ctx);
+
+ new_url = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
+ ((int)(strlen(request_uri) + strlen(buffer)) + 2));
+ if (!new_url)
+ {
+ return AXIS2_FAILURE;
+ }
+ sprintf(new_url, "%s?%s", request_uri, buffer);
+ AXIS2_FREE(env->allocator, buffer);
+
+ soap_envelope =
+ axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
+ axis2_http_transport_utils_get_request_params(env, new_url), AXIS2_HTTP_POST);
}
if (binary_data_map)
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org