I am using http://www.eclipse.org/jetty/documentation/current/shutdown-handler.html as a guide to try to shut down my jetty server, but I'm getting java.net.SocketException: Unexpected end of file from server
when connection.getResponseCode();
is called and I don't know why. I'm using an xml configured server, so the way that the ShutdownHandler is added to the Handler chain is a little different, but it should be fine. I know that the ShutdownHandler is properly wired up to the handler chain because I used dumpAfterStartup to check if it was started.
The thing that I am most unsure of is the line: URL url = new URL("http://localhost:" + port + "/shutdown?token=" + shutdownCookie);
. I don't know what I'm supposed to put in the shutdownCookie field; the password specified in the ShutdownHandler, or the STOP key, or what. I've tried both the password and the STOP key with no luck. I'm using POST as my request method, but I tried PUT as well and it does not work either.
Please ask for more information as required.