FileDocCategorySizeDatePackage
KeepAlive.javaAPI DocExample867Tue Jan 25 10:45:14 GMT 2000None

KeepAlive

public class KeepAlive extends HttpServlet

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)


    res.setContentType("text/html");

    // Set up a PrintStream built around a special output stream
    ByteArrayOutputStream bytes = new ByteArrayOutputStream(1024);
    PrintWriter out = new PrintWriter(bytes, true);  // true forces flushing

    out.println("<HTML>");
    out.println("<HEAD><TITLE>Hello World</TITLE></HEAD>");
    out.println("<BODY>");
    out.println("<BIG>Hello World</BIG>");
    out.println("</BODY></HTML>");

    // Set the content length to the size of the buffer
    res.setContentLength(bytes.size());

    // Send the buffer
    bytes.writeTo(res.getOutputStream());