Class BaseResponse

  • All Implemented Interfaces:
    Response

    public class BaseResponse
    extends java.lang.Object
    implements Response
    Author:
    Maksim Tkachenko, Truong Quoc Tuan, Ween Jiann Lee
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseResponse​(int statusCode, java.lang.String baseUrl, byte[] content, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] headers, org.apache.http.HttpHost proxy)
      Constructs a base response.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getBaseUrl()
      Returns the base form of the url used in this request.
      byte[] getContent()
      Returns raw content of the response.
      org.apache.http.entity.ContentType getContentType()
      Returns the content type of the content fetched.
      org.apache.http.Header[] getHeaders()
      Returns the headers that were used to trigger this response.
      org.apache.http.HttpHost getProxy()
      Returns the proxy that was used to trigger this response.
      int getStatusCode()
      Returns status code of the response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BaseResponse

        public BaseResponse​(int statusCode,
                            java.lang.String baseUrl,
                            byte[] content,
                            org.apache.http.entity.ContentType contentType,
                            org.apache.http.Header[] headers,
                            org.apache.http.HttpHost proxy)
        Constructs a base response.
        Parameters:
        statusCode - Status code of the response
        baseUrl - Base url of the response
        content - Content from the response
        contentType - Content type of the response
        headers - Headers from the response
        proxy - Proxy used to obtain the response
    • Method Detail

      • getStatusCode

        public final int getStatusCode()
        Description copied from interface: Response
        Returns status code of the response.
        Specified by:
        getStatusCode in interface Response
        Returns:
        int code
      • getContent

        public final byte[] getContent()
        Description copied from interface: Response
        Returns raw content of the response.
        Specified by:
        getContent in interface Response
        Returns:
        byte[] content
      • getContentType

        public final org.apache.http.entity.ContentType getContentType()
        Description copied from interface: Response
        Returns the content type of the content fetched.

        This is provided by the server or guessed by the server or an amalgamation of both.

        Specified by:
        getContentType in interface Response
        Returns:
        an instance of ContentType
      • getHeaders

        public final org.apache.http.Header[] getHeaders()
        Description copied from interface: Response
        Returns the headers that were used to trigger this response.
        Specified by:
        getHeaders in interface Response
        Returns:
        an array of headers
      • getBaseUrl

        public final java.lang.String getBaseUrl()
        Description copied from interface: Response
        Returns the base form of the url used in this request.
        Specified by:
        getBaseUrl in interface Response
        Returns:
        stripped down version of requested url
      • getProxy

        public final org.apache.http.HttpHost getProxy()
        Description copied from interface: Response
        Returns the proxy that was used to trigger this response.
        Specified by:
        getProxy in interface Response
        Returns:
        proxy used