Class Response

java.lang.Object
de.galan.commons.net.flux.Response
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
MockCommonHttpClient.MockResponse

public class Response extends Object implements AutoCloseable
Represents the reponse to a http service.
  • Constructor Details

  • Method Details

    • getStream

      public InputStream getStream()
    • getStreamAsBytearray

      public byte[] getStreamAsBytearray() throws IOException
      Converts the inputstream to a string in UTF-8. Subsequent the inputstream will be empty/closed.
      Throws:
      IOException
    • getStreamAsString

      public String getStreamAsString() throws IOException
      Converts the inputstream to a string in UTF-8. Subsequent the inputstream will be empty/closed.
      Throws:
      IOException
    • getStreamAsString

      public String getStreamAsString(String encoding) throws IOException
      Converts the inputstream to a string with the given encoding. Subsequent the inputstream will be empty/closed.
      Throws:
      IOException
    • getStreamAsString

      public String getStreamAsString(Charset charset) throws IOException
      Converts the inputstream to a string with the given encoding. Subsequent the inputstream will be empty/closed.
      Throws:
      IOException
    • storeStream

      public void storeStream(File file) throws FileNotFoundException, IOException
      Throws:
      FileNotFoundException
      IOException
    • storeStream

      public void storeStream(File file, boolean gunzip) throws FileNotFoundException, IOException
      Throws:
      FileNotFoundException
      IOException
    • getStatusCode

      public int getStatusCode()
    • getContentEncoding

      public String getContentEncoding()
    • getContentType

      public String getContentType()
    • isFailed

      public boolean isFailed()
      Returns true if the http status code is not between 200 and 299
    • isInformational

      public boolean isInformational()
      Returns true if the http status code is not between 100 and 199
    • isSucceded

      public boolean isSucceded()
      Returns true if the http status code is between 200 and 299
    • isRedirection

      public boolean isRedirection()
      Returns true if the http status code is between 300 and 399
    • isClientError

      public boolean isClientError()
      Returns true if the http status code is between 400 and 499
    • isServerError

      public boolean isServerError()
      Returns true if the http status code is between 500 and 599
    • getHeaderField

      public String getHeaderField(String name)
    • getHeaderFields

      public Map<String,String> getHeaderFields()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable