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 10:27:34 UTC
svn commit: r637571 -
/webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c
Author: senaka
Date: Sun Mar 16 02:27:34 2008
New Revision: 637571
URL: http://svn.apache.org/viewvc?rev=637571&view=rev
Log:
Adding necessary infrastructure for RESTful Services to report suitable status codes using the Message Context
Modified:
webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c
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=637571&r1=637570&r2=637571&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 02:27:34 2008
@@ -205,9 +205,9 @@
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);
+ 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);
@@ -727,17 +727,71 @@
request_handled = AXIS2_TRUE;
status = AXIS2_TRUE;
}
+ op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
if (!request_handled)
{
- op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
- if (axis2_op_ctx_get_response_written(op_ctx, env))
+ axis2_bool_t do_rest = AXIS2_FALSE;
+ if (is_get || is_head || is_put || is_delete ||
+ axis2_msg_ctx_get_doing_rest(msg_ctx, env))
{
- axis2_http_simple_response_set_status_line(response, env, http_version,
- AXIS2_HTTP_RESPONSE_OK_CODE_VAL,
- AXIS2_HTTP_RESPONSE_OK_CODE_NAME);
- if (!is_head)
+ do_rest = AXIS2_TRUE;
+ }
+ if (op_ctx && axis2_op_ctx_get_response_written(op_ctx, env))
+ {
+ if (do_rest)
+ {
+ axis2_msg_ctx_t *out_msg_ctx = NULL;
+ axis2_msg_ctx_t *in_msg_ctx = NULL;
+ axis2_msg_ctx_t **msg_ctx_map = NULL;
+
+ msg_ctx_map = axis2_op_ctx_get_msg_ctx_map(op_ctx, env);
+ out_msg_ctx = msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_OUT];
+ in_msg_ctx = msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_IN];
+ if (in_msg_ctx)
+ {
+ /* TODO: Add neccessary handling */
+ }
+ if (out_msg_ctx)
+ {
+ /* TODO: Add neccessary handling */
+ }
+ }
+ if (!request_handled)
+ {
+ axis2_http_simple_response_set_status_line(response, env, http_version,
+ AXIS2_HTTP_RESPONSE_OK_CODE_VAL,
+ AXIS2_HTTP_RESPONSE_OK_CODE_NAME);
+ if (!is_head)
+ {
+ axis2_http_simple_response_set_body_stream(response, env, out_stream);
+ }
+ }
+ }
+ else if (op_ctx)
+ {
+ if (do_rest)
+ {
+ axis2_msg_ctx_t *out_msg_ctx = NULL;
+ axis2_msg_ctx_t *in_msg_ctx = NULL;
+ axis2_msg_ctx_t **msg_ctx_map = NULL;
+
+ msg_ctx_map = axis2_op_ctx_get_msg_ctx_map(op_ctx, env);
+ out_msg_ctx = msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_OUT];
+ in_msg_ctx = msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_IN];
+ if (in_msg_ctx)
+ {
+ /* TODO: Add neccessary handling */
+ }
+ if (out_msg_ctx)
+ {
+ /* TODO: Add neccessary handling */
+ }
+ }
+ if (!request_handled)
{
- axis2_http_simple_response_set_body_stream(response, env, out_stream);
+ axis2_http_simple_response_set_status_line(response, env, http_version,
+ AXIS2_HTTP_RESPONSE_ACK_CODE_VAL,
+ AXIS2_HTTP_RESPONSE_ACK_CODE_NAME);
}
}
else
@@ -757,8 +811,7 @@
{
AXIS2_FREE(env->allocator, url_external_form);
url_external_form = NULL;
- }
- op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
+ }
if (op_ctx)
{
axis2_msg_ctx_t *out_msg_ctx = NULL;
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org