geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pra...@apache.org
Subject svn commit: r599472 - /geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/NIOServlet.java
Date Thu, 29 Nov 2007 15:10:57 GMT
Author: prasad
Date: Thu Nov 29 07:10:57 2007
New Revision: 599472

URL: http://svn.apache.org/viewvc?rev=599472&view=rev
Log:
* golden (?)

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

Modified: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/NIOServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/NIOServlet.java?rev=599472&r1=599471&r2=599472&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/NIOServlet.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/NIOServlet.java
Thu Nov 29 07:10:57 2007
@@ -236,9 +236,11 @@
                 // Stick some object into the context
                 context.setAttribute(REQUEST_SENT, Boolean.TRUE);
 
+                /*
                 System.out.println("--------------");
                 System.out.println("Sending request with sessionId: " + (String)context.getAttribute(SESSION_ID));
                 System.out.println("--------------");
+                */
 
                 return new BasicHttpRequest("GET", (String)context.getAttribute(REMOTE_URI));
             }
@@ -252,16 +254,16 @@
             System.out.println("Handle response");
             HttpEntity entity = res.getEntity();
             try {
+                CometEvent event = (CometEvent)context.getAttribute(COMET);
                 String content = EntityUtils.toString(entity);
-
                 System.out.println("--------------");
                 System.out.println(res.getStatusLine());
                 System.out.println("--------------");
                 System.out.println("Document length: " + content.length());
                 System.out.println("--------------");
 
-                CometEvent event = (CometEvent)context.getAttribute(COMET);
                 HttpServletResponse response = event.getHttpServletResponse();
+                response.setStatus(res.getStatusLine().getStatusCode());
                 response.setContentType("text/html");
                 if ( content.length() > 0 ) {
                     response.setContentLength(content.length());
@@ -277,10 +279,11 @@
                         e.printStackTrace();
                     }
                 }
-                //System.out.println("  Responded to " + (String)context.getAttribute(SESSION_ID)
+ " in " + (new Date().getTime() - (long)context.getAttribute(TIME)));
-                System.out.println("  Responded to " + (String)context.getAttribute(SESSION_ID));
 
-                //event.close();
+                long initTime = ((Long)context.getAttribute(TIME)).longValue();
+                System.out.println("  Responded to " + (String)context.getAttribute(SESSION_ID)
+ " in " + (new Date().getTime() - initTime));
+
+                event.close();
             }
             catch ( IOException ex ) {
                 System.err.println("I/O error: " + ex.getMessage());



Mime
View raw message