Skip to content

Instantly share code, notes, and snippets.

@sreevatsanraman
Created December 2, 2015 06:09
Show Gist options
  • Save sreevatsanraman/61591048677655795df9 to your computer and use it in GitHub Desktop.
Save sreevatsanraman/61591048677655795df9 to your computer and use it in GitHub Desktop.
PathRouting using netty
public class AppFabricRestHandler extends NettyRestHandler {
....
@Override
public void messageReceived(ChannelHandlerContext context, MessageEvent message) throws Exception {
HttpRequest request = (HttpRequest) message.getMessage();
HttpMethod method = request.getMethod();
String requestUri = request.getUri();
QueryStringDecoder decoder = new QueryStringDecoder(request.getUri());
String path = decoder.getPath();
if (path.equals("/deploy")) {
// Application deploy logic..
return;
}
if (path.equals("/ping")) {
// Respond to ping...
return;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment