geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pra...@apache.org
Subject svn commit: r575054 - /geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
Date Wed, 12 Sep 2007 19:58:38 GMT
Author: prasad
Date: Wed Sep 12 12:58:38 2007
New Revision: 575054

URL: http://svn.apache.org/viewvc?rev=575054&view=rev
Log:
* cleaned up the code in BlockingServlet

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

Modified: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java?rev=575054&r1=575053&r2=575054&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
Wed Sep 12 12:58:38 2007
@@ -63,30 +63,22 @@
 		String url_string = remoteUrl + remoteUri + "?sessionId=" + sessionId + "&delay=" +
params[0] + "&code=" + params[1];		
 		URL url_connect = new URL(url_string);
 		
-		response.setContentType("text/html");
-		PrintWriter out = response.getWriter();
 		try {
 			BufferedReader input = new BufferedReader(new InputStreamReader(url_connect.openStream()));
 			String line = "";						
+			response.setContentType("text/html");
+			PrintWriter out = response.getWriter();			
 			while ((line = input.readLine()) != null) {				
 				out.println(line);
 			}
-			out.flush();			
+			out.flush();
+			out.close();
 			input.close();
 		}
-		catch(IOException ex) {			
-			out.println ("<html>");
-			out.println("<title>Error" + params[1] + "</title>");
-			out.println("<body bgcolor=FFFFFF>");
-
-			out.println("<h2>Error " + params[1] + "</h2>");
-			
-			out.println("</body>");
-			out.println("</html>");					
-		}
-		finally {
-			out.close();
+		catch(IOException ex) {
+			response.sendError(params[1].intValue());			
 		}
+		
 
 		System.out.println("doGet processed");
 	}



Mime
View raw message