Recently there was a discussion about the servlet reloading mechanism in
java web servers.
At the time I felt comfortable with the mechanism, but have recently
discovered a feature that I do not understand.
I have a basic servlet that ONLY overrides doGet(). When called the servlet
responds correctly. If I alter and recompile the servlet - and do not
restart the server - again the servlet responds correctly with the
alteration.
However, if I also override init() then the mechanism falls apart. The
below example servlet will work correctly the first time it is compiled.
However, when an alteration is made (e.g. in doGet()) the server fails to
reload the servlet correctly.
Can anyone shed some light on what is happening internally?
Much appretiated,
Andy Phelps
== example follows ==
package test;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Output extends HttpServlet {
int testInt;
public void init(ServletConfig config){
testInt = 0;
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("Test output<BR>"); // change this output, compile and
load = exception
out.println("counter = " + testInt++);
}
}
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.