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/01/31 06:35:36 UTC

svn commit: r373718 - in /webservices/axis2/trunk/c/modules/core/transport/http: http_transport_utils.c receiver/http_svr_thread.c server/http_server_main.c

Author: sahan
Date: Mon Jan 30 21:35:29 2006
New Revision: 373718

URL: http://svn.apache.org/viewcvs?rev=373718&view=rev
Log:
Added error reporting and changed the services HTML

Modified:
    webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c
    webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c

Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c?rev=373718&r1=373717&r2=373718&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c Mon Jan 30 21:35:29 2006
@@ -610,7 +610,8 @@
 				void *op = NULL;
 				axis2_char_t *oname = NULL;
 				
-				ret = AXIS2_STRACAT(tmp2, "Available Operations <ul>", env);
+				ret = AXIS2_STRACAT(tmp2, "<i>Available Operations</i> <ul>", 
+						env);
 				AXIS2_FREE((*env)->allocator, tmp2);
                 tmp2 = ret;
 				for(hi2 = axis2_hash_first(ops, env); NULL != hi2;
@@ -646,7 +647,7 @@
 	{
 		void *fsname = NULL;
 		svcs_exists = AXIS2_TRUE;
-		ret = AXIS2_STRACAT(tmp2, "<hr><h2><font color=\"blue\">Faulty \
+		ret = AXIS2_STRACAT(tmp2, "<hr><h2><font color=\"red\">Faulty \
 						Services</font></h2>"
 							, env);
 		AXIS2_FREE((*env)->allocator, tmp2);
@@ -656,7 +657,7 @@
 							axis2_hash_next(env, hi))
 		{
 			axis2_hash_this(hi, (const void **)&fsname, NULL, NULL);
-			ret = AXIS2_STRACAT(tmp2, "<h3><font color=\"blue\">", env);
+			ret = AXIS2_STRACAT(tmp2, "<h3><font color=\"red\">", env);
 			AXIS2_FREE((*env)->allocator, tmp2);
             tmp2 = ret;
 			ret = AXIS2_STRACAT(tmp2, (axis2_char_t*)fsname, env);
@@ -671,11 +672,16 @@
 	{
 		ret = AXIS2_STRDUP("<h2>There are no services deployed</h2>", env);
 	}
-	ret = AXIS2_STRACAT("<html><head><title>Axis2C :: Services</title></head>\
-						<body>" , tmp2, env);
+	ret = AXIS2_STRACAT("<html><head><title>Axis2C :: Services</title></head>"
+						"<table width=\"100%\"><tr><td align=\"left\"><img src="
+						"\"http://www.apache.org/images/asf-logo.gif\"/></td>"
+						"<td align=\"right\"><img src=\"http://ws.apache.org/"
+						"axis2/images/axis.jpg\"/></td></tr></table><body><font"
+						" face=\"courier\">" 
+						, tmp2, env);
 	/*AXIS2_FREE((*env)->allocator, tmp2);*/
     tmp2 = ret;
-	ret = AXIS2_STRACAT(tmp2, "</body></html>\r\n", env);
+	ret = AXIS2_STRACAT(tmp2, "</font></body></html>\r\n", env);
 	/*AXIS2_FREE((*env)->allocator, tmp);*/
 	
 	return ret;

Modified: webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c?rev=373718&r1=373717&r2=373718&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c Mon Jan 30 21:35:29 2006
@@ -158,10 +158,10 @@
 		struct AXIS2_PLATFORM_TIMEB t1, t2;
 		axis2_simple_http_svr_conn_t *svr_conn = NULL;
 		axis2_http_simple_request_t *request = NULL;
-		char log_str[128];
 		int millisecs = 0;
 		double secs = 0;
 		axis2_http_worker_t *tmp = NULL;
+		axis2_status_t status = AXIS2_FAILURE;
 		
 		socket = axis2_network_handler_svr_socket_accept(env, 
 						svr_thread_impl->listen_socket);
@@ -171,9 +171,11 @@
 		}
 		AXIS2_PLATFORM_GET_TIME_IN_MILLIS(&t1);
 		svr_conn = axis2_simple_http_svr_conn_create(env, socket);
+		AXIS2_SIMPLE_HTTP_SVR_CONN_SET_RCV_TIMEOUT(svr_conn, env, 
+						axis2_http_socket_read_timeout);
 		request = AXIS2_SIMPLE_HTTP_SVR_CONN_READ_REQUEST(svr_conn, env);
 		tmp = svr_thread_impl->worker;
-		AXIS2_HTTP_WORKER_PROCESS_REQUEST(tmp, env, svr_conn, request);
+		status = AXIS2_HTTP_WORKER_PROCESS_REQUEST(tmp, env, svr_conn, request);
 		AXIS2_SIMPLE_HTTP_SVR_CONN_FREE(svr_conn, env);
 		AXIS2_PLATFORM_GET_TIME_IN_MILLIS(&t2);
 		millisecs = t2.millitm - t1.millitm;
@@ -184,9 +186,16 @@
 			secs--;
 		}
 		secs += millisecs/1000.0;
-		sprintf(log_str, "[Axis2]Request served in %.3f seconds", secs);
-		AXIS2_LOG_WRITE((*env)->log, log_str, 
-						AXIS2_LOG_LEVEL_INFO);
+		if(status == AXIS2_SUCCESS)
+		{
+			AXIS2_LOG_INFO((*env)->log, "Request served in %.3f seconds", secs);
+		}
+		else
+		{
+			AXIS2_LOG_INFO((*env)->log, "Error occured in processing request." 
+						"(%.3f seconds)", secs);
+		}
+		
 	}
 	
     return AXIS2_SUCCESS;

Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c?rev=373718&r1=373717&r2=373718&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c Mon Jan 30 21:35:29 2006
@@ -117,14 +117,20 @@
 	server = axis2_http_server_create(&env, repo_path, port);
 	if(NULL == server)
 	{
-	    AXIS2_LOG_ERROR(env->log, LOG_SI, "Server creation failed: Error code: %d :: %s", 
-						env->error->error_number,
+	    AXIS2_LOG_ERROR(env->log, LOG_SI, "Server creation failed: Error code:"
+						" %d :: %s", env->error->error_number,
                         AXIS2_ERROR_GET_MESSAGE(env->error));
 		system_exit(allocator, env, -1);
 		
 	}
 	printf("Started Simple Axis2 HTTP Server ...\n");
-	AXIS2_TRANSPORT_RECEIVER_START(server, &env);
+	if(AXIS2_TRANSPORT_RECEIVER_START(server, &env) == AXIS2_FAILURE)
+	{
+		AXIS2_LOG_ERROR(env->log, LOG_SI, "Server start failed: Error code:"
+						" %d :: %s", env->error->error_number,
+                        AXIS2_ERROR_GET_MESSAGE(env->error));
+		system_exit(allocator, env, -1);
+	}
 	return 0;
 }
 
@@ -136,10 +142,14 @@
     fprintf(stdout, " [-r REPO_PATH]");
     fprintf(stdout, " [-l LOG_LEVEL]\n");
     fprintf(stdout, " Options :\n");
-    fprintf(stdout, "\t-p PORT \t use the port number PORT. The default port is 9090\n");
-    fprintf(stdout, "\t-r REPO_PATH \t use the repository path REPO_PATH. The default repository path is ../\n");
-    fprintf(stdout, "\t-t SOCKET_READ_TIMEOUT\t set socket read timeout to SOCKET_READ_TIMEOUT. Default timeout is 30 seconds\n");
-    fprintf(stdout, "\t-l LOG_LEVEL\t set log level to LOG_LEVEL. Available log levels range from 0(critical only) to 4(debug).\n\t\t\t Default log level is 4(debug)\n");
+    fprintf(stdout, "\t-p PORT \t use the port number PORT. The default port is"
+						" 9090\n");
+    fprintf(stdout, "\t-r REPO_PATH \t use the repository path REPO_PATH. The"
+						" default repository path is ../\n");
+    fprintf(stdout, "\t-t SOCKET_READ_TIMEOUT\t set socket read timeout to "
+						"SOCKET_READ_TIMEOUT. Default timeout is 30 seconds\n");
+    fprintf(stdout, "\t-l LOG_LEVEL\t set log level to LOG_LEVEL. Available "
+						"log levels range from 0(critical only) to 4(debug)."
+						"\n\t\t\t Default log level is 4(debug)\n");
     fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
 }
-