Created
December 2, 2015 06:03
-
-
Save sreevatsanraman/85f7a20cb6e933d00c01 to your computer and use it in GitHub Desktop.
HTTP service serving /ping endpoint
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
// 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