I’m new to Jetty, and I tried to run the example for “HelloWorld”
public class HelloWorld extends AbstractHandler
{
public void handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
response.getWriter().println("<h1>Hello World</h1>");
}
public static void main(String[] args) throws Exception
{
Server server = new Server(8080);
server.setHandler(new HelloWorld());
server.start();
server.join();
}
}
and the “Hello World” does shows on the JSP page in my localhost:8080. But I’m not able to change any content inside, or even stop the server. What can I do with this?
I solve the problem. Cuz I run it in my eclipse, so I need to stop the server that created from eclipse, and the only way to kill the server is go to the tast manager, and end all the java program. thanks!