net.noderunner.http
Class HttpVersion

java.lang.Object
  extended by net.noderunner.http.HttpVersion

public class HttpVersion
extends java.lang.Object

This represents an HTTP-Version data object, as found in RFC 2616. It is immutable.


Field Summary
static java.lang.String HTTP_VERSION_BEGIN
          The string HTTP/.
static HttpVersion HTTP10
          Represents HTTP version 1.0
static HttpVersion HTTP11
          Represents HTTP version 1.1
 
Constructor Summary
HttpVersion(int major, int minor)
          Constructs a HttpVersionImpl out of version number parts.
HttpVersion(java.lang.String line)
          Constructs a HttpVersionImpl out of a parsable String.
 
Method Summary
 boolean equals(java.lang.Object other)
          Returns true if the other object is an HttpVersion with the same minor and major versions.
 int getMajorVersion()
          Returns the major version number in use.
 int getMinorVersion()
          Returns the minor version number in use.
 int hashCode()
          Returns the hashcode.
static HttpVersion parseVersion(java.lang.String version)
          Based on the string supplied, returns either HttpVersion.HTTP10 or HttpVersion.HTTP11 or a newly constructed HttpVersion instance.
 java.lang.String toString()
          Returns
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

HTTP11

public static final HttpVersion HTTP11
Represents HTTP version 1.1


HTTP10

public static final HttpVersion HTTP10
Represents HTTP version 1.0


HTTP_VERSION_BEGIN

public static final java.lang.String HTTP_VERSION_BEGIN
The string HTTP/.

See Also:
Constant Field Values
Constructor Detail

HttpVersion

public HttpVersion(java.lang.String line)
            throws HttpException
Constructs a HttpVersionImpl out of a parsable String.

Throws:
HttpException

HttpVersion

public HttpVersion(int major,
                   int minor)
Constructs a HttpVersionImpl out of version number parts.

Method Detail

parseVersion

public static HttpVersion parseVersion(java.lang.String version)
                                throws HttpException
Based on the string supplied, returns either HttpVersion.HTTP10 or HttpVersion.HTTP11 or a newly constructed HttpVersion instance.

Throws:
HttpException

getMinorVersion

public int getMinorVersion()
Returns the minor version number in use.


getMajorVersion

public int getMajorVersion()
Returns the major version number in use.


toString

public java.lang.String toString()
Returns
HTTP_VERSION_BEGIN + getMinorVersion() + '.' + getMajorVersion()

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Returns true if the other object is an HttpVersion with the same minor and major versions.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns the hashcode.

Overrides:
hashCode in class java.lang.Object


Copyright © 2009. All Rights Reserved.