Class HTTPResponse

java.lang.Object
com.openinventor.inventor.Inventor
com.openinventor.remoteviz.rendering.HTTPResponse
All Implemented Interfaces:
Cloneable

public class HTTPResponse extends Inventor implements Cloneable
This class encapsulates an HTTP response message. Used in the ServiceListener onHTTPRequest() method.

  • Constructor Details

    • HTTPResponse

      public HTTPResponse(HTTPResponse.HTTPStatus statusCode, String reason, 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, String reason, 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, 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 Details

    • clone

      public 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 String getVersion()
      Returns the HTTP version for incoming request (example "HTTP/1.1").
    • getReasonPhrase

      public static 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 String getBody()
      Returns the HTTP message body data (optional). Returns an empty string if the response does not have a body message.
    • getReason

      public String getReason()
      Returns the HTTP reason phrase.