Package com.github.scribejava.core.model
Class Response
java.lang.Object
com.github.scribejava.core.model.Response
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getBody()
Returns the response body as a string, closing the stream that backs it.int
getCode()
Obtains the HTTP status codeObtains a single HTTP Header value, or null if undefinedObtains aMap
containing the HTTP Response HeadersObtains the HTTP status message.Obtains the meaningful stream of the HttpUrlConnection, either inputStream or errorInputStream, depending on the status codeboolean
toString()
-
Constructor Details
-
Response
-
Response
-
-
Method Details
-
isSuccessful
public boolean isSuccessful() -
getBody
Returns the response body as a string, closing the stream that backs it. Idempotent.- Returns:
- body as string
- Throws:
IOException
- IO Exception
-
getStream
Obtains the meaningful stream of the HttpUrlConnection, either inputStream or errorInputStream, depending on the status code- Returns:
- input stream / error stream
-
getCode
public int getCode()Obtains the HTTP status code- Returns:
- the status code
-
getMessage
Obtains the HTTP status message. Returnsnull
if the message can not be discerned from the response (not valid HTTP)- Returns:
- the status message
-
getHeaders
Obtains aMap
containing the HTTP Response Headers- Returns:
- headers
-
getHeader
Obtains a single HTTP Header value, or null if undefined- Parameters:
name
- the header name.- Returns:
- header value or null.
-
toString
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-