1 16 17 package org.apache.tester; 18 19 20 import java.io.*; 21 import java.util.*; 22 import javax.servlet.*; 23 import javax.servlet.http.*; 24 25 26 32 33 public class SetBufferSize01 extends GenericServlet { 34 35 36 38 39 48 public void service(ServletRequest request, ServletResponse response) 49 throws IOException, ServletException { 50 51 response.setContentType("text/plain"); 52 PrintWriter writer = response.getWriter(); 53 try { 54 writer.print("SetBufferSize01 "); 55 response.flushBuffer(); 56 response.setBufferSize(100); 57 writer.println("FAILED - Did not throw IllegalStateException"); 58 } catch (IllegalStateException e) { 59 writer.println("PASSED"); 60 } catch (IOException e) { 61 writer.println("FAILED - flushBuffer() threw IOException"); 62 throw e; 63 } 64 while (true) { 65 String message = StaticLogger.read(); 66 if (message == null) 67 break; 68 writer.println(message); 69 } 70 StaticLogger.reset(); 71 72 } 73 74 75 } 76 | Popular Tags |