Package org.attribyte.api.http
Class RequestOptions
java.lang.Object
org.attribyte.api.http.RequestOptions
Request-specific options.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RequestOptionsThe default request options.static final booleanThe default follow redirects (true).static final intThe maximum response size (10 MB).static final intThe maximum time to wait for a response (5 seconds).final booleanAre redirects followed?final intThe maximum size of a response in bytes.final intThe maximum time to wait for a response in seconds.final booleanShould the response be truncated ifmaxResponseBytesis reached (otherwise an exception is thrown)? -
Constructor Summary
ConstructorsConstructorDescriptionRequestOptions(boolean followRedirects, int maxResponseBytes, int timeoutSeconds) Creates request options.RequestOptions(boolean followRedirects, int maxResponseBytes, int timeoutSeconds, boolean truncateOnLimit) Creates request options. -
Method Summary
Modifier and TypeMethodDescriptionCreate request options that follows redirects.toString()Create request options that truncate the response if the limit is reached.
-
Field Details
-
DEFAULT_FOLLOW_REDIRECTS
public static final boolean DEFAULT_FOLLOW_REDIRECTSThe default follow redirects (true).- See Also:
-
DEFAULT_MAX_RESPONSE_BYTES
public static final int DEFAULT_MAX_RESPONSE_BYTESThe maximum response size (10 MB).- See Also:
-
DEFAULT_TIMEOUT_SECONDS
public static final int DEFAULT_TIMEOUT_SECONDSThe maximum time to wait for a response (5 seconds).- See Also:
-
DEFAULT
The default request options. -
followRedirects
public final boolean followRedirectsAre redirects followed? -
maxResponseBytes
public final int maxResponseBytesThe maximum size of a response in bytes. -
truncateOnLimit
public final boolean truncateOnLimitShould the response be truncated ifmaxResponseBytesis reached (otherwise an exception is thrown)? -
timeoutSeconds
public final int timeoutSecondsThe maximum time to wait for a response in seconds.
-
-
Constructor Details
-
RequestOptions
public RequestOptions(boolean followRedirects, int maxResponseBytes, int timeoutSeconds) Creates request options.- Parameters:
followRedirects- Should redirects be followed?maxResponseBytes- The maximum allowed response size in bytes.timeoutSeconds- The maximum time to wait for a response in seconds.
-
RequestOptions
public RequestOptions(boolean followRedirects, int maxResponseBytes, int timeoutSeconds, boolean truncateOnLimit) Creates request options.- Parameters:
followRedirects- Should redirects be followed?maxResponseBytes- The maximum allowed response size in bytes.timeoutSeconds- The maximum time to wait for a response in seconds.truncateOnLimit- Should the response be truncated ifmaxResponseBytesis reached (otherwise an exception is thrown)?
-
-
Method Details