| java.lang.Object org.apache.http.ProtocolVersion
All known Subclasses: org.apache.http.HttpVersion,
ProtocolVersion | public class ProtocolVersion implements Serializable,Cloneable(Code) | | Represents a protocol version, as specified in RFC 2616.
RFC 2616 specifies only HTTP versions, like "HTTP/1.1" and "HTTP/1.0".
RFC 3261 specifies a message format that is identical to HTTP except
for the protocol name. It defines a protocol version "SIP/2.0".
There are some nitty-gritty differences between the interpretation
of versions in HTTP and SIP. In those cases, HTTP takes precedence.
This class defines a protocol version as a combination of
protocol name, major version number, and minor version number.
Note that
ProtocolVersion.equals and
ProtocolVersion.hashCode are defined as
final here, they cannot be overridden in derived classes.
author: Oleg Kalnichevski author: Roland Weber version: $Revision: 609106 $ |
Constructor Summary | |
public | ProtocolVersion(String protocol, int major, int minor) Create a protocol version designator. |
major | final protected int major(Code) | | Major version number of the protocol
|
minor | final protected int minor(Code) | | Minor version number of the protocol
|
protocol | final protected String protocol(Code) | | Name of the protocol.
|
ProtocolVersion | public ProtocolVersion(String protocol, int major, int minor)(Code) | | Create a protocol version designator.
Parameters: protocol - the name of the protocol, for example "HTTP" Parameters: major - the major version number of the protocol Parameters: minor - the minor version number of the protocol |
compareToVersion | public int compareToVersion(ProtocolVersion that)(Code) | | Compares this protocol version with another one.
Only protocol versions with the same protocol name can be compared.
This method does not define a total ordering, as it would be
required for
java.lang.Comparable .
Parameters: that - the protocl version to compare with a negative integer, zero, or a positive integeras this version is less than, equal to, or greater thanthe argument version. throws: IllegalArgumentException - if the argument has a different protocol name than this object,or if the argument is null |
equals | final public boolean equals(Object obj)(Code) | | Checks equality of this protocol version with an object.
The object is equal if it is a protocl version with the same
protocol name, major version number, and minor version number.
The specific class of the object is not relevant,
instances of derived classes with identical attributes are
equal to instances of the base class and vice versa.
Parameters: obj - the object to compare with true if the argument is the same protocol version,false otherwise |
forVersion | public ProtocolVersion forVersion(int major, int minor)(Code) | | Obtains a specific version of this protocol.
This can be used by derived classes to instantiate themselves instead
of the base class, and to define constants for commonly used versions.
The default implementation in this class returns this
if the version matches, and creates a new
ProtocolVersion otherwise.
Parameters: major - the major version Parameters: minor - the minor version a protocol version with the same protocol nameand the argument version |
getMajor | final public int getMajor()(Code) | | Returns the major version number of the protocol.
the major version number. |
getMinor | final public int getMinor()(Code) | | Returns the minor version number of the HTTP protocol.
the minor version number. |
getProtocol | final public String getProtocol()(Code) | | Returns the name of the protocol.
the protocol name |
hashCode | final public int hashCode()(Code) | | Obtains a hash code consistent with
ProtocolVersion.equals .
the hashcode of this protocol version |
toString | public String toString()(Code) | | Converts this protocol version to a string.
a protocol version string, like "HTTP/1.1" |
|
|