super(settings, client);
controller.registerHandler(GET, "/{index}/{type}/{id}", this);
}
@Override public void handleRequest(final RestRequest request, final RestChannel channel) {
final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
// no need to have a threaded listener since we just send back a response
getRequest.listenerThreaded(false);
// if we have a local operation, execute it on a thread since we don't spawn
getRequest.operationThreaded(true);
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
getRequest.routing(request.param("routing"));
getRequest.preference(request.param("preference"));
getRequest.realtime(request.paramAsBoolean("realtime", null));
String sField = request.param("fields");
if (sField != null) {
String[] sFields = Strings.splitStringByCommaToArray(sField);
if (sFields != null) {
getRequest.fields(sFields);
}
}
client.get(getRequest, new ActionListener<GetResponse>() {