@ParametersAreNonnullByDefault @ThreadSafe public class BasicHttpResult extends Object
Modifier and Type | Field and Description |
---|---|
protected byte[] |
body
THe HTTP response body, if there was one.
|
protected IOException |
exception
If a local IOException was encountered, this will be set to it.
|
protected String |
message
The HTTP response message, or the Exception message if a local exception was encountered.
|
protected int |
status
The HTTP response status code, or -1 if a local exception was encountered.
|
protected boolean |
success
If the HTTP request that caused this result was successful.
|
Modifier and Type | Method and Description |
---|---|
boolean |
causedByException()
Returns true if this result represents a failure due to a local IOException.
|
static BasicHttpResult |
create(org.apache.http.HttpResponse response,
IntPredicate isSuccess)
Creates an BasicHttpResult from an httpcomponents HttpResponse and a lambda
isSuccess that determines what http response status codes constitute a successful
response.
|
byte[] |
getBody()
Returns a copy of the byte[] response body.
|
String |
getBodyAsString() |
IOException |
getException() |
String |
getMessage() |
int |
getStatus() |
boolean |
getSuccess() |
String |
toString() |
protected final boolean success
protected final int status
@Nullable protected final String message
@Nullable protected final byte[] body
@Nullable protected final IOException exception
@Nullable public static BasicHttpResult create(org.apache.http.HttpResponse response, IntPredicate isSuccess) throws IOException
IOException
public boolean getSuccess()
public int getStatus()
@Nullable public byte[] getBody()
@Nullable public IOException getException()
public boolean causedByException()
Copyright © 2025. All rights reserved.