Class HTTPResponse
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.remoteviz.rendering.HTTPResponse
-
- All Implemented Interfaces:
java.lang.Cloneable
public class HTTPResponse extends Inventor implements java.lang.Cloneable
This class encapsulates an HTTP response message. Used in theServiceListeneronHTTPRequest() method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHTTPResponse.HTTPStatusEnum for the HTTP status codes.-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description HTTPResponse()Creates a HTTP/1.1 response with "200 OK" status.HTTPResponse(HTTPResponse obj)Copy constructor.HTTPResponse(HTTPResponse.HTTPStatus statusCode)Creates a HTTP/1.1 response with the given status and a standard reason phrase.HTTPResponse(HTTPResponse.HTTPStatus statusCode, java.lang.String reason)Creates a HTTP/1.1 response with the given status and reason phrase.HTTPResponse(HTTPResponse.HTTPStatus statusCode, java.lang.String reason, java.lang.String body)Creates a HTTP/1.1 response with the given status, reason phrase and message body data.HTTPResponse(HTTPResponse.HTTPStatus statusCode, java.lang.String reason, java.lang.String body, int versionMajor, int versionMinor, HTTPHeaders headers)Creates a HTTP response with the given status, reason phrase, message body data, version and headers.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()java.lang.StringgetBody()Returns the HTTP message body data (optional).longgetContentLength()Returns the size of the body, in bytes (Content-Length entity header)HTTPHeadersgetHeaders()Returns HTTP headers.java.lang.StringgetReason()Returns the HTTP reason phrase.static java.lang.StringgetReasonPhrase(HTTPResponse.HTTPStatus status)Returns the standard HTTP reason phrase for a HTTP status code.HTTPResponse.HTTPStatusgetStatusCode()Returns the HTTP status.java.lang.StringgetVersion()Returns the HTTP version for incoming request (example "HTTP/1.1").intgetVersionMajor()HTTP uses a "major.minor" numbering scheme to indicate versions of the protocol.intgetVersionMinor()HTTP uses a "major.minor" numbering scheme to indicate versions of the protocol.-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Constructor Detail
-
HTTPResponse
public HTTPResponse(HTTPResponse.HTTPStatus statusCode, java.lang.String reason, java.lang.String body, int versionMajor, int versionMinor, HTTPHeaders headers)
Creates a HTTP response with the given status, reason phrase, message body data, version and headers.
-
HTTPResponse
public HTTPResponse()
Creates a HTTP/1.1 response with "200 OK" status.
-
HTTPResponse
public HTTPResponse(HTTPResponse.HTTPStatus statusCode, java.lang.String reason, java.lang.String body)
Creates a HTTP/1.1 response with the given status, reason phrase and message body data.
-
HTTPResponse
public HTTPResponse(HTTPResponse obj)
Copy constructor.
-
HTTPResponse
public HTTPResponse(HTTPResponse.HTTPStatus statusCode, java.lang.String reason)
Creates a HTTP/1.1 response with the given status and reason phrase.
-
HTTPResponse
public HTTPResponse(HTTPResponse.HTTPStatus statusCode)
Creates a HTTP/1.1 response with the given status and a standard reason phrase.
-
-
Method Detail
-
clone
public java.lang.Object clone()
-
getHeaders
public HTTPHeaders getHeaders()
Returns HTTP headers.
-
getVersionMinor
public int getVersionMinor()
HTTP uses a "major.minor" numbering scheme to indicate versions of the protocol. Returns the version minor.
-
getContentLength
public long getContentLength()
Returns the size of the body, in bytes (Content-Length entity header)
-
getVersionMajor
public int getVersionMajor()
HTTP uses a "major.minor" numbering scheme to indicate versions of the protocol. Returns the version major.
-
getVersion
public java.lang.String getVersion()
Returns the HTTP version for incoming request (example "HTTP/1.1").
-
getReasonPhrase
public static java.lang.String getReasonPhrase(HTTPResponse.HTTPStatus status)
Returns the standard HTTP reason phrase for a HTTP status code.
-
getStatusCode
public HTTPResponse.HTTPStatus getStatusCode()
Returns the HTTP status.
-
getBody
public java.lang.String getBody()
Returns the HTTP message body data (optional). Returns an empty string if the response does not have a body message.
-
getReason
public java.lang.String getReason()
Returns the HTTP reason phrase.
-
-