[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jetty-users] Handler in XML?
|
Hi!
I am a jetty newbie and wrote a simple server with one handler.
For project reasons, we would like to have it defined in an XML file.
We use jetty 6.1.18 and the code is:
///// start quote
jettyServer = new Server(8288);
jettyServer.setHandler(new AbstractHandler() {
public void handle(String target, HttpServletRequest request,
HttpServletResponse response, int i) throws IOException,
ServletException {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
Request base_request = request instanceof Request ? (Request) request
: HttpConnection.getCurrentConnection().getRequest();
response.getWriter().println("some fixed string");
}
});
jettyServer.start();
//////// end quote
Is it possible to express this as a jetty XML config file?
I does not need to be exactly equivalent, we just need a response
with a specified string for a request (any request URL is OK,
for now).
Other thing: is this a good way to end the server?
jettyServer.stop();
jettyServer.join();
Regards,
David