Package org.openqa.selenium.remote.codec
Class AbstractHttpCommandCodec
- java.lang.Object
-
- org.openqa.selenium.remote.codec.AbstractHttpCommandCodec
-
- All Implemented Interfaces:
CommandCodec<org.openqa.selenium.remote.http.HttpRequest>
- Direct Known Subclasses:
JsonHttpCommandCodec
,W3CHttpCommandCodec
public abstract class AbstractHttpCommandCodec extends java.lang.Object implements CommandCodec<org.openqa.selenium.remote.http.HttpRequest>
A command codec that adheres to the W3C's WebDriver wire protocol.- See Also:
- W3C WebDriver spec
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractHttpCommandCodec.CommandSpec
-
Constructor Summary
Constructors Constructor Description AbstractHttpCommandCodec()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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(org.openqa.selenium.remote.http.HttpRequest encodedCommand)
Decodes a command.protected void
defineCommand(java.lang.String name, AbstractHttpCommandCodec.CommandSpec spec)
void
defineCommand(java.lang.String name, org.openqa.selenium.remote.http.HttpMethod method, java.lang.String pathPattern)
Defines a new command mapping.protected static AbstractHttpCommandCodec.CommandSpec
delete(java.lang.String path)
org.openqa.selenium.remote.http.HttpRequest
encode(Command command)
Encodes a command.protected static AbstractHttpCommandCodec.CommandSpec
get(java.lang.String path)
boolean
isSupported(java.lang.String commandName)
protected static AbstractHttpCommandCodec.CommandSpec
post(java.lang.String path)
-
-
-
Method Detail
-
isSupported
public boolean isSupported(java.lang.String commandName)
- Specified by:
isSupported
in interfaceCommandCodec<org.openqa.selenium.remote.http.HttpRequest>
- Returns:
- Whether this
CommandCodec
supports the given command name.
-
encode
public org.openqa.selenium.remote.http.HttpRequest encode(Command command)
Description copied from interface:CommandCodec
Encodes a command.- Specified by:
encode
in interfaceCommandCodec<org.openqa.selenium.remote.http.HttpRequest>
- Parameters:
command
- the command to encode.- Returns:
- the encoded command.
-
amendParameters
protected abstract java.util.Map<java.lang.String,?> amendParameters(java.lang.String name, java.util.Map<java.lang.String,?> parameters)
-
decode
public Command decode(org.openqa.selenium.remote.http.HttpRequest encodedCommand)
Description copied from interface:CommandCodec
Decodes a command.- Specified by:
decode
in interfaceCommandCodec<org.openqa.selenium.remote.http.HttpRequest>
- Parameters:
encodedCommand
- the command to decode.- Returns:
- the decoded command.
-
defineCommand
public void defineCommand(java.lang.String name, org.openqa.selenium.remote.http.HttpMethod method, java.lang.String pathPattern)
Defines a new command mapping.- Specified by:
defineCommand
in interfaceCommandCodec<org.openqa.selenium.remote.http.HttpRequest>
- Parameters:
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.
-
alias
public void alias(java.lang.String commandName, java.lang.String isAnAliasFor)
Description copied from interface:CommandCodec
Allow commands to have aliases.- Specified by:
alias
in interfaceCommandCodec<org.openqa.selenium.remote.http.HttpRequest>
- Parameters:
commandName
- The command being added.isAnAliasFor
- The command name that this is an alias for.
-
defineCommand
protected void defineCommand(java.lang.String name, AbstractHttpCommandCodec.CommandSpec spec)
-
delete
protected static AbstractHttpCommandCodec.CommandSpec delete(java.lang.String path)
-
get
protected static AbstractHttpCommandCodec.CommandSpec get(java.lang.String path)
-
post
protected static AbstractHttpCommandCodec.CommandSpec post(java.lang.String path)
-
-