Skip to content

Instantly share code, notes, and snippets.

@sreevatsanraman
Created December 2, 2015 06:03
Show Gist options
  • Save sreevatsanraman/85f7a20cb6e933d00c01 to your computer and use it in GitHub Desktop.
Save sreevatsanraman/85f7a20cb6e933d00c01 to your computer and use it in GitHub Desktop.
HTTP service serving /ping endpoint
// Set up Handlers for Ping
public class PingHandler extends AbstractHttpHandler {
@Path("/ping")
@GET
public void handleThePing(HttpRequest request, HttpResponder responder){
responder.sendString(HttpResponseStatus.OK, "OK");
}
}
// Setup HTTP service and add Handlers
NettyHttpService service = NettyHttpService.builder()
.setPort(7777)
.addHttpHandlers(ImmutableList.of(new PingHandler()))
.build();
// Start the HTTP service
service.startAndWait();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment