public class PingPage extends WebPage {
public PingPage() {
getRequestCycle().setRequestTarget(new IRequestTarget() {
public void detach(RequestCycle requestCycle) {}
public Object getLock(RequestCycle requestCycle) { return null; }
public void respond(RequestCycle requestCycle) {
WebResponse r = (WebResponse)requestCycle.getResponse();
r.setContentType( "text/plain" );
PrintStream printStream = new PrintStream(r.getOutputStream());
printStream.println("healthy");
}
});
}
}
This is a personal web page. Things said here do not represent the position of my employer.
Monday, July 20, 2009
Wicket:: how to output text (like a Servlet)
I wanted to output regular text, like a servlet, rather than an HTML - which is Wicket's default. This was to be used by a PingPage, to make sure the service is up and running. This is the way you can do that:
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment