public abstract class AbstractHttpCommandCodec extends java.lang.Object implements CommandCodec<HttpRequest>
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractHttpCommandCodec.CommandSpec |
Constructor and Description |
---|
AbstractHttpCommandCodec() |
Modifier and Type | Method and Description |
---|---|
void |
alias(java.lang.String commandName,
java.lang.String isAnAliasFor)
Allow commands to have aliases.
|
protected abstract java.util.Map<java.lang.String,?> |
amendParameters(java.lang.String name,
java.util.Map<java.lang.String,?> parameters) |
Command |
decode(HttpRequest encodedCommand)
Decodes a command.
|
protected void |
defineCommand(java.lang.String name,
AbstractHttpCommandCodec.CommandSpec spec) |
void |
defineCommand(java.lang.String name,
HttpMethod method,
java.lang.String pathPattern)
Defines a new command mapping.
|
protected static AbstractHttpCommandCodec.CommandSpec |
delete(java.lang.String path) |
HttpRequest |
encode(Command command)
Encodes a command.
|
protected static AbstractHttpCommandCodec.CommandSpec |
get(java.lang.String path) |
protected static AbstractHttpCommandCodec.CommandSpec |
post(java.lang.String path) |
public HttpRequest encode(Command command)
CommandCodec
encode
in interface CommandCodec<HttpRequest>
command
- the command to encode.protected abstract java.util.Map<java.lang.String,?> amendParameters(java.lang.String name, java.util.Map<java.lang.String,?> parameters)
public Command decode(HttpRequest encodedCommand)
CommandCodec
decode
in interface CommandCodec<HttpRequest>
encodedCommand
- the command to decode.public void defineCommand(java.lang.String name, HttpMethod method, java.lang.String pathPattern)
defineCommand
in interface CommandCodec<HttpRequest>
name
- The command name.method
- The HTTP method to use for the command.pathPattern
- The URI path pattern for the command. When encoding a command, each
path segment prefixed with a ":" will be replaced with the corresponding parameter
from the encoded command.public void alias(java.lang.String commandName, java.lang.String isAnAliasFor)
CommandCodec
alias
in interface CommandCodec<HttpRequest>
commandName
- The command being added.isAnAliasFor
- The command name that this is an alias for.protected void defineCommand(java.lang.String name, AbstractHttpCommandCodec.CommandSpec spec)
protected static AbstractHttpCommandCodec.CommandSpec delete(java.lang.String path)
protected static AbstractHttpCommandCodec.CommandSpec get(java.lang.String path)
protected static AbstractHttpCommandCodec.CommandSpec post(java.lang.String path)