public class AbstractTransport extends Object implements Transport
Modifier | Constructor and Description |
---|---|
protected |
AbstractTransport(String name,
Map<String,Object> options) |
Modifier and Type | Method and Description |
---|---|
String |
getName() |
Object |
getOption(String name)
Returns an option value for the given option name, searching the option name tree.
|
boolean |
getOption(String option,
boolean dftValue)
Get option or default value.
|
int |
getOption(String option,
int dftValue)
Get option or default value.
|
long |
getOption(String option,
long dftValue)
Get option or default value.
|
String |
getOption(String option,
String dftValue)
Get option or default value.
|
Set<String> |
getOptionNames() |
String |
getOptionPrefix()
Specifies an option prefix made of string segments separated by the "."
|
void |
setOption(String name,
Object value)
Sets the option value with the given name.
|
void |
setOptionPrefix(String prefix)
Set the option name prefix segment.
|
public String getName()
getName
in interface Transport
Bayeux.getAllowedTransports()
public Object getOption(String name)
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
getOption
in interface Transport
name
- the option name to return the value for.qualifiedName
Transport.getOptionNames()
public void setOption(String name, Object value)
option prefix
;
if it does not, the option prefix is prepended to the given name.name
- the option name to set the value for.value
- the value of the option.public String getOptionPrefix()
Transport
getOptionPrefix
in interface Transport
public void setOptionPrefix(String prefix)
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: rThe various
getOption(String)
methods will search this
name tree for the most specific match.prefix
- the prefix nameIllegalArgumentException
- if the new prefix is not prefixed by the old prefix.public Set<String> getOptionNames()
getOptionNames
in interface Transport
Transport.getOption(String)
public String getOption(String option, String dftValue)
option
- The option name.dftValue
- The default value.getOption(String)
public long getOption(String option, long dftValue)
option
- The option name.dftValue
- The default value.getOption(String)
public int getOption(String option, int dftValue)
option
- The option name.dftValue
- The default value.getOption(String)
public boolean getOption(String option, boolean dftValue)
option
- The option name.dftValue
- The default value.getOption(String)
Copyright © 2008–2024 The CometD Project. All rights reserved.