java.lang.Object
org.cometd.common.AbstractTransport
- All Implemented Interfaces:
Transport
- Direct Known Subclasses:
AbstractServerTransport
,ClientTransport
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractTransport
(String name, Map<String, Object> options) -
Method Summary
Modifier and TypeMethodDescriptiongetName()
Returns an option value for the given option name, searching the option name tree.boolean
Get option or default value.int
Get option or default value.long
Get option or default value.Get option or default value.Specifies an option prefix made of string segments separated by the "."void
Sets the option value with the given name.void
setOptionPrefix
(String prefix) Set the option name prefix segment.
-
Constructor Details
-
AbstractTransport
-
-
Method Details
-
getName
-
getOption
Returns an option value for the given option name, searching the option name tree. The option map is searched for the option name with the most specific prefix. If this transport was initialized with a call to:setOptionPrefix("long-polling.jsonp");
then a call to getOption("foobar") will look for the most specific value with names:long-polling.json.foobar long-polling.foobar foobar
-
setOption
Sets the option value with the given name. The option name is inspected to see whether it starts with theoption prefix
; if it does not, the option prefix is prepended to the given name.- Parameters:
name
- the option name to set the value for.value
- the value of the option.
-
getOptionPrefix
Description copied from interface:Transport
Specifies an option prefix made of string segments separated by the "." character, used to override more generic configuration entries.- Specified by:
getOptionPrefix
in interfaceTransport
- Returns:
- the option prefix for this transport.
-
setOptionPrefix
Set the option name prefix segment.Normally this is called by the super class constructors to establish a naming hierarchy for options and iteracts with the
setOption(String, Object)
method to create a naming hierarchy for options. For example the following sequence of calls:setOption("foo","x"); setOption("bar","y"); setOptionPrefix("long-polling"); setOption("foo","z"); setOption("whiz","p"); setOptionPrefix("long-polling.jsonp"); setOption("bang","q"); setOption("bar","r");
will establish the following option names and values:foo: x bar: y long-polling.foo: z long-polling.whiz: p long-polling.jsonp.bang: q long-polling.jsonp.bar: r
The variousgetOption(String)
methods will search this name tree for the most specific match.- Parameters:
prefix
- the prefix name- Throws:
IllegalArgumentException
- if the new prefix is not prefixed by the old prefix.
-
getOptionNames
- Specified by:
getOptionNames
in interfaceTransport
- Returns:
- the set of configuration options
- See Also:
-
getOption
-
getOption
Get option or default value.- Parameters:
option
- The option name.dftValue
- The default value.- Returns:
- option or default value
- See Also:
-
getOption
Get option or default value.- Parameters:
option
- The option name.dftValue
- The default value.- Returns:
- option or default value
- See Also:
-
getOption
Get option or default value.- Parameters:
option
- The option name.dftValue
- The default value.- Returns:
- option or default value
- See Also:
-