You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2003/11/30 07:57:31 UTC
cvs commit: ws-axis/c/src/server/apache2 mod_axis2.c
sanjaya 2003/11/29 22:57:31
Modified: c/src/server/apache2 Tag: Release-2003_10_26-bugfixes_branch
mod_axis2.c
Log:
changed to make the apache 2 module work
Revision Changes Path
No revision
No revision
1.1.2.2 +70 -62 ws-axis/c/src/server/apache2/Attic/mod_axis2.c
Index: mod_axis2.c
===================================================================
RCS file: /home/cvs/ws-axis/c/src/server/apache2/Attic/mod_axis2.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- mod_axis2.c 28 Nov 2003 13:53:33 -0000 1.1.2.1
+++ mod_axis2.c 30 Nov 2003 06:57:31 -0000 1.1.2.2
@@ -67,6 +67,7 @@
#include <apache2_0/http_protocol.h>
#include <apache2_0/http_log.h>
#include <apache2_0/ap_compat.h>
+#include <apache2_0/apr_tables.h>
#include <axis/common/Packet.h>
#include <malloc.h>
@@ -75,24 +76,21 @@
*/
extern int process_request(Ax_soapstream* str);
-/*extern int process(soapstream *);*/
+//extern int process(soapstream *);
extern unsigned char chEBuf[1024];
-/*Call initialize_module() [of Packet.h] from within this method*/
-void module_init(server_rec *svr_rec, apr_pool_t* p)
+//Should dispatch the headers from within this method
+int send_transport_information(Ax_soapstream* hdr)
{
- initialize_module(1);
+ ap_send_http_header((request_rec*)hdr->str.op_stream);
+ return 0;
}
-
-/*Call initialize_process() [of Packet.h] from within this method*/
-void axis_Init(server_rec *svr_rec, apr_pool_t* p)
-{}
-/*Call finalize_process() [of Packet.h] from within this method*/
-void axis_Fini(server_rec *svr_rec, apr_pool_t* p)
-{}
-
-
+//Call initialize_module() [of Packet.h] from within this method
+void module_init(server_rec *svr_rec, apr_pool_t* p)
+{
+ initialize_module(1, "");
+}
int send_response_bytes(char* res, void* opstream)
{
@@ -100,21 +98,19 @@
return 0;
}
-
-
-/*Should dispatch the headers from within this method*/
-int send_transport_information(Ax_soapstream* hdr)
-{
- ap_send_http_header((request_rec*)hdr->str.op_stream);
- return 0;
-}
+//Call initialize_process() [of Packet.h] from within this method
+void axis_Init(server_rec *svr_rec, apr_pool_t* p)
+{}
+//Call finalize_process() [of Packet.h] from within this method
+void axis_Fini(server_rec *svr_rec, apr_pool_t* p)
+{}
int get_request_bytes(char* req, int reqsize, int* retsize, void* ipstream)
{
int len_read;
- /*ap_hard_timeout("util_read", (request_rec*)ipstream);*/
+ //ap_hard_timeout("util_read", (request_rec*)ipstream);
len_read = ap_get_client_block((request_rec*)ipstream, req, reqsize);
- /*ap_reset_timeout((request_rec*)ipstream);*/
+ //ap_reset_timeout((request_rec*)ipstream);
*retsize = len_read;
return 0;
}
@@ -123,53 +119,79 @@
static int mod_axis_method_handler (request_rec *req_rec)
{
int rc;
+ int ix;
Ax_soapstream* sstr;
apr_array_header_t* arr;
+ apr_table_entry_t* pHeaderTable;
+ Ax_header* pAx_Headers;
+
+ if ((!req_rec->handler) || strcmp(req_rec->handler, "axis") != 0)
+ {
+ return DECLINED;
+ }
sstr = malloc(sizeof(Ax_soapstream));
+
+ sstr->transport.pSendFunct = send_response_bytes;
+ sstr->transport.pGetFunct = get_request_bytes;
+ sstr->transport.pSendTrtFunct = send_transport_information;
+ sstr->transport.pGetTrtFunct = send_transport_information; /*isn't there a get transport information function for apache module ?*/
+
sstr->trtype = APTHTTP;
- /*req_rec is used as both input and output streams*/
+ //req_rec is used as both input and output streams
sstr->str.ip_stream = req_rec;
sstr->str.op_stream = req_rec;
- /*just add some sessionid*/
+ //just add some sessionid
sstr->sessionid = "this is temporary session id";
- req_rec->content_type = "text/xml"; /*for SOAP 1.2 this this should be "application/soap+xml" but keep this for the moment */
- /*set up the read policy from the client.*/
+
+ //set up the read policy from the client.
if ((rc = ap_setup_client_block(req_rec, REQUEST_CHUNKED_ERROR)) != OK)
{
return rc;
}
- /*the member, "path" of "parsed_uri" contains the uri of the */
- /*request (i.e "/abc/xyz" part of http://somehost/abc/xyz)*/
+ //the member, "path" of "parsed_uri" contains the uri of the
+ //request (i.e "/abc/xyz" part of http://somehost/abc/xyz)
sstr->so.http.uri_path = req_rec->parsed_uri.path;
- /*ap_table_elts returns an array_header struct. The nelts element of that struct contains the number of*/
- /*input header elements. Finally assigns that to the axis soap data structure. */
+ //ap_table_elts returns an array_header struct. The nelts element of that struct contains the number of
+ //input header elements. Finally assigns that to the axis soap data structure.
sstr->so.http.ip_headercount = ap_table_elts(req_rec->headers_in)->nelts;
- /*casting req_rec->headers_in to axis header struct and assigning that to the axis soap structure. Hope this is ok*/
-
- /*obtain the array_header from the headers_in table and assign it to the axis soap structure*/
- arr = ap_table_elts(req_rec->headers_in);
- sstr->so.http.ip_headers = (Ax_header*)arr->elts;
- /*Determine the http method and assign it to the axis soap structure*/
+ if (sstr->so.http.ip_headercount > 0)
+ {
+ //obtain the array_header from the headers_in table and assign it to the axis soap structure
+ arr = ap_table_elts(req_rec->headers_in);
+ pHeaderTable = arr->elts;
+ sstr->so.http.ip_headers = malloc(sizeof(Ax_header)*sstr->so.http.ip_headercount);
+ pAx_Headers = sstr->so.http.ip_headers;
+ for (ix = 0; ix < sstr->so.http.ip_headercount; ix++)
+ {
+ (pAx_Headers+ix)->headername = (pHeaderTable+ix)->key;
+ (pAx_Headers+ix)->headervalue = (pHeaderTable+ix)->val;
+ }
+ }
+ //Determine the http method and assign it to the axis soap structure
switch (req_rec->method_number)
{
case M_GET:
sstr->so.http.ip_method = AXIS_HTTP_GET;
+ req_rec->content_type = "text/html";
break;
case M_POST:
sstr->so.http.ip_method = AXIS_HTTP_POST;
+ req_rec->content_type = "text/xml";
+ //for SOAP 1.2 this this should be "application/soap+xml"
+ //but keep this for the moment
break;
default:
sstr->so.http.ip_method = AXIS_HTTP_UNSUPPORTED;
}
- /*tell the client that we are ready to receive content and check whether client will send content*/
- /*control will pass to this block only if there is body content in the request*/
+ //tell the client that we are ready to receive content and check whether client will send content
+ //control will pass to this block only if there is body content in the request
if (ap_should_client_block(req_rec));
if(0 != process_request(sstr))
@@ -180,42 +202,28 @@
free(sstr);
- /*free(arr);*/
+ //free(arr);
return OK;
}
-/*
- * This function is a callback and it declares what other functions
- * should be called for request processing and configuration requests.
- * This callback function declares the Handlers for other events.
- */
static void mod_axis_register_hooks (apr_pool_t *p)
{
- /* I think this is the call to make to register a handler for method calls (GET PUT et. al.).*/
- /* We will ask to be last so that the comment has a higher tendency to*/
- /* go at the end.*/
+ ap_hook_child_init(module_init, NULL, NULL, APR_HOOK_REALLY_FIRST);
+ //ap_hook_pre_connection(axis_Init, NULL, NULL, APR_HOOK_FIRST);
ap_hook_handler(mod_axis_method_handler, NULL, NULL, APR_HOOK_LAST);
+ //ap_hook_process_connection(axis_Fini, NULL, NULL, APR_HOOK_REALLY_LAST);
}
-/*
- * Declare and populate the module's data structure. The
- * name of this structure ('tut1_module') is important - it
- * must match the name of the module. This structure is the
- * only "glue" between the httpd core and the module.
- */
-module AP_MODULE_DECLARE_DATA mod_axis =
-{
- /* Only one callback function is provided. Real
- modules will need to declare callback functions for
- server/directory configuration, configuration merging
- and other tasks.*/
+
+module AP_MODULE_DECLARE_DATA axis_module =
+{
+
STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
NULL,
- mod_axis_register_hooks, /* callback for registering hooks */
- /* mod_tut1_register_hooks*/
+ mod_axis_register_hooks,
};