voldemort.rest.server
Class RestServerRequestHandler
java.lang.Object
org.jboss.netty.channel.SimpleChannelUpstreamHandler
voldemort.rest.AbstractRestRequestHandler
voldemort.rest.server.RestServerRequestHandler
- All Implemented Interfaces:
- org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler
public class RestServerRequestHandler
- extends AbstractRestRequestHandler
Class to handle a REST request and send response back to the client
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler |
org.jboss.netty.channel.ChannelHandler.Sharable |
Method Summary |
protected Store<ByteArray,byte[],byte[]> |
getStore(java.lang.String name,
RequestRoutingType type)
Gets the store for the store name and routing type. |
protected int |
parseZoneId()
Retrieve and validate the zone id value from the REST request. |
protected void |
registerRequest(RestRequestValidator requestValidator,
org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent messageEvent)
Constructs a valid request and passes it on to the next handler. |
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler |
channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RestServerRequestHandler
public RestServerRequestHandler()
RestServerRequestHandler
public RestServerRequestHandler(StoreRepository storeRepository)
getStore
protected Store<ByteArray,byte[],byte[]> getStore(java.lang.String name,
RequestRoutingType type)
- Gets the store for the store name and routing type. At this point we
already know that the routing type is valid . So we dont throw Voldemort
Exception for unknown routing type.
- Parameters:
name
- - store nametype
- - routing type from the request
- Returns:
parseZoneId
protected int parseZoneId()
- Retrieve and validate the zone id value from the REST request.
"X-VOLD-Zone-Id" is the zone id header.
- Returns:
- valid zone id or -1 if there is no/invalid zone id
registerRequest
protected void registerRequest(RestRequestValidator requestValidator,
org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent messageEvent)
- Constructs a valid request and passes it on to the next handler. It also
creates the 'Store' object corresponding to the store name specified in
the REST request.
- Specified by:
registerRequest
in class AbstractRestRequestHandler
- Parameters:
requestValidator
- The Validator object used to construct the
request objectctx
- Context of the Netty channelmessageEvent
- Message Event used to write the response / exception
Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu