The error message thrown out is as follows. Please note the
error message did not happened immediately after the call, in
fact I have to wait for a few seconds before it appear.
k\dfs\initiation\servlet.properties
servletrunner starting with settings:
port = 8080
backlog = 50
max handlers = 100
timeout = 5000
servlet dir = d:\hanabank\dfs\initiation
document dir = .\examples
servlet propfile =
d:\hanabank\dfs\initiation\servlet.properties
Picture: init
java.net.SocketException: Connection reset by peer
at java.net.SocketInputStream.read
(SocketInputStream.java:84)
at sun.servlet.http.HttpInputStream.fill
(HttpInputStream.java:346)
at sun.servlet.http.HttpInputStream.readLine(Compiled
Code)
at sun.servlet.http.HttpRequestLine.readLine(Compiled
Code)
at sun.servlet.http.HttpRequestLine.parse
(HttpRequestLine.java:148)
at sun.servlet.http.HttpRequest.next(Compiled Code)
at sun.servlet.http.HttpRequest.next(Compiled Code)
at sun.servlet.http.HttpServerHandler.handleConnection
(Compiled Code)
at sun.servlet.http.HttpServerHandler.run(Compiled Code)
at java.lang.Thread.run(Thread.java:466)
Would appreciate very much for help over here.
My program is as follows.
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.awt.*;
import Acme.JPM.Encoders.GifEncoder;
public class Picture extends HttpServlet {
Frame frame = null;
Graphics g = null;
public void doGet (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException {
process (req, res);
}
public void doPost (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException {
process (req, res);
}
public void process (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException {
ServletOutputStream out = res.getOutputStream ();
try {
frame = new Frame ();
frame.addNotify ();
Image image = frame.createImage (400,60);
g = image.getGraphics ();
g.drawString ("Hello world", 10,50);
res.setContentType ("image/gif");
GifEncoder encoder = new GifEncoder
(image, out);
encoder.encode ();
} finally {
if (g != null) g.dispose ();
if (frame != null) frame.removeNotify();
}
}
}