handle rest HEAD on / path

This commit is contained in:
kimchy 2011-01-19 21:56:53 +02:00
parent b1d13febbf
commit 7359f7983f
1 changed files with 5 additions and 0 deletions

View File

@ -64,10 +64,15 @@ public class RestMainAction extends BaseRestHandler {
this.quotesSize = quotesSize; this.quotesSize = quotesSize;
controller.registerHandler(GET, "/", this); controller.registerHandler(GET, "/", this);
controller.registerHandler(HEAD, "/", this);
} }
@Override public void handleRequest(RestRequest request, RestChannel channel) { @Override public void handleRequest(RestRequest request, RestChannel channel) {
try { try {
if (request.method() == RestRequest.Method.HEAD) {
channel.sendResponse(new StringRestResponse(RestResponse.Status.OK));
return;
}
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request).prettyPrint(); XContentBuilder builder = RestXContentBuilder.restContentBuilder(request).prettyPrint();
builder.startObject(); builder.startObject();
builder.field("ok", true); builder.field("ok", true);