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 sa...@apache.org on 2006/03/07 03:20:47 UTC

svn commit: r383748 - in /webservices/axis2/trunk/c: ./ modules/core/transport/http/server/apache2/

Author: sahan
Date: Mon Mar  6 18:20:45 2006
New Revision: 383748

URL: http://svn.apache.org/viewcvs?rev=383748&view=rev
Log:
Adding apache2 module

Added:
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/Makefile.am
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_out_transport_info.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.h
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/axis2_apache2_out_transport_info.h
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/axis2_apache2_worker.h
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c
Modified:
    webservices/axis2/trunk/c/configure.ac

Modified: webservices/axis2/trunk/c/configure.ac
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/configure.ac?rev=383748&r1=383747&r2=383748&view=diff
==============================================================================
--- webservices/axis2/trunk/c/configure.ac (original)
+++ webservices/axis2/trunk/c/configure.ac Mon Mar  6 18:20:45 2006
@@ -170,6 +170,7 @@
     modules/core/transport/http/sender/Makefile \
     modules/core/transport/http/receiver/Makefile \
     modules/core/transport/http/server/simple_axis2_server/Makefile \
+    modules/core/transport/http/server/apache2/Makefile \
     modules/core/deployment/Makefile \
     modules/core/clientapi/Makefile \
     modules/core/receivers/Makefile \

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/Makefile.am?rev=383748&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/Makefile.am (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/Makefile.am Mon Mar  6 18:20:45 2006
@@ -0,0 +1,45 @@
+lib_LTLIBRARIES = libmod_axis2.la
+
+libmod_axis2_la_SOURCES = mod_axis2.c\
+                       apache2_stream.c\
+                       apache2_out_transport_info.c\
+                       apache2_worker.c
+AM_CFLAGS = -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE
+libmod_axis2_la_LIBADD   = $(LDFLAGS) \
+                    -L$(AXIS2C_HOME)/lib \
+                    -laxis2_om \
+                    -laxis2_engine \
+                    -laxis2_soap \
+                    -lpthread \
+                    -laxis2_wsdl \
+                    -laxis2_libxml2 \
+                    -laxis2_http_sender \
+                    -laxis2_http_receiver \
+                    -lxml2 \
+                    -laxis2_unix\
+                    -L$(top_builddir)/modules/util \
+                    -L$(top_builddir)/modules/wsdl \
+                    -L$(top_builddir)/modules/core/engine \
+                    -L$(top_builddir)/modules/core/transport/http/sender \
+                    -L$(top_builddir)/modules/core/transport/http/receiver \
+                    -L$(top_builddir)/modules/xml/om \
+                    -L$(top_builddir)/modules/xml/parser/libxml2 \
+                    -L$(top_builddir)/modules/xml/soap \
+                    -L$(top_builddir)/modules/platforms/unix \
+                    -L$(LIBXML2_LIB) $(LIBXML2_LIBNAME) \
+                    -L$(GUTHTHILA_LIB) $(GUTHTHILA_LIBNAME)
+
+INCLUDES = -I$(top_builddir)/include \
+           -I$(top_builddir)/modules/util \
+           -I$(top_builddir)/modules/xml/parser\
+	       -I$(top_builddir)/modules/wsdl\
+	       -I$(top_builddir)/modules/core/transport\
+	       -I$(top_builddir)/modules/core/transport/http \
+           -I$(top_builddir)/modules/core/description \
+           -I$(top_builddir)/modules/core/context \
+           -I$(top_builddir)/modules/core/phaseresolver \
+           -I$(top_builddir)/modules/core/engine \
+           -I$(top_builddir)/modules/core/deployment \
+           -I$(top_builddir)/modules/platforms\
+           -I/usr/include/apr-0\
+           -I/usr/include/apache2

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_out_transport_info.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_out_transport_info.c?rev=383748&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_out_transport_info.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_out_transport_info.c Mon Mar  6 18:20:45 2006
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#include <axis2_apache2_out_transport_info.h>
+#include <axis2_string.h>
+#include <axis2_http_transport.h>
+#include <axis2_string.h>
+#include <apr_strings.h>
+
+
+/** 
+ * @brief Apache2 Out transport info impl structure
+ *	Axis2 apache2_out_transport_info_impl
+ */
+typedef struct axis2_apache2_out_transport_info_impl 
+				axis2_apache2_out_transport_info_impl_t;  
+  
+struct axis2_apache2_out_transport_info_impl
+{
+	axis2_http_out_transport_info_t out_transport_info;
+	request_rec *request;
+    axis2_char_t *encoding;
+};
+
+#define AXIS2_INTF_TO_IMPL(out_transport_info) \
+                ((axis2_apache2_out_transport_info_impl_t *)(out_transport_info))
+
+/***************************** Function headers *******************************/
+axis2_status_t AXIS2_CALL 
+axis2_http_out_transport_info_set_content_type 
+				(axis2_http_out_transport_info_t *info, axis2_env_t **env, 
+				axis2_char_t *content_type);
+    
+axis2_status_t AXIS2_CALL 
+axis2_http_out_transport_info_set_char_encoding 
+				(axis2_http_out_transport_info_t *info, axis2_env_t **env,
+				axis2_char_t *encoding);
+    
+axis2_status_t AXIS2_CALL 
+axis2_http_out_transport_info_free 
+				(axis2_http_out_transport_info_t *out_transport_info, 
+				axis2_env_t **env);
+
+/***************************** End of function headers ************************/
+
+axis2_http_out_transport_info_t * AXIS2_CALL 
+axis2_apache2_out_transport_info_create(axis2_env_t **env,
+                        request_rec *request)
+{
+    axis2_apache2_out_transport_info_impl_t *info_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+        
+    info_impl = (axis2_apache2_out_transport_info_impl_t *)AXIS2_MALLOC 
+                        ((*env)->allocator, sizeof(
+                        axis2_apache2_out_transport_info_impl_t));
+	
+    if(NULL == info_impl)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+	}
+    info_impl->request = request;
+  	info_impl->encoding = NULL;  
+     
+    info_impl->out_transport_info.ops = AXIS2_MALLOC((*env)->allocator,
+        				sizeof(axis2_http_out_transport_info_ops_t));
+    if(NULL == info_impl->out_transport_info.ops)
+	{
+		axis2_http_out_transport_info_free((axis2_http_out_transport_info_t*)
+                         info_impl, env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		return NULL;
+	}
+
+    info_impl->out_transport_info.ops->set_content_type = 
+						axis2_http_out_transport_info_set_content_type;
+    info_impl->out_transport_info.ops->set_char_encoding = 
+						axis2_http_out_transport_info_set_char_encoding;
+    info_impl->out_transport_info.ops->free = 
+						axis2_http_out_transport_info_free;
+                        
+	return &(info_impl->out_transport_info);
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_http_out_transport_info_free (axis2_http_out_transport_info_t *info, 
+						axis2_env_t **env)
+{
+    axis2_apache2_out_transport_info_impl_t *info_impl = NULL;
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    info_impl = AXIS2_INTF_TO_IMPL(info);
+	
+	info_impl->request = NULL; /* request doesn't belong to info */
+    if(NULL != info_impl->encoding)
+    {
+        AXIS2_FREE((*env)->allocator, info_impl->encoding);
+        info_impl->encoding = NULL;
+    }
+    if(NULL != info->ops)
+        AXIS2_FREE((*env)->allocator, info->ops);
+    
+	AXIS2_FREE((*env)->allocator, info_impl);
+	return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_apache2_out_transport_info_free_void_arg (void *transport_info,
+                                             axis2_env_t **env)
+{
+    axis2_http_out_transport_info_t *transport_info_l = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    transport_info_l = (axis2_http_out_transport_info_t *) transport_info;
+    return axis2_http_out_transport_info_free(transport_info_l, env);
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_http_out_transport_info_set_content_type 
+				(axis2_http_out_transport_info_t *info, axis2_env_t **env, 
+				axis2_char_t *content_type)
+{
+    axis2_char_t *tmp1 = NULL;
+	axis2_char_t *tmp2 = NULL;
+	axis2_apache2_out_transport_info_impl_t *info_impl = NULL;
+	
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, content_type, AXIS2_FAILURE);
+	
+	info_impl = AXIS2_INTF_TO_IMPL(info);
+	
+	if(NULL != info_impl->encoding)
+	{
+		
+		tmp1 = AXIS2_STRACAT(content_type, ";charset=", env);
+		tmp2 = AXIS2_STRACAT(tmp1, info_impl->encoding, env);
+        info_impl->request->content_type = apr_pstrdup(info_impl->request->pool,
+                        tmp2);
+		AXIS2_FREE((*env)->allocator, tmp1);
+		AXIS2_FREE((*env)->allocator, tmp2);		
+	}
+	else
+	{
+		info_impl->request->content_type = apr_pstrdup(info_impl->request->pool, 
+                        content_type);
+	}
+	return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_http_out_transport_info_set_char_encoding 
+				(axis2_http_out_transport_info_t *info, axis2_env_t **env,
+				axis2_char_t *encoding)
+{
+    axis2_apache2_out_transport_info_impl_t *info_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, encoding, AXIS2_FAILURE);
+	
+    info_impl = AXIS2_INTF_TO_IMPL(info);
+	
+	if(NULL != info_impl->encoding)
+	{
+		AXIS2_FREE((*env)->allocator, info_impl->encoding);
+	}
+	info_impl->encoding = AXIS2_STRDUP(encoding, env);
+	
+	return AXIS2_SUCCESS;
+}

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.c?rev=383748&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.c Mon Mar  6 18:20:45 2006
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <apache2_stream.h>
+#include <http_protocol.h>
+
+/** 
+ * @brief Stream struct impl
+ *	Streaming mechanisms for Apache2 web server 
+ */
+typedef struct apache2_stream_impl apache2_stream_impl_t;
+  
+struct apache2_stream_impl
+{
+	axis2_stream_t stream; 
+    request_rec *request;   
+};
+
+#define AXIS2_INTF_TO_IMPL(stream) ((apache2_stream_impl_t *)(stream))
+
+/********************************Function headers******************************/
+axis2_status_t AXIS2_CALL 
+apache2_stream_free (axis2_stream_t *stream, axis2_env_t **env);
+
+int AXIS2_CALL
+apache2_stream_write(axis2_stream_t *stream, axis2_env_t **env, 
+						const void *buffer, size_t count);
+int AXIS2_CALL 
+apache2_stream_read(axis2_stream_t *stream, axis2_env_t **env, 
+						void *buffer, size_t count);
+int AXIS2_CALL 
+apache2_stream_skip(axis2_stream_t *stream, axis2_env_t **env, int count);
+
+int AXIS2_CALL 
+apache2_stream_get_char(axis2_stream_t *stream, axis2_env_t **env);
+
+/************************* End of function headers ****************************/
+/*
+ * Internal function. Not exposed to outside
+ */
+AXIS2_DECLARE(axis2_stream_t *)
+axis2_stream_create_apache2(axis2_env_t **env, request_rec *request)
+{
+    apache2_stream_impl_t *stream_impl = NULL;
+	AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK((*env)->error, request, NULL);
+    	
+    stream_impl = (apache2_stream_impl_t *)AXIS2_MALLOC(
+                        (*env)->allocator, sizeof(apache2_stream_impl_t));
+	
+	if(NULL == stream_impl)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+	}
+    
+    stream_impl->request = request;
+	stream_impl->stream.ops = (axis2_stream_ops_t *) AXIS2_MALLOC (
+                        (*env)->allocator, sizeof (axis2_stream_ops_t));
+	if (NULL == stream_impl->stream.ops)
+	{
+		apache2_stream_free(&(stream_impl->stream), env);
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		return NULL;
+	}
+    	
+	stream_impl->stream.ops->free = apache2_stream_free;
+    stream_impl->stream.ops->read = apache2_stream_read;
+    stream_impl->stream.ops->write = apache2_stream_write;
+    stream_impl->stream.ops->skip = apache2_stream_skip;
+    stream_impl->stream.ops->get_char = apache2_stream_get_char;
+    
+	return &(stream_impl->stream);
+}
+
+
+axis2_status_t AXIS2_CALL
+apache2_stream_free (axis2_stream_t *stream, axis2_env_t **env)
+{
+    apache2_stream_impl_t *stream_impl = NULL;
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+	
+	stream_impl = AXIS2_INTF_TO_IMPL(stream);
+	if (NULL != stream_impl->stream.ops)
+    {
+        AXIS2_FREE ((*env)->allocator, stream_impl->stream.ops);
+    }
+   	AXIS2_FREE((*env)->allocator, stream_impl);
+	
+    return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL 
+apache2_stream_read(axis2_stream_t *stream, axis2_env_t **env, 
+						void *buffer, size_t count)
+{
+    apache2_stream_impl_t *stream_impl = NULL;
+	AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
+    
+    stream_impl = AXIS2_INTF_TO_IMPL(stream);
+    return ap_get_client_block(stream_impl->request, buffer, count);
+}
+
+int AXIS2_CALL
+apache2_stream_write(axis2_stream_t *stream, axis2_env_t **env, 
+						const void *buf, size_t count)
+{
+	apache2_stream_impl_t *stream_impl = NULL;
+    char *write_buf = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, buf, AXIS2_FAILURE);
+    stream_impl = AXIS2_INTF_TO_IMPL(stream);
+    axis2_char_t *buffer = (axis2_char_t*)buf;
+    if(count <= 0)
+    {
+        return count;
+    }
+    /* we need to NULL terminate the buffer if it is not already done so */
+    if(buffer[count-1] != '\0')
+    {
+        int len = -1;
+        write_buf = AXIS2_MALLOC((*env)->allocator, count + 1);
+        if(NULL == write_buf)
+        {
+            AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, 
+                        AXIS2_FAILURE);
+            return -1;
+        }
+        memcpy(write_buf, buffer, count);
+        write_buf[count] = '\0';
+        len = ap_rputs(write_buf, stream_impl->request);
+        AXIS2_FREE((*env)->allocator, write_buf);
+        return len;
+    }
+    else
+    {
+        write_buf = buffer;
+        return ap_rputs(write_buf, stream_impl->request);
+    }
+    /* we shoudn't come here unless a serious problem*/
+    return -1;
+}
+
+
+int AXIS2_CALL 
+apache2_stream_skip(axis2_stream_t *stream, axis2_env_t **env, int count)
+{
+	apache2_stream_impl_t *stream_impl = NULL;
+    axis2_char_t *tmp_buffer = NULL;
+    int len = -1;
+	AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
+	stream_impl = AXIS2_INTF_TO_IMPL(stream);
+    
+    tmp_buffer = AXIS2_MALLOC((*env)->allocator, count * sizeof(axis2_char_t));
+    if(tmp_buffer == NULL)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, 
+                          AXIS2_FAILURE);
+        return -1;
+    }
+    len = ap_get_client_block(stream_impl->request, tmp_buffer, count);
+    AXIS2_FREE((*env)->allocator, tmp_buffer);
+    return len;
+    
+}
+
+int AXIS2_CALL 
+apache2_stream_get_char(axis2_stream_t *stream, axis2_env_t **env)
+{
+	int ret = -1;
+	AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
+    
+    /* TODO implement this */
+    return ret;
+}
\ No newline at end of file

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.h?rev=383748&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.h (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.h Mon Mar  6 18:20:45 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain count copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APACHE2_STREAM_H
+#define APACHE2_STREAM_H
+
+#include <axis2.h>
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axis2_stream.h>
+#include <httpd.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/** \brief Constructor for creating apche2 stream
+  * @return axis2_stream (apache2)
+  */
+AXIS2_DECLARE(axis2_stream_t *) axis2_stream_create_apache2
+                        (axis2_env_t **env, request_rec *req);
+
+/** @} */
+    
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* APACHE2_STREAM_H */

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c?rev=383748&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c Mon Mar  6 18:20:45 2006
@@ -0,0 +1,333 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#include <axis2_apache2_worker.h>
+#include <axis2_http_transport.h>
+#include <axis2_conf.h>
+#include <axis2_string.h>
+#include <axis2_msg_ctx.h>
+#include <axis2_http_out_transport_info.h>
+#include <axis2_http_transport_utils.h>
+#include <axis2_op_ctx.h>
+#include <axis2_engine.h>
+#include <axis2_uuid_gen.h>
+#include <axis2_conf_init.h>
+#include <axis2_apache2_out_transport_info.h>
+
+/** 
+ * @brief Apahche2 Worker struct impl
+ *	Axis2 Apache2 Worker impl  
+ */
+typedef struct axis2_apache2_worker_impl axis2_apache2_worker_impl_t;  
+  
+struct axis2_apache2_worker_impl
+{
+	axis2_apache2_worker_t apache2_worker;
+	axis2_conf_ctx_t *conf_ctx;
+};
+
+#define AXIS2_INTF_TO_IMPL(apache2_worker) ((axis2_apache2_worker_impl_t *)\
+                        (apache2_worker))
+
+/***************************** Function headers *******************************/
+
+int AXIS2_CALL 
+axis2_apache2_worker_process_request(axis2_apache2_worker_t *apache2_worker, 
+							axis2_env_t **env, request_rec *req);
+    
+AXIS2_DECLARE(axis2_char_t*)
+axis2_apache2_worker_get_bytes(axis2_env_t **env, 
+                        axis2_stream_t *stream);
+                        
+axis2_status_t AXIS2_CALL 
+axis2_apache2_worker_free(axis2_apache2_worker_t *apache2_worker, 
+							axis2_env_t **env);
+								
+/***************************** End of function headers ************************/
+
+AXIS2_DECLARE(axis2_apache2_worker_t *)
+axis2_apache2_worker_create (axis2_env_t **env, axis2_char_t *repo_path)
+{
+    axis2_apache2_worker_impl_t *apache2_worker_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    apache2_worker_impl = (axis2_apache2_worker_impl_t *)
+        AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_apache2_worker_impl_t));
+	
+    if(NULL == apache2_worker_impl)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+	}
+    apache2_worker_impl->apache2_worker.ops = NULL;
+    apache2_worker_impl->conf_ctx = build_conf_ctx(env, repo_path);
+        
+    if(NULL == apache2_worker_impl->conf_ctx)
+    {
+        axis2_apache2_worker_free((axis2_apache2_worker_t*)apache2_worker_impl,
+                                   env);
+        return NULL;
+    }
+    apache2_worker_impl->apache2_worker.ops = AXIS2_MALLOC((*env)->allocator,
+        sizeof(axis2_apache2_worker_ops_t));
+    if(NULL == apache2_worker_impl->apache2_worker.ops)
+	{
+		axis2_apache2_worker_free((axis2_apache2_worker_t*)apache2_worker_impl,
+                        env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+	}
+    
+    apache2_worker_impl->apache2_worker.ops->process_request = 
+                                    axis2_apache2_worker_process_request;
+    apache2_worker_impl->apache2_worker.ops->free = axis2_apache2_worker_free;
+    
+	return &(apache2_worker_impl->apache2_worker);
+}
+
+axis2_status_t AXIS2_CALL
+axis2_apache2_worker_free (axis2_apache2_worker_t *apache2_worker, 
+                        axis2_env_t **env)
+{
+    axis2_apache2_worker_impl_t *worker_impl = NULL;
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    worker_impl = AXIS2_INTF_TO_IMPL(apache2_worker);
+    if(worker_impl->conf_ctx != NULL)
+    {
+        AXIS2_CONF_CTX_FREE(worker_impl->conf_ctx, env);
+        worker_impl->conf_ctx = NULL;
+    }
+    
+    if(NULL != apache2_worker->ops)
+        AXIS2_FREE((*env)->allocator, apache2_worker->ops);
+    
+    AXIS2_FREE((*env)->allocator, worker_impl->conf_ctx);
+    
+	return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL 
+axis2_apache2_worker_process_request(axis2_apache2_worker_t *apache2_worker, 
+                        axis2_env_t **env, request_rec *request)
+{
+    axis2_apache2_worker_impl_t *apache2_worker_impl = NULL;
+	axis2_conf_ctx_t *conf_ctx = NULL;
+	axis2_msg_ctx_t *msg_ctx = NULL;
+	axis2_stream_t *request_body = NULL;
+    axis2_stream_t *out_stream = 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;
+	int content_length = -1;
+	axis2_char_t *encoding_header_value = NULL;
+	axis2_op_ctx_t *op_ctx = NULL;
+    axis2_char_t *req_url = NULL;
+    axis2_char_t *body_string = NULL;
+    int send_status = -1;
+    axis2_char_t *content_type = NULL;
+    axis2_property_t *property = NULL;
+    axis2_http_out_transport_info_t *apache2_out_transport_info = NULL;
+	
+    AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, request, AXIS2_CRTICAL_FAILURE);
+	
+	apache2_worker_impl = AXIS2_INTF_TO_IMPL(apache2_worker);
+	conf_ctx = apache2_worker_impl->conf_ctx;
+	    
+	if(NULL == conf_ctx)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NULL_CONFIGURATION_CONTEXT,
+                          AXIS2_FAILURE);
+        return AXIS2_CRTICAL_FAILURE;
+	}
+    content_length = request->remaining;
+    http_version = request->protocol;
+    req_url = apr_uri_unparse(request->pool, &(request->parsed_uri),
+                        APR_URI_UNP_OMITUSERINFO);
+    content_type = (axis2_char_t*)apr_table_get(request->headers_in, 
+                        AXIS2_HTTP_HEADER_CONTENT_TYPE);
+    request->content_type = content_type;
+	if(NULL == http_version)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NULL_HTTP_VERSION, 
+						AXIS2_FAILURE);
+        return AXIS2_CRTICAL_FAILURE;
+	}
+    out_stream = axis2_stream_create_basic(env);
+	AXIS2_LOG_DEBUG((*env)->log, AXIS2_LOG_SI, "Client HTTP version %s", 
+						http_version);
+	
+	encoding_header_value = (axis2_char_t*)request->content_encoding;
+		
+	out_desc = AXIS2_CONF_GET_TRANSPORT_OUT(AXIS2_CONF_CTX_GET_CONF
+						(apache2_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
+						(apache2_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);
+	
+	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_apache2_worker_get_headers(apache2_worker, env, 
+                        simple_request), AXIS2_FALSE);*/
+	AXIS2_MSG_CTX_SET_SVC_GRP_CTX_ID(msg_ctx, env, axis2_uuid_gen(env));
+    
+    property = axis2_property_create(env);
+    AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
+    AXIS2_PROPERTY_SET_FREE_FUNC(property, env, 
+                        axis2_apache2_out_transport_info_free_void_arg);
+    apache2_out_transport_info = axis2_apache2_out_transport_info_create(env, 
+                        request);
+    AXIS2_PROPERTY_SET_VALUE(property, env, apache2_out_transport_info);
+    AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_HTTP_OUT_TRANSPORT_INFO,
+                        property, AXIS2_FALSE);
+    
+    soap_action = (axis2_char_t*)apr_table_get(request->headers_in, 
+                        AXIS2_HTTP_HEADER_SOAP_ACTION);
+    request_body = axis2_stream_create_apache2(env, request);
+    if(M_GET == request->method_number)
+	{
+		processed = axis2_http_transport_utils_process_http_get_request
+                        (env, msg_ctx, request_body, out_stream,
+                        content_type ,soap_action,
+						req_url,
+                        conf_ctx, 
+                        axis2_http_transport_utils_get_request_params(env,
+                        (axis2_char_t*)req_url));
+		if(AXIS2_FALSE == processed)
+		{
+			body_string = axis2_http_transport_utils_get_services_html(env, 
+						conf_ctx);
+            request->content_type = "text/html";
+            /*axis2_apache2_worker_set_response_headers(apache2_worker, env, svr_conn,
+            simple_request, response, 0);*/
+            send_status = OK;			
+		}
+		
+	}
+    else if(M_POST == request->method_number)
+	{
+        axis2_status_t status = AXIS2_FAILURE;
+		status = axis2_http_transport_utils_process_http_post_request
+                        (env, msg_ctx, request_body, out_stream,
+                        content_type , content_length,
+                        soap_action,
+                        (axis2_char_t*)req_url);
+		if(status == AXIS2_FAILURE)
+		{
+			axis2_msg_ctx_t *fault_ctx = NULL;
+			axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);
+			if(NULL == engine)
+			{
+                send_status =  HTTP_INTERNAL_SERVER_ERROR;
+			}
+			fault_ctx = AXIS2_ENGINE_CREATE_FAULT_MSG_CTX(engine, env, msg_ctx);
+            AXIS2_ENGINE_SEND_FAULT(engine, env, fault_ctx);
+            body_string = axis2_apache2_worker_get_bytes(env, out_stream);
+            send_status =  HTTP_INTERNAL_SERVER_ERROR;
+            AXIS2_MSG_CTX_FREE(fault_ctx, env);
+		}
+	}
+    if(-1 == send_status)
+    {
+        op_ctx = AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env);
+        if(NULL != op_ctx)
+        {
+            axis2_ctx_t *ctx = AXIS2_OP_CTX_GET_BASE(AXIS2_MSG_CTX_GET_OP_CTX(
+                                    msg_ctx, env), env);
+            if (NULL != ctx)
+            {
+                property = AXIS2_CTX_GET_PROPERTY(ctx, env, 
+                        AXIS2_RESPONSE_WRITTEN, AXIS2_FALSE);
+                if(property)
+                {
+                    ctx_written = AXIS2_PROPERTY_GET_VALUE(property, env);
+                    property = NULL;
+                }
+            }
+        }
+        if(NULL != ctx_written && AXIS2_STRCASECMP(ctx_written, "TRUE") == 0)
+        {
+            send_status = OK;
+            body_string = axis2_apache2_worker_get_bytes(env, out_stream);
+        }
+        else
+        {
+            send_status = HTTP_ACCEPTED;
+        }
+    }
+    if(NULL != body_string)
+    {
+        ap_rputs(body_string, request);
+        AXIS2_FREE((*env)->allocator, body_string);
+        body_string = NULL;
+    }
+    /*AXIS2_MSG_CTX_FREE(msg_ctx, env);*/
+	msg_ctx = NULL;
+	return send_status;
+}
+
+AXIS2_DECLARE(axis2_char_t*)
+axis2_apache2_worker_get_bytes(axis2_env_t **env, 
+                        axis2_stream_t *stream)
+{
+    
+    axis2_stream_t *tmp_stream = NULL;
+    int return_size = -1;
+    axis2_char_t *buffer = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK((*env)->error, stream, NULL);
+    
+    tmp_stream = axis2_stream_create_basic(env);
+    while(1)
+    {
+        int read = 0;
+        int write = 0;
+        int READ_SIZE = 32;
+        char buf[READ_SIZE];
+        read = AXIS2_STREAM_READ(stream, env, buf, READ_SIZE);
+        if(read < 0)
+        {
+            break;
+        }
+        write = AXIS2_STREAM_WRITE(tmp_stream, env, buf, read);
+        if(read < (READ_SIZE -1))
+        {
+            break;
+        }
+    }
+    return_size = AXIS2_STREAM_BASIC_GET_LEN(tmp_stream, env);
+
+    if(return_size > 0)
+    {
+        buffer = (char *)AXIS2_MALLOC((*env)->allocator, sizeof(char)*
+                (return_size +2));
+        return_size = AXIS2_STREAM_READ(tmp_stream, env, buffer,
+                                        return_size + 1);
+        buffer[return_size + 1] = '\0';
+    }
+    AXIS2_STREAM_FREE(tmp_stream, env);
+    return buffer;
+}

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/axis2_apache2_out_transport_info.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/axis2_apache2_out_transport_info.h?rev=383748&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/axis2_apache2_out_transport_info.h (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/axis2_apache2_out_transport_info.h Mon Mar  6 18:20:45 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef AXIS2_APACHE2_OUT_TRANSPORT_INFO_H
+#define AXIS2_APACHE2_OUT_TRANSPORT_INFO_H
+
+/**
+ * @file axis2_apache2_out_transport_info.h
+ * @brief axis2 Apache2 Out Transport Info
+ */
+
+#include <axis2_http_out_transport_info.h>
+#include <httpd.h>
+
+#ifdef __cplusplus
+extern "C" 
+{
+#endif
+/** 
+  * @ingroup axis2_core_transport_http
+  * @{
+  */
+
+AXIS2_DECLARE(axis2_http_out_transport_info_t *) 
+axis2_apache2_out_transport_info_create(axis2_env_t **env,
+					request_rec *r);
+
+/**
+ * Free http_out_transport_info passed as void pointer. This will be
+ * cast into appropriate type and then pass the cast object
+ * into the http_out_transport_info structure's free method
+ */
+AXIS2_DECLARE(axis2_status_t) 
+axis2_apache2_out_transport_info_free_void_arg (void *transport_info,
+                                             axis2_env_t **env);
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+#endif /* AXIS2_APACHE2_OUT_TRANSPORT_INFO_H */

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/axis2_apache2_worker.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/axis2_apache2_worker.h?rev=383748&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/axis2_apache2_worker.h (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/axis2_apache2_worker.h Mon Mar  6 18:20:45 2006
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_APACHE2_WORKER_H
+#define AXIS2_APACHE2_WORKER_H
+
+
+/**
+  * @file axis2_apache2_worker.h
+  * @brief axis2 Apache2 Worker
+  */
+
+#include <axis2.h>
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axis2_conf_ctx.h>
+#include <apache2_stream.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @ingroup axis2_core_transport_http
+ * @{
+ */
+
+    typedef struct axis2_apache2_worker_ops axis2_apache2_worker_ops_t;
+    typedef struct axis2_apache2_worker axis2_apache2_worker_t; 
+    
+/** 
+ * @brief Apache2 Worker ops struct
+ * Encapsulator struct for ops of axis2_apache2_worker
+ */  
+AXIS2_DECLARE_DATA struct axis2_apache2_worker_ops
+{
+    int (AXIS2_CALL *process_request)
+                    (axis2_apache2_worker_t *apache2_worker, 
+                     axis2_env_t **env, request_rec *r);
+    
+    axis2_status_t (AXIS2_CALL *free)
+                    (axis2_apache2_worker_t *apache2_worker, 
+                    axis2_env_t **env);
+};
+
+/** 
+ * @brief Apache2 Worker struct
+  *    Axis2 Apache2 Worker
+ */
+AXIS2_DECLARE_DATA struct axis2_apache2_worker
+{
+    axis2_apache2_worker_ops_t *ops;    
+};
+
+
+AXIS2_DECLARE(axis2_apache2_worker_t *) 
+axis2_apache2_worker_create (axis2_env_t **env, axis2_char_t *repo_path);
+    
+/************************** Start of function macros **************************/
+#define AXIS2_APACHE2_WORKER_PROCESS_REQUEST(apache2_worker, env, request) \
+                        ((apache2_worker)->ops->process_request(\
+                        apache2_worker, env, request))
+#define AXIS2_APACHE2_WORKER_FREE(apache2_worker, env) \
+                ((apache2_worker)->ops->free(apache2_worker, env))
+
+/************************** End of function macros ****************************/    
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* AXIS2_APACHE2_WORKER_H */

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c?rev=383748&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c Mon Mar  6 18:20:45 2006
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain count copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <httpd.h>
+#include <http_config.h>
+#include <http_protocol.h>
+#include <ap_config.h>
+#include <apr_strings.h>
+#include "axis2_apache2_worker.h"
+#include <axis2_error_default.h>
+#include <axis2_log_default.h>
+#include <axis2_thread_pool.h>
+
+/* Configuration structure populated by apache2.conf */
+typedef struct axis2_config_rec
+{
+    char * axis2_log_file;
+    char * axis2_repo_path;
+}axis2_config_rec_t;
+
+axis2_apache2_worker_t *axis2_worker = NULL;
+axis2_env_t *axis2_env = NULL;
+
+/******************************Function Headers********************************/
+static void * axis2_create_svr(apr_pool_t *p, char *d);
+static const char *axis2_set_repo_path(cmd_parms *cmd, void *dummy, 
+                        const char *arg);
+static const char *axis2_set_log_file(cmd_parms *cmd, void *dummy, 
+                        const char *arg);
+static int axis2_handler(request_rec *req);
+static void axis2_module_init(apr_pool_t* p, server_rec* svr_rec);
+static void axis2_register_hooks(apr_pool_t *p);
+/***************************End of Function Headers****************************/
+
+static const command_rec axis2_cmds[] = 
+{
+    AP_INIT_TAKE1("RepoPath", axis2_set_repo_path, NULL, ACCESS_CONF,
+                  "Axis2/C repository path"),
+    AP_INIT_TAKE1("LogFile", axis2_set_log_file, NULL, ACCESS_CONF,
+                  "Axis2/C log file name"),
+    {NULL}
+};
+
+/* Dispatch list for API hooks */
+module AP_MODULE_DECLARE_DATA axis2_module = {
+    STANDARD20_MODULE_STUFF, 
+    NULL,                  /* create per-dir    config structures */
+    NULL,                  /* merge  per-dir    config structures */
+    axis2_create_svr,      /* create per-server config structures */
+    NULL,                  /* merge  per-server config structures */
+    axis2_cmds,            /* table of config file commands       */
+    axis2_register_hooks   /* register hooks                      */
+};
+
+static void * axis2_create_svr(apr_pool_t *p, char *d)
+{
+    axis2_config_rec_t *conf = apr_palloc(p, sizeof(*conf));
+    conf->axis2_log_file = NULL;
+    conf->axis2_repo_path = NULL;
+    return conf;
+}
+
+static const char *axis2_set_repo_path(cmd_parms *cmd, void *dummy, 
+                        const char *arg)
+{
+    axis2_config_rec_t *conf = (axis2_config_rec_t*)ap_get_module_config(
+                        cmd->server->module_config, &axis2_module);
+    conf->axis2_repo_path = apr_pstrdup(cmd->pool, arg);
+    return NULL;
+}
+
+static const char *axis2_set_log_file(cmd_parms *cmd, void *dummy, 
+                                     const char *arg)
+{
+    axis2_config_rec_t *conf = (axis2_config_rec_t*)ap_get_module_config(
+            cmd->server->module_config, &axis2_module);
+    conf->axis2_log_file = apr_pstrdup(cmd->pool, arg);
+    return NULL;
+}
+
+/* The sample content handler */
+static int axis2_handler(request_rec *req)
+{
+    int rv = 0;
+    if (strcmp(req->handler, "axis2_module")) {
+        return DECLINED;
+    }
+        
+    /* Set up the read policy from the client.*/
+    if ((rv = ap_setup_client_block(req, REQUEST_CHUNKED_DECHUNK)) != OK)
+    {
+        return rv;
+    }
+    rv = AXIS2_APACHE2_WORKER_PROCESS_REQUEST(axis2_worker, &axis2_env, req);
+    if(AXIS2_CRTICAL_FAILURE == rv)
+    {
+        return HTTP_INTERNAL_SERVER_ERROR;
+    }
+    return rv;
+}
+
+static void axis2_module_init(apr_pool_t* p, server_rec* svr_rec)
+{
+    axis2_allocator_t *allocator = NULL;
+    axis2_error_t *error = NULL;
+    axis2_log_t *axis2_logger = NULL;
+    axis2_thread_pool_t *thread_pool = NULL;
+    axis2_status_t status = AXIS2_SUCCESS;
+    axis2_config_rec_t *conf = (axis2_config_rec_t*)ap_get_module_config(
+                        svr_rec->module_config, &axis2_module); 
+    
+    /*apr_pool_cleanup_register(p, NULL, module_exit, apr_pool_cleanup_null);*/
+    allocator = axis2_allocator_init(NULL);
+    if(NULL == allocator)
+    {
+        fprintf(stderr, "[Axis2] Error initilizing mod_axis2. Reason :"
+                        "allocator init failed\n");
+        status = AXIS2_FAILURE;
+    }
+    error = axis2_error_create(allocator);
+    if(NULL == error)
+    {
+        fprintf(stderr, "[Axis2] Error initilizing mod_axis2. Reason :"
+                        "error struct creation failed\n");
+        status = AXIS2_FAILURE;
+    }
+    axis2_logger = axis2_log_create(allocator, NULL, conf->axis2_log_file);
+    if(NULL == axis2_logger)
+    {
+        fprintf(stderr, "[Axis2] Error initilizing mod_axis2. Reason :"
+                        "log init failed\n");
+        status = AXIS2_FAILURE;
+    }
+    thread_pool = axis2_thread_pool_init(allocator);
+    if(NULL == thread_pool)
+    {
+        fprintf(stderr, "[Axis2] Error initilizing mod_axis2. Reason :"
+                        "thread_pool init failed\n");
+        status = AXIS2_FAILURE;
+    }
+    axis2_env = axis2_env_create_with_error_log_thread_pool(allocator, error, 
+                        axis2_logger, thread_pool);
+    if(NULL == axis2_env)
+    {
+        fprintf(stderr, "[Axis2] Error initilizing mod_axis2. Reason :"
+                        "axis2_environment init failed\n");
+        status = AXIS2_FAILURE;
+    }
+    axis2_worker = axis2_apache2_worker_create(&axis2_env, 
+                        conf->axis2_repo_path);
+    if(NULL == axis2_env)
+    {
+        fprintf(stderr, "[Axis2] Error initilizing mod_axis2. Reason :"
+                        "axis2_worker init failed\n");
+        status = AXIS2_FAILURE;
+    }
+    if(AXIS2_FAILURE == status)
+    {
+        fprintf(stderr, "[Axis2] Due to one or more errors mod_axis2 loading"
+                        "failed. Causing apache2 to stop loading\n");
+        /* TODO we should stop apache2 loading */
+    }
+}
+
+static void axis2_register_hooks(apr_pool_t *p)
+{
+    ap_hook_handler(axis2_handler, NULL, NULL, APR_HOOK_MIDDLE);
+    ap_hook_child_init(axis2_module_init, NULL, NULL, APR_HOOK_REALLY_FIRST);
+}
+
+