geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pra...@apache.org
Subject svn commit: r574993 - in /geronimo/samples/trunk/samples/async-http: http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java http-remote-app/src/main/java/org/apache/geronimo/PageServlet.java
Date Wed, 12 Sep 2007 15:28:02 GMT
Author: prasad
Date: Wed Sep 12 08:28:01 2007
New Revision: 574993

URL: http://svn.apache.org/viewvc?rev=574993&view=rev
Log:
* reduce debug msgs.
* handle error 500 differently

Modified:
    geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
    geronimo/samples/trunk/samples/async-http/http-remote-app/src/main/java/org/apache/geronimo/PageServlet.java

Modified: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java?rev=574993&r1=574992&r2=574993&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
Wed Sep 12 08:28:01 2007
@@ -43,13 +43,12 @@
 	public void event(CometEvent event) throws IOException, ServletException {
 		HttpServletRequest request = event.getHttpServletRequest();
 
+		String cometId = request.getSession(true).getId();
 		System.out.println("");
-		System.out.println("Inside AsyncServlet.event() "
+		System.out.println("Session id: " + cometId + " "
 				+ event.getEventType().toString());
 
 		if (event.getEventType() == CometEvent.EventType.BEGIN) {
-			String cometId = request.getSession(true).getId();
-
 			Callback callback = new Callback(event);
 
 			if (request.getParameter("remoteUrl") != null){
@@ -63,7 +62,8 @@
 			HttpRequestMessage msgRequest = new HttpRequestMessage(remoteUri);
 			
 			// If the file being served has other URIs in it, like say images, 
-			// subsequent calls are made to the remote app. We don't want to set new delay times and
status codes then.
+			// subsequent calls are made to the remote app to retrieve those.
+			// We don't want to set new delay times and status codes then.
 			if (remoteUri.endsWith("page")) {
 				Integer[] params = generateRandomParams();
 				msgRequest.setParameter("sessionId", cometId);
@@ -73,6 +73,10 @@
                 System.out.println("sessionId:" + cometId + "; delay:"
 						+ params[0] + "; code:" + params[1]);
 			}
+			else {
+				System.out.println("msg request is " + msgRequest.getPath());
+			}
+			
 			msgRequest.setRequestMethod(HttpRequestMessage.REQUEST_GET);
 
 			URL url_connect = new URL(remoteUrl);
@@ -80,8 +84,7 @@
 			AsyncHttpClient ahc = new AsyncHttpClient(url_connect, callback, 1000, 1000);
 			try {
 				ahc.connect();
-				ahc.sendRequest(msgRequest);
-				System.out.println("msg request is " + msgRequest.getPath());
+				ahc.sendRequest(msgRequest);				
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();

Modified: geronimo/samples/trunk/samples/async-http/http-remote-app/src/main/java/org/apache/geronimo/PageServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-remote-app/src/main/java/org/apache/geronimo/PageServlet.java?rev=574993&r1=574992&r2=574993&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-remote-app/src/main/java/org/apache/geronimo/PageServlet.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-remote-app/src/main/java/org/apache/geronimo/PageServlet.java
Wed Sep 12 08:28:01 2007
@@ -52,13 +52,13 @@
 		case 404: response.sendError(HttpServletResponse.SC_NOT_FOUND);
 			break;
 
-		case 500:
-			try  { 
+		case 500: response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			/*try  { 
 				int test = 1/0;
 			} 
 			catch (Exception e) {
 					throw new ServletException("Servlet caught a ServletException: " + e.getMessage());

-			}			
+			}*/			
 			break;
 		}
 		



Mime
View raw message