Thanks for your reply.  But that was not the reason of my problem. I
tried to write a servlet beeing as simple as possible:

package de.medigration.telechiv.UI_Servlets;

/*
 * Imports
 */
import java.io.*;
import java.util.Date;
import javax.servlet.*;
import javax.servlet.http.*;

public class MessageServlet extends HttpServlet
                        implements SingleThreadModel {
    private
        ServletConfig config;

    public void init (ServletConfig config)
        throws ServletException {
            this.config = config;
    }

    public void destroy() {} // do nothing

    public ServletConfig getServletConfig() {
        return config;
    }

    public String getServletInfo() {
        return "User Interface Servlet";
    }


    public void doPost (HttpServletRequest req,    HttpServletResponse
res)
        throws ServletException, IOException {

            /* Create Output Writer */
            res.setContentType( "text/html" );
            ByteArrayOutputStream outBuffer = new ByteArrayOutputStream
(255);
            PrintWriter out = new PrintWriter(outBuffer, true);

            /* Write Head of HTML-Page */
            out.println( "<html>" );
            out.println( "<head>" );
            out.println( "<title> Message </title>" );
            out.println( "</head>" );

            out.println( "<body>" );

            out.println( "Hello World!" );

            out.println( "</body>" );
            out.println( "</html>" );

            res.setContentLength(outBuffer.size());
            outBuffer.writeTo(res.getOutputStream());
            out.close();
    }
}


> -----Ursprüngliche Nachricht-----
> Von:  Ross J.P. Ethier [SMTP:[EMAIL PROTECTED]]
> Gesendet am:  Dienstag, 6. April 1999 08:35
> An:   Java-Servlets
> Betreff:      Re: Repy time of the HTML POST command
> 
> Its hard to determine why your page takes so long.  Perhaps providing
the
> source may help.
> 
> A performance tip is to use a StringBuffer to append the html instead
of
> using the '+' operand.
> 
> instead of  
>       out.println( "<html>" + "<body>" + "hello" + "</body>" +
"</html>");
> use 
>       out.println( new StringBuffer("<html>").append("<body>"
> ).append("hello").append("</body>" ).append("</html>").toString());
> 
> Internally the JVM turns every '+' call into a two part StringBuffer
which
> can be expensive.
> 
> Good Luck
> Ross
> 
> At 05:00 PM 3/31/99 +0200, you wrote:
> >Hello,
> >
> >I wrote a servlet which is started as a 'startup servlet' (I proved,
> >that it is initialized only once!). This servlet is invoked by a HTML
> >POST command from a browser (HTML form). It generates a new HTML page
> >using the 'PrintWriter'-class. My problem:
> >
> >IT LASTS 5 SECONDS FROM SUBMITTING THE FORM TO GETTING THE RESPONSE.
> >(Although browser and server are running on the same PC)
> >
> >Is this an usual delay? How can I get a better performance?
> >
> >(I used the APACHE1.3.4 server , ApacheJServ1.0b1 and JSDK 2.0 with
> >WindowsNT 4.0)
> >
> >Best regards
> >
> >Burkhard Schaefer
> >
> >
> >____________________________________________________________
> >
> >Medigration GmbH                     Tel.: (++49) 09131-690-87-47
> >Am Weichselgarten 7                  Fax: (++49) 09131-690-8750
> >D-91058 Erlangen                     www.medigration.de
> >GERMANY
> >
> >
> >------------------------------------------------------------
> >To subscribe:    [EMAIL PROTECTED]
> >To unsubscribe:  [EMAIL PROTECTED]
> >Problems?:       [EMAIL PROTECTED]
> > 
> 
> 
> 
> ------------------------------------------------------------
> To subscribe:    [EMAIL PROTECTED]
> To unsubscribe:  [EMAIL PROTECTED]
> Problems?:       [EMAIL PROTECTED]


------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Problems?:       [EMAIL PROTECTED]

Reply via email to