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 se...@apache.org on 2008/03/16 11:21:09 UTC

svn commit: r637575 - in /webservices/axis2/trunk/c: include/axis2_http_transport.h include/axis2_msg_ctx.h src/core/context/msg_ctx.c src/core/receivers/raw_xml_in_out_msg_recv.c src/core/transport/http/common/http_worker.c

Author: senaka
Date: Sun Mar 16 03:21:05 2008
New Revision: 637575

URL: http://svn.apache.org/viewvc?rev=637575&view=rev
Log:
Fixing bug in creating request URL, and fixing JIRA Issue AXIS2C-1057

Modified:
    webservices/axis2/trunk/c/include/axis2_http_transport.h
    webservices/axis2/trunk/c/include/axis2_msg_ctx.h
    webservices/axis2/trunk/c/src/core/context/msg_ctx.c
    webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c
    webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.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?rev=637575&r1=637574&r2=637575&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_transport.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_transport.h Sun Mar 16 03:21:05 2008
@@ -84,6 +84,11 @@
 #define AXIS2_HTTP_RESPONSE_ACK_CODE_VAL 202
 
     /**
+     * RESPONSE_NO_CONTENT_CODE_VAL
+     */
+#define AXIS2_HTTP_RESPONSE_NO_CONTENT_CODE_VAL 204
+
+    /**
      * RESPONSE_BAD_REQUEST_CODE_VAL
      */
 #define AXIS2_HTTP_RESPONSE_BAD_REQUEST_CODE_VAL 400
@@ -137,6 +142,11 @@
      * RESPONSE_ACK_CODE_NAME
      */
 #define AXIS2_HTTP_RESPONSE_ACK_CODE_NAME "Accepted"
+
+    /**
+     * RESPONSE_NO_CONTENT_CODE_NAME
+     */
+#define AXIS2_HTTP_RESPONSE_NO_CONTENT_CODE_NAME "No Content"
 
     /**
      * RESPONSE_BAD_REQUEST_CODE_NAME

Modified: webservices/axis2/trunk/c/include/axis2_msg_ctx.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_msg_ctx.h?rev=637575&r1=637574&r2=637575&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_msg_ctx.h (original)
+++ webservices/axis2/trunk/c/include/axis2_msg_ctx.h Sun Mar 16 03:21:05 2008
@@ -1783,6 +1783,35 @@
         axis2_char_t * str);
 
     /**
+     * Gets whether there was no content in the response.
+     * This will cater for a situation where the invoke
+     * method in a service returns NULL when no fault has
+     * occured.
+     * @param msg_ctx message context
+     * @param env pointer to environment struct
+     * @return returns AXIS2_TRUE if there was no content
+     * occured or AXIS2_FALSE otherwise
+     */
+    AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+    axis2_msg_ctx_get_no_content(
+        axis2_msg_ctx_t * msg_ctx,
+        const axutil_env_t * env);
+    
+    /**
+     * Sets that there was no content in the response.
+     * @param msg_ctx message context
+     * @param env pointer to environment struct
+     * @param no_content expects AXIS2_TRUE if there was no
+     * content in the response or AXIS2_FALSE otherwise
+     * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+     */
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axis2_msg_ctx_set_no_content(
+        axis2_msg_ctx_t * msg_ctx,
+        const axutil_env_t * env,
+        const axis2_bool_t no_content);
+
+    /**
      * Gets whether an authentication failure occured
      * @param msg_ctx message context
      * @param env pointer to environment struct

Modified: webservices/axis2/trunk/c/src/core/context/msg_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/context/msg_ctx.c?rev=637575&r1=637574&r2=637575&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/context/msg_ctx.c (original)
+++ webservices/axis2/trunk/c/src/core/context/msg_ctx.c Sun Mar 16 03:21:05 2008
@@ -205,6 +205,7 @@
     axis2_bool_t is_auth_failure;
     axis2_bool_t required_auth_is_http;
     axis2_char_t *auth_type;
+    axis2_bool_t no_content;
 };
 
 AXIS2_EXTERN axis2_msg_ctx_t *AXIS2_CALL
@@ -279,6 +280,7 @@
     msg_ctx->is_auth_failure = AXIS2_FALSE;
     msg_ctx->required_auth_is_http = AXIS2_FALSE;
     msg_ctx->auth_type = NULL;
+    msg_ctx->no_content = AXIS2_FALSE;
 
     msg_ctx->base = axis2_ctx_create(env);
     if (!(msg_ctx->base))
@@ -2294,6 +2296,27 @@
 {
     AXIS2_PARAM_CHECK (env->error, msg_ctx, AXIS2_FAILURE);
     msg_ctx->is_auth_failure = status;
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_msg_ctx_get_no_content(
+    axis2_msg_ctx_t * msg_ctx,
+    const axutil_env_t * env)
+{
+    AXIS2_PARAM_CHECK (env->error, msg_ctx, AXIS2_FALSE);
+    return msg_ctx->no_content;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_msg_ctx_set_no_content(
+    axis2_msg_ctx_t * msg_ctx,
+    const axutil_env_t * env,
+    const axis2_bool_t no_content)
+{
+    AXIS2_PARAM_CHECK (env->error, msg_ctx, AXIS2_FAILURE);
+    msg_ctx->no_content = no_content;
     return AXIS2_SUCCESS;
 }
 

Modified: webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c?rev=637575&r1=637574&r2=637575&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c (original)
+++ webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c Sun Mar 16 03:21:05 2008
@@ -220,6 +220,7 @@
                 AXIS2_SVC_SKELETON_INVOKE(svc_obj, env, om_node, new_msg_ctx);
         }
 
+        axis2_msg_ctx_set_no_content(new_msg_ctx, env, AXIS2_FALSE);
         if (result_node)
         {
             if (0 == axutil_strcmp(style, AXIS2_STYLE_RPC))
@@ -249,6 +250,10 @@
         else
         {
             status = AXIS2_ERROR_GET_STATUS_CODE(env->error);
+            if (status == AXIS2_SUCCESS)
+            {
+                axis2_msg_ctx_set_no_content(new_msg_ctx, env, AXIS2_TRUE);
+            }
             fault_node = AXIS2_SVC_SKELETON_ON_FAULT(svc_obj, env, om_node);
         }
     }

Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c?rev=637575&r1=637574&r2=637575&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c Sun Mar 16 03:21:05 2008
@@ -195,26 +195,6 @@
         }
 
     }
-    request_url = axutil_url_create(env, "http", svr_ip,
-                                    http_worker->svr_port, path);
-    if (request_url)
-    {
-        url_external_form = axutil_url_to_external_form(request_url, env);
-    }
-
-    if (!url_external_form)
-    {
-        axis2_http_simple_response_set_status_line(response, env,
-                                                   http_version,
-                                                   AXIS2_HTTP_RESPONSE_BAD_REQUEST_CODE_VAL,
-                                                   AXIS2_HTTP_RESPONSE_BAD_REQUEST_CODE_NAME);
-        status =
-            axis2_simple_http_svr_conn_write_response(svr_conn, env,
-                                                          response);
-        axis2_http_simple_response_free(response, env);
-        response = NULL;
-        return status;
-    }
 
     request_body = axis2_http_simple_request_get_body(simple_request, env);
 
@@ -249,6 +229,27 @@
         axis2_http_request_line_get_uri
         (axis2_http_simple_request_get_request_line(simple_request, env), env);
 
+    request_url = axutil_url_create(env, "http", svr_ip,
+                                    http_worker->svr_port, path);
+    if (request_url)
+    {
+        url_external_form = axutil_url_to_external_form(request_url, env);
+    }
+
+    if (!url_external_form)
+    {
+        axis2_http_simple_response_set_status_line(response, env,
+                                                   http_version,
+                                                   AXIS2_HTTP_RESPONSE_BAD_REQUEST_CODE_VAL,
+                                                   AXIS2_HTTP_RESPONSE_BAD_REQUEST_CODE_NAME);
+        status =
+            axis2_simple_http_svr_conn_write_response(svr_conn, env,
+                                                          response);
+        axis2_http_simple_response_free(response, env);
+        response = NULL;
+        return status;
+    }
+
     axis2_msg_ctx_set_transport_out_stream(msg_ctx, env, out_stream);
 
     headers = axis2_http_worker_get_headers(http_worker, env, simple_request);
@@ -784,7 +785,13 @@
                 }
                 if (out_msg_ctx)
                 {
-                    /* TODO: Add neccessary handling */
+                    if (axis2_msg_ctx_get_no_content(out_msg_ctx, env))
+                    {
+                        axis2_http_simple_response_set_status_line(response, env, http_version,
+                                                                   AXIS2_HTTP_RESPONSE_NO_CONTENT_CODE_VAL,
+                                                                   AXIS2_HTTP_RESPONSE_NO_CONTENT_CODE_NAME);
+                        request_handled = AXIS2_TRUE;
+                    }
                 }
             }
             if (!request_handled)



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