Created
December 21, 2012 11:37
-
-
Save katta/4352302 to your computer and use it in GitHub Desktop.
Custom REST handler for Elastic Search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.katta.es.http; | |
import org.elasticsearch.client.Client; | |
import org.elasticsearch.common.inject.Inject; | |
import org.elasticsearch.common.settings.Settings; | |
import org.elasticsearch.rest.*; | |
public class RestRegisterAction extends BaseRestHandler { | |
@Inject | |
protected RestRegisterAction(Settings settings, Client client, RestController controller) { | |
super(settings, client); | |
controller.registerHandler(RestRequest.Method.POST, "/register", this); | |
} | |
@Override | |
public void handleRequest(RestRequest request, RestChannel channel) { | |
String user = request.param("user"); | |
System.out.println(String.format("*********** REGISTERING USER %s ***********", user)); | |
channel.sendResponse(new StringRestResponse(RestStatus.OK, "registered")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment