axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r358717 - in /webservices/axis2/trunk/c: include/axis2_http_transport_utils.h include/axis2_http_worker.h modules/core/transport/http/src/axis2_http_transport_utils.c modules/core/transport/http/src/axis2_http_worker.c
Date Fri, 23 Dec 2005 05:29:40 GMT
Author: samisa
Date: Thu Dec 22 21:29:28 2005
New Revision: 358717

URL: http://svn.apache.org/viewcvs?rev=358717&view=rev
Log:
Applied the patches

Modified:
    webservices/axis2/trunk/c/include/axis2_http_transport_utils.h
    webservices/axis2/trunk/c/include/axis2_http_worker.h
    webservices/axis2/trunk/c/modules/core/transport/http/src/axis2_http_transport_utils.c
    webservices/axis2/trunk/c/modules/core/transport/http/src/axis2_http_worker.c

Modified: webservices/axis2/trunk/c/include/axis2_http_transport_utils.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_http_transport_utils.h?rev=358717&r1=358716&r2=358717&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_transport_utils.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_transport_utils.h Thu Dec 22 21:29:28 2005
@@ -29,6 +29,9 @@
 #include <axis2_om_stax_builder.h>
 #include <axis2_msg_ctx.h>
 #include <axis2_conf_ctx.h>
+#include <axis2_hash.h>
+#include <axis2_om_element.h>
+#include <axis2_stream.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -39,8 +42,55 @@
  * @ingroup axis2_core_transport_http
  * @{
  */
-  
+axis2_status_t AXIS2_CALL
+axis2_http_transport_utils_process_http_post_request
+                        (axis2_env_t **env, axis2_msg_ctx_t *msg_ctx, 
+                        axis2_stream_t *stream, axis2_char_t *content_type, 
+                        axis2_char_t *soap_action_header,
+                        axis2_char_t *request_uri);
+    
+axis2_bool_t AXIS2_CALL 
+axis2_http_transport_utils_process_http_get_request
+                        (axis2_env_t **env, axis2_msg_ctx_t *msg_ctx,
+                        axis2_stream_t *stream, axis2_char_t *content_type,
+                        axis2_char_t *soap_action_header, 
+                        axis2_char_t *request_uri, axis2_conf_ctx_t *conf_ctx, 
+                        axis2_hash_t *request_params);
+    
+/*axis2_soap_envelope_t* AXIS2_CALL 
+axis2_http_transport_utils_create_envelope_from_get_request
+                        (axis2_env_t **env, axis2_char_t *request_uri,
+                        axis2_hash_t *request_params);*/
+    
+axis2_om_stax_builder_t* AXIS2_CALL 
+axis2_http_transport_utils_select_builder_for_mime
+                        (axis2_env_t **env, axis2_char_t *request_uri,
+                        axis2_msg_ctx_t *msg_ctx, axis2_stream_t *in_stream,
+                        axis2_char_t *content_type);
+   
+axis2_bool_t AXIS2_CALL 
+axis2_http_transport_utils_do_write_mtom(axis2_env_t **env, 
+                                        axis2_msg_ctx_t *msg_ctx);
+                                                
+axis2_bool_t AXIS2_CALL 
+axis2_http_transport_utils_is_doing_rest(axis2_env_t **env, 
+                                        axis2_msg_ctx_t *msg_ctx);
+                                                
+axis2_bool_t AXIS2_CALL 
+axis2_http_transport_utils_is_doing_rest_through_post
+                        (axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+						
+axis2_hash_t *AXIS2_CALL
+axis2_http_transport_utils_get_request_params(axis2_env_t **env, 
+						axis2_char_t *request_uri);
+						
+axis2_char_t* AXIS2_CALL
+axis2_http_transport_utils_get_services_html(axis2_env_t **env, 
+							axis2_conf_ctx_t *conf_ctx);
 
+axis2_hash_t *AXIS2_CALL
+axis2_http_transport_utils_get_request_params(axis2_env_t **env, 
+						axis2_char_t *request_uri);
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/include/axis2_http_worker.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_http_worker.h?rev=358717&r1=358716&r2=358717&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_worker.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_worker.h Thu Dec 22 21:29:28 2005
@@ -57,20 +57,6 @@
                     axis2_simple_http_svr_conn_t *svr_conn, 
                     axis2_http_simple_request_t *simple_request);
     
-    axis2_status_t (AXIS2_CALL *set_response_headers)
-                    (axis2_http_worker_t *http_worker, 
-                    axis2_env_t **env, 
-                    axis2_simple_http_svr_conn_t *svr_conn, 
-                    axis2_http_simple_request_t *simple_request,
-                    axis2_http_simple_response_t *simple_response,    
-                    axis2_ssize_t content_length);
-
-    axis2_status_t (AXIS2_CALL *set_trasnport_out_config)
-                    (axis2_http_worker_t *http_worker, 
-                    axis2_env_t **env, 
-                    axis2_conf_ctx_t *conf_ctx, 
-                    axis2_http_simple_response_t *simple_response);
-    
     axis2_status_t (AXIS2_CALL *free)
                     (axis2_http_worker_t *http_worker, 
                     axis2_env_t **env);
@@ -96,14 +82,6 @@
                 (http_worker, env, svr_conn, simple_request) \
                 ((http_worker)->ops->process_request(http_worker, env, svr_conn\
                 ,simple_request))
-#define AXIS2_HTTP_WORKER_SET_RESPONSE_HEADERS\
-                (http_worker, env, svr_conn, simple_request, content_length)\
-                ((http_worker)->ops->set_response_headers(http_worker, env, \
-                svr_conn, simple_request, content_length))
-#define AXIS2_HTTP_WORKER_SET_TRANSPORT_OUT_CONFIG\
-                (http_worker, env, conf_ctx, simple_response)\
-                ((http_worker)->ops->set_trasnport_out_config(http_worker, env,\
-                conf_ctx, simple_response)))
 #define AXIS2_HTTP_WORKER_FREE\
                 (http_worker, env) \
                 ((http_worker)->ops->free(http_worker, env))

Modified: webservices/axis2/trunk/c/modules/core/transport/http/src/axis2_http_transport_utils.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/src/axis2_http_transport_utils.c?rev=358717&r1=358716&r2=358717&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/src/axis2_http_transport_utils.c
(original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/src/axis2_http_transport_utils.c
Thu Dec 22 21:29:28 2005
@@ -15,6 +15,11 @@
  */
  
 #include <axis2_http_transport_utils.h>
+#include <string.h>
+#include <ctype.h>
+#include <axis2_conf.h>
+#include <axis2_op.h>
+#include <axis2_qname.h>
 
 /***************************** Function headers *******************************/
 
@@ -33,10 +38,10 @@
                         axis2_char_t *request_uri, axis2_conf_ctx_t *conf_ctx, 
                         axis2_hash_t *request_params);
     
-axis2_soap_envelope_t* AXIS2_CALL 
+/*axis2_soap_envelope_t* AXIS2_CALL 
 axis2_http_transport_utils_create_envelope_from_get_request
                         (axis2_env_t **env, axis2_char_t *request_uri,
-                        axis2_hash_t *request_params);
+                        axis2_hash_t *request_params);*/
     
 axis2_om_stax_builder_t* AXIS2_CALL 
 axis2_http_transport_utils_select_builder_for_mime
@@ -59,6 +64,17 @@
 axis2_bool_t AXIS2_CALL 
 axis2_http_transport_utils_is_doing_rest_through_post
                         (axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+						
+axis2_status_t AXIS2_CALL
+axis2_http_transport_utils_strdecode(axis2_env_t **env, axis2_char_t *dest, 
+						axis2_char_t *src);
+						
+int AXIS2_CALL
+axis2_http_transport_utils_hexit(axis2_char_t c);
+
+axis2_char_t* AXIS2_CALL
+axis2_http_transport_utils_get_services_html(axis2_env_t **env, 
+							axis2_conf_ctx_t *conf_ctx);
                                 
 /***************************** End of function headers ************************/
 
@@ -88,13 +104,13 @@
 }
 
 
-axis2_soap_envelope_t* AXIS2_CALL 
+/*axis2_soap_envelope_t* AXIS2_CALL 
 axis2_http_transport_utils_create_envelope_from_get_request
                         (axis2_env_t **env, axis2_char_t *request_uri,
                         axis2_hash_t *request_params)
 {
     return NULL;
-}
+}*/
 
 
 axis2_om_stax_builder_t* AXIS2_CALL 
@@ -145,4 +161,214 @@
         TODO implement when REST support is added
     */
     return AXIS2_FALSE;
+}
+
+axis2_hash_t *AXIS2_CALL
+axis2_http_transport_utils_get_request_params(axis2_env_t **env, 
+						axis2_char_t *request_uri)
+{
+	
+	
+	axis2_char_t *query_str = NULL;
+	axis2_char_t *tmp = strchr(request_uri, '?');
+	axis2_char_t *tmp2 = NULL;
+	axis2_char_t *tmp_name = NULL;
+	axis2_char_t *tmp_value = NULL;
+	axis2_hash_t *ret = NULL;
+	
+	AXIS2_PARAM_CHECK((*env)->error, request_uri, AXIS2_FAILURE);
+	
+	if(NULL == tmp || '\0' == *(tmp +1))
+	{
+		return NULL;
+	}
+	query_str = AXIS2_STRDUP(tmp+1, env);
+		
+	for(tmp2 = tmp = query_str; *tmp != '\0'; ++tmp)
+	{
+		if('=' == *tmp)
+		{
+			*tmp = '\0';
+			tmp_name = AXIS2_STRDUP(tmp2, env);
+			axis2_http_transport_utils_strdecode(env, tmp_name, tmp_name);
+			tmp2 = tmp +1;			
+		}
+		if('&' == *tmp)
+		{
+			*tmp = '\0';
+			tmp_value = AXIS2_STRDUP(tmp2, env);
+			axis2_http_transport_utils_strdecode(env, tmp_value, tmp_value);
+			tmp2 = tmp +1;
+		}
+		if(NULL != tmp_name && NULL != tmp_value)
+		{
+			if(NULL == ret)
+			{
+				ret = axis2_hash_make(env);
+			}
+			axis2_hash_set(ret, tmp_name, AXIS2_HASH_KEY_STRING, tmp_value);
+			tmp_name = NULL;
+			tmp_value = NULL;
+		}
+	}
+	if(NULL != tmp_name && '\0' != *tmp2)
+	{
+		if(NULL == ret)
+		{
+			ret = axis2_hash_make(env);
+		}
+		tmp_value = AXIS2_STRDUP(tmp2, env);
+		axis2_http_transport_utils_strdecode(env, tmp_value, tmp_value);
+		axis2_hash_set(ret, tmp_name, AXIS2_HASH_KEY_STRING, tmp_value);
+	}
+	
+	return ret;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_http_transport_utils_strdecode(axis2_env_t **env, axis2_char_t *dest, 
+						axis2_char_t *src)
+{
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, dest, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, src, AXIS2_FAILURE);
+
+    for ( ; *src != '\0'; ++dest, ++src )
+    {
+		if ( src[0] == '%' && isxdigit( src[1] ) && isxdigit( src[2] ) )
+		{
+			*dest = axis2_http_transport_utils_hexit( src[1] ) * 16 + 
+							axis2_http_transport_utils_hexit( src[2] );
+			src += 2;
+		}
+		else
+		{
+			*dest = *src;
+		}
+    }
+    *dest = '\0';
+	
+	return AXIS2_SUCCESS;
+}
+
+
+int AXIS2_CALL
+axis2_http_transport_utils_hexit(axis2_char_t c)
+{
+	if ( c >= '0' && c <= '9' )
+	{
+		return c - '0';
+	}
+	if ( c >= 'a' && c <= 'f' )
+	{
+		return c - 'a' + 10;
+	}
+	if ( c >= 'A' && c <= 'F' )
+	{
+		return c - 'A' + 10;
+	}
+	return 0;           /* shouldn't happen, we're guarded by isxdigit() */
+}
+
+axis2_char_t* AXIS2_CALL
+axis2_http_transport_utils_get_services_html(axis2_env_t **env, 
+							axis2_conf_ctx_t *conf_ctx)
+{
+	axis2_hash_t *services_map = NULL;
+	axis2_hash_t *errorneous_svc_map = NULL;
+	axis2_char_t *tmp = NULL;
+	axis2_char_t *tmp2 = "<h2>Deployed Services</h2>";
+	axis2_hash_index_t *hi = NULL;
+	axis2_bool_t svcs_exists = AXIS2_FALSE;
+	
+	AXIS2_ENV_CHECK(env, NULL);
+	AXIS2_PARAM_CHECK((*env)->error, conf_ctx, NULL);
+	
+	services_map = AXIS2_CONF_GET_SVCS(AXIS2_CONF_CTX_GET_CONF(conf_ctx,env),
+							env);
+	errorneous_svc_map = AXIS2_CONF_GET_FAULTY_SVCS(AXIS2_CONF_CTX_GET_CONF(
+							conf_ctx,env), env);
+	if(NULL != services_map && 0 != axis2_hash_count(services_map))
+	{
+		void *service = NULL;
+		axis2_char_t *sname = NULL;
+		axis2_hash_t *ops = NULL;
+		svcs_exists = AXIS2_TRUE;
+		
+		for (hi = axis2_hash_first (services_map, env);
+             				NULL != hi; hi = axis2_hash_next (env, hi))
+		{
+			axis2_hash_this(hi, NULL, NULL, &service);
+			sname= AXIS2_QNAME_GET_LOCALPART(AXIS2_SVC_GET_QNAME(
+							((axis2_svc_t *)service), env), env);
+			tmp = AXIS2_STRACAT(tmp2, "<h3>", env);
+			tmp2 = AXIS2_STRACAT(tmp, sname, env);
+			AXIS2_FREE((*env)->allocator, tmp);
+			tmp  = AXIS2_STRACAT(tmp2, "</h3>", env);
+			AXIS2_FREE((*env)->allocator, tmp2);
+			ops = AXIS2_SVC_GET_OPS(((axis2_svc_t *)service), env);
+			if(NULL != ops && 0 != axis2_hash_count(ops))
+			{
+				axis2_hash_index_t *hi2 = NULL;
+				void *op = NULL;
+				axis2_char_t *oname = NULL;
+				
+				tmp2 = AXIS2_STRACAT(tmp, "Available Operations <ul>", env);
+				AXIS2_FREE((*env)->allocator, tmp);
+				for(hi2 = axis2_hash_first(ops, env); NULL != hi2;
+							axis2_hash_next(env, hi2))
+				{
+					axis2_hash_this(hi2, NULL, NULL, &op);
+					oname = AXIS2_QNAME_GET_LOCALPART(AXIS2_OP_GET_QNAME(
+							((axis2_op_t *)op), env), env);
+					tmp = AXIS2_STRACAT(tmp2, "<li>", env);
+					AXIS2_FREE((*env)->allocator, tmp2);
+					tmp2 = AXIS2_STRACAT(tmp, oname, env);
+					AXIS2_FREE((*env)->allocator, tmp);
+					tmp = AXIS2_STRACAT(tmp2, "</li>", env);
+					AXIS2_FREE((*env)->allocator, tmp2);
+					tmp2 = tmp;
+				}
+				tmp2 = AXIS2_STRACAT(tmp, "</ul>", env);
+				AXIS2_FREE((*env)->allocator, tmp);
+			}
+			else
+			{
+				tmp2 = AXIS2_STRACAT(tmp, "No operations Available", env);
+				AXIS2_FREE((*env)->allocator, tmp);
+			}			
+		}
+	}
+	if(NULL != errorneous_svc_map && 0 != axis2_hash_count(errorneous_svc_map))
+	{
+		void *fsname = NULL;
+		svcs_exists = AXIS2_TRUE;
+		tmp = AXIS2_STRACAT(tmp2, "<hr><h2><font color=\"blue\">Faulty Services</font></h2>"
+							, env);
+		AXIS2_FREE((*env)->allocator, tmp2);
+		
+		for(hi = axis2_hash_first(errorneous_svc_map, env); NULL != hi;
+							axis2_hash_next(env, hi))
+		{
+			axis2_hash_this(hi, (const void **)&fsname, NULL, NULL);
+			tmp2 = AXIS2_STRACAT(tmp, "<h3><font color=\"blue\">", env);
+			AXIS2_FREE((*env)->allocator, tmp);
+			tmp = AXIS2_STRACAT(tmp2, (axis2_char_t*)fsname, env);
+			AXIS2_FREE((*env)->allocator, tmp2);
+			tmp2 = AXIS2_STRACAT(tmp, "</font></h3>", env);
+			AXIS2_FREE((*env)->allocator, tmp);
+		}
+	}
+	if(AXIS2_FALSE == svcs_exists)
+	{
+		tmp2 = AXIS2_STRDUP("<h2>There are no services deployed</h2>", env);
+	}
+	tmp = AXIS2_STRACAT("<html><head><title>Axis2:Services</title></head><body>"
+							, tmp2, env);
+	AXIS2_FREE((*env)->allocator, tmp2);
+	tmp2 = AXIS2_STRACAT(tmp, "</body></html>", env);
+	AXIS2_FREE((*env)->allocator, tmp);
+	
+	return tmp2;
 }

Modified: webservices/axis2/trunk/c/modules/core/transport/http/src/axis2_http_worker.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/src/axis2_http_worker.c?rev=358717&r1=358716&r2=358717&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/src/axis2_http_worker.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/src/axis2_http_worker.c Thu Dec
22 21:29:28 2005
@@ -17,6 +17,13 @@
 #include <axis2_http_worker.h>
 #include <axis2_string.h>
 #include <axis2_http_transport.h>
+#include <axis2_conf.h>
+#include <axis2_string.h>
+#include <axis2_msg_ctx.h>
+#include <axis2_http_request_line.h>
+#include <axis2_http_out_transport_info.h>
+#include <axis2_http_transport_utils.h>
+#include <axis2_op_ctx.h>
 
 /** 
  * @brief HTTP Worker struct impl
@@ -37,27 +44,32 @@
 
 axis2_bool_t AXIS2_CALL 
 axis2_http_worker_process_request(axis2_http_worker_t *http_worker, 
-				axis2_env_t **env, 
-				axis2_simple_http_svr_conn_t *svr_conn, 
-				axis2_http_simple_request_t *simple_request);
+							axis2_env_t **env, 
+							axis2_simple_http_svr_conn_t *svr_conn, 
+							axis2_http_simple_request_t *simple_request);
     
 axis2_status_t AXIS2_CALL 
 axis2_http_worker_set_response_headers(axis2_http_worker_t *http_worker, 
-						axis2_env_t **env, 
-						axis2_simple_http_svr_conn_t *svr_conn, 
-						axis2_http_simple_request_t *simple_request,
-                        axis2_http_simple_response_t *simple_response,
-						axis2_ssize_t content_length);
+							axis2_env_t **env, 
+							axis2_simple_http_svr_conn_t *svr_conn, 
+							axis2_http_simple_request_t *simple_request,
+							axis2_http_simple_response_t *simple_response,
+							axis2_ssize_t content_length);
 
 axis2_status_t AXIS2_CALL 
-axis2_http_worker_set_trasnport_out_config(axis2_http_worker_t *http_worker, 
-						axis2_env_t **env, 
-						axis2_conf_ctx_t *conf_ctx, 
-						axis2_http_simple_response_t *simple_response);
+axis2_http_worker_set_transport_out_config(axis2_http_worker_t *http_worker, 
+							axis2_env_t **env, 
+							axis2_conf_ctx_t *conf_ctx, 
+							axis2_http_simple_response_t *simple_response);
+							
+axis2_hash_t* AXIS2_CALL
+axis2_http_worker_get_headers(axis2_http_worker_t *http_worker, 
+							axis2_env_t **env, 
+							axis2_http_simple_request_t *request);
 	
 axis2_status_t AXIS2_CALL 
 axis2_http_worker_free(axis2_http_worker_t *http_worker, 
-								axis2_env_t **env);
+							axis2_env_t **env);
 								
 /***************************** End of function headers ************************/
 
@@ -86,10 +98,6 @@
     
     http_worker_impl->http_worker.ops->process_request = 
                                     axis2_http_worker_process_request;
-    http_worker_impl->http_worker.ops->set_response_headers = 
-                                    axis2_http_worker_set_response_headers;
-    http_worker_impl->http_worker.ops->set_trasnport_out_config =
-                                    axis2_http_worker_set_trasnport_out_config;
     http_worker_impl->http_worker.ops->free = axis2_http_worker_free;
     
 	return &(http_worker_impl->http_worker);
@@ -112,15 +120,148 @@
 
 axis2_bool_t AXIS2_CALL 
 axis2_http_worker_process_request(axis2_http_worker_t *http_worker, 
-				axis2_env_t **env, 
-				axis2_simple_http_svr_conn_t *svr_conn, 
-				axis2_http_simple_request_t *simple_request)
+						axis2_env_t **env, 
+						axis2_simple_http_svr_conn_t *svr_conn, 
+						axis2_http_simple_request_t *simple_request)
 {
-    AXIS2_FUNC_PARAM_CHECK(http_worker, env, AXIS2_FAILURE);
+    axis2_http_worker_impl_t *http_worker_impl = NULL;
+	axis2_conf_ctx_t *conf_ctx = http_worker_impl->conf_ctx;
+	axis2_msg_ctx_t *msg_ctx = NULL;
+	axis2_stream_t *request_body = NULL;
+	axis2_stream_t *out_stream = axis2_stream_create(env, (*env)->allocator, 
+						NULL);
+	axis2_http_simple_response_t *response = NULL;
+	axis2_transport_out_desc_t *out_desc = NULL;
+	axis2_transport_in_desc_t *in_desc = NULL;
+	axis2_char_t *http_version = NULL;
+	axis2_char_t *soap_action = NULL;
+	axis2_bool_t processed = AXIS2_FALSE;
+	axis2_char_t *ctx_written = NULL;
+	
+	AXIS2_FUNC_PARAM_CHECK(http_worker, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, svr_conn, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, simple_request, AXIS2_FAILURE);
+	
+	http_worker_impl = AXIS2_INTF_TO_IMPL(http_worker);
+	
+	if(NULL != conf_ctx)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NULL_CONFIGURATION_CONTEXT,
+						AXIS2_FAILURE);
+	}
+	request_body = AXIS2_HTTP_SIMPLE_REQUEST_GET_BODY(simple_request, env);
+	response = axis2_http_simple_response_create_default(env);
+	out_desc = AXIS2_CONF_GET_TRANSPORT_OUT(AXIS2_CONF_CTX_GET_CONF
+						(http_worker_impl->conf_ctx, env), env, 
+						axis2_qname_create(env, AXIS2_TRANSPORT_HTTP, NULL, 
+						NULL));
+	in_desc = AXIS2_CONF_GET_TRANSPORT_IN(AXIS2_CONF_CTX_GET_CONF
+						(http_worker_impl->conf_ctx, env), env, 
+						axis2_qname_create(env, AXIS2_TRANSPORT_HTTP, NULL,
+						NULL));
+	msg_ctx = axis2_msg_ctx_create(env, conf_ctx, in_desc, out_desc);
+	AXIS2_MSG_CTX_SET_SERVER_SIDE(msg_ctx, env, AXIS2_TRUE);
+	
+	http_version = AXIS2_HTTP_REQUEST_LINE_GET_HTTP_VERSION
+						(AXIS2_HTTP_SIMPLE_REQUEST_GET_REQUEST_LINE
+						(simple_request, env), env);
+	
+	if(NULL == http_version)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NULL_HTTP_VERSION, 
+						AXIS2_FAILURE);
+	}
+	if(0 == AXIS2_STRCASECMP(http_version, AXIS2_HTTP_HEADER_PROTOCOL_11))
+	{
+		axis2_http_worker_set_transport_out_config(http_worker, env, conf_ctx,
+						response);
+	}
+	AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_TRANSPORT_OUT, out_stream, 
+						AXIS2_FALSE);
+	AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_TRANSPORT_HEADERS, 
+						axis2_http_worker_get_headers(http_worker, env, 
+						simple_request), AXIS2_FALSE);
+	/*
+	 * TODO uuidgen
+	 * AXIS2_MSG_CTX_SET_SVC_GRP_CTX_ID(uuid, env);
+	 */
+	AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_HTTP_OUT_TRANSPORT_INFO,
+						axis2_http_out_transport_info_create(env, response), 
+						AXIS2_FALSE);
+	if(NULL != AXIS2_HTTP_SIMPLE_REQUEST_GET_FIRST_HEADER(simple_request, env, 
+						AXIS2_HTTP_HEADER_SOAP_ACTION))
+	{
+		soap_action = AXIS2_HTTP_HEADER_GET_VALUE(
+						AXIS2_HTTP_SIMPLE_REQUEST_GET_FIRST_HEADER(
+						simple_request, env, AXIS2_HTTP_HEADER_SOAP_ACTION), 
+						env);
+	}
+	if(0 == AXIS2_STRCASECMP(AXIS2_HTTP_REQUEST_LINE_GET_METHOD(
+						AXIS2_HTTP_SIMPLE_REQUEST_GET_REQUEST_LINE(
+						simple_request, env), env), AXIS2_HTTP_HEADER_GET))
+	{
+		processed = axis2_http_transport_utils_process_http_get_request
+                        (env, msg_ctx, request_body, 
+						AXIS2_HTTP_SIMPLE_REQUEST_GET_CONTENT_TYPE(
+						simple_request, env) ,soap_action,
+						AXIS2_HTTP_REQUEST_LINE_GET_URI(
+						AXIS2_HTTP_SIMPLE_REQUEST_GET_REQUEST_LINE(
+						simple_request, env), env),
+                        conf_ctx, 
+                        axis2_http_transport_utils_get_request_params(env,
+						AXIS2_HTTP_REQUEST_LINE_GET_URI(
+						AXIS2_HTTP_SIMPLE_REQUEST_GET_REQUEST_LINE(
+						simple_request, env), env)));
+		if(AXIS2_FALSE == processed)
+		{
+			AXIS2_HTTP_SIMPLE_RESPONSE_SET_STAUTUS_LINE(response, env,
+						http_version, AXIS2_HTTP_RESPONSE_OK_CODE_VAL, "OK");
+			AXIS2_HTTP_SIMPLE_RESPONSE_SET_BODY_STRING(response, env, 
+						axis2_http_transport_utils_get_services_html(env, 
+						conf_ctx));
+			axis2_http_worker_set_response_headers(http_worker, env, svr_conn,
+						simple_request, response, 0);
+			AXIS2_SIMPLE_HTTP_SVR_CONN_WRITE_RESPONSE(svr_conn, env, response);
+			AXIS2_HTTP_SIMPLE_RESPONSE_FREE(response, env);
+			return AXIS2_TRUE;			
+		}
+		
+	}
+	else if(0 == AXIS2_STRCASECMP(AXIS2_HTTP_REQUEST_LINE_GET_METHOD(
+						AXIS2_HTTP_SIMPLE_REQUEST_GET_REQUEST_LINE(
+						simple_request, env), env), AXIS2_HTTP_HEADER_POST))
+	{
+		processed = axis2_http_transport_utils_process_http_post_request
+                        (env, msg_ctx, request_body, 
+						AXIS2_HTTP_SIMPLE_REQUEST_GET_CONTENT_TYPE(
+						simple_request, env) ,soap_action,
+						AXIS2_HTTP_REQUEST_LINE_GET_URI
+						(AXIS2_HTTP_SIMPLE_REQUEST_GET_REQUEST_LINE(
+						simple_request, env), env));
+	}
+	axis2_op_ctx_t *op_ctx = AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env);
+	if(NULL != op_ctx)
+	{
+		ctx_written = AXIS2_OP_CTX_GET_PROPERTY(op_ctx, env, 
+						AXIS2_RESPONSE_WRITTEN);
+	}
+	if(NULL != ctx_written && AXIS2_STRCASECMP(ctx_written, "TRUE"))
+	{
+		AXIS2_HTTP_SIMPLE_RESPONSE_SET_STAUTUS_LINE(response, env, http_version,
+						AXIS2_HTTP_RESPONSE_OK_CODE_VAL, "OK");
+	}
+	else
+	{
+		AXIS2_HTTP_SIMPLE_RESPONSE_SET_STAUTUS_LINE(response, env, http_version,
+						AXIS2_HTTP_RESPONSE_ACK_CODE_VAL, "Accepted");
+	}
+	AXIS2_HTTP_SIMPLE_RESPONSE_SET_BODY_STREAM(response, env, out_stream);
+	axis2_http_worker_set_response_headers(http_worker, env, svr_conn, 
+						simple_request, response, AXIS2_STREAM_GET_LEN(
+						out_stream, env));
+	
     /*
-        TODO create the engine and process the request
+        TODO write to the client and handle errors
     */
     return AXIS2_TRUE;
 }
@@ -131,18 +272,19 @@
 						axis2_env_t **env, 
 						axis2_simple_http_svr_conn_t *svr_conn, 
 						axis2_http_simple_request_t *simple_request,
-                        axis2_http_simple_response_t *simple_response,
+						axis2_http_simple_response_t *simple_response,
 						axis2_ssize_t content_length)
 {
-    AXIS2_FUNC_PARAM_CHECK(http_worker, env, AXIS2_FAILURE);
+    axis2_http_header_t *conn_header = NULL;
+	
+	AXIS2_FUNC_PARAM_CHECK(http_worker, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, svr_conn, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, simple_request, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, simple_response, AXIS2_FAILURE);
     if(AXIS2_FALSE == AXIS2_HTTP_SIMPLE_RESPONSE_CONTAINS_HEADER
                     (simple_response, env, AXIS2_HTTP_HEADER_CONNECTION))
     {
-        axis2_http_header_t *conn_header = 
-                    AXIS2_HTTP_SIMPLE_REQUEST_GET_FIRST_HEADER(simple_request,
+        conn_header = AXIS2_HTTP_SIMPLE_REQUEST_GET_FIRST_HEADER(simple_request,
                     env, AXIS2_HTTP_HEADER_CONNECTION);
         if(NULL != conn_header)
         {
@@ -161,8 +303,8 @@
                     env), AXIS2_HTTP_HEADER_CONNECTION_CLOSE))
             {
                 axis2_http_header_t *header = axis2_http_header_create(env,
-                    AXIS2_HTTP_HEADER_CONNECTION, 
-                    AXIS2_HTTP_HEADER_CONNECTION_CLOSE);
+                    AXIS2_HTTP_HEADER_CONNECTION,
+					AXIS2_HTTP_HEADER_CONNECTION_CLOSE);
                 AXIS2_HTTP_SIMPLE_RESPONSE_SET_HEADER(simple_response, env, 
                     header);
                 AXIS2_SIMPLE_HTTP_SVR_CONN_SET_KEEP_ALIVE(svr_conn, env, 
@@ -189,8 +331,10 @@
             if(0 != content_length)
             {
                 axis2_char_t content_len_str[10];
+				axis2_http_header_t *content_len_hdr = NULL;
+				
                 sprintf(content_len_str, "%10d", content_length);
-                axis2_http_header_t *content_len_hdr = axis2_http_header_create(
+                content_len_hdr = axis2_http_header_create(
                     env, AXIS2_HTTP_HEADER_CONTENT_LENGTH, content_len_str);
                 AXIS2_HTTP_SIMPLE_RESPONSE_SET_HEADER(simple_response, env,
                     content_len_hdr);
@@ -200,19 +344,37 @@
     return AXIS2_SUCCESS;
 }
 
-
+/*
+ * This is only called for HTTP/1.1 to enable 1.1 specific parameters.
+ *
+ */
 axis2_status_t AXIS2_CALL 
-axis2_http_worker_set_trasnport_out_config(axis2_http_worker_t *http_worker, 
+axis2_http_worker_set_transport_out_config(axis2_http_worker_t *http_worker, 
 						axis2_env_t **env, 
 						axis2_conf_ctx_t *conf_ctx, 
 						axis2_http_simple_response_t *simple_response)
 {
-    AXIS2_FUNC_PARAM_CHECK(http_worker, env, AXIS2_FAILURE);
+    axis2_conf_t *config = NULL;
+	axis2_hash_t *tranport_outs = NULL;
+	
+	AXIS2_FUNC_PARAM_CHECK(http_worker, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, conf_ctx, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, simple_response, AXIS2_FAILURE);
+	
+	config = AXIS2_CONF_CTX_GET_CONF(conf_ctx, env);
+    tranport_outs = AXIS2_CONF_GET_TRANSPORTS_OUT(
+                        config, env);
+	
 
     /*
         TODO implement the method
     */
     return AXIS2_SUCCESS;
+}
+
+axis2_hash_t* AXIS2_CALL
+axis2_http_worker_get_headers(axis2_http_worker_t *http_worker, 
+						axis2_env_t **env, axis2_http_simple_request_t *request)
+{
+	return NULL;
 }



Mime
View raw message