Class GenericRequest
-
- All Implemented Interfaces:
-
khttp.requests.Request
public final class GenericRequest implements Request
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classGenericRequest.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Stringurlprivate final Map<String, String>headersprivate final Objectdataprivate final BooleanallowRedirectsprivate final HostnameVerifierhostnameVerifierprivate final ByteArraybodyprivate final Stringmethodprivate final Map<String, String>paramsprivate final Objectjsonprivate final Authorizationauthprivate final Map<String, String>cookiesprivate final Doubletimeoutprivate final Booleanstreamprivate final List<FileLike>filesprivate final SSLContextsslContextpublic final static GenericRequest.CompanionCompanion
-
Method Summary
Modifier and Type Method Description StringgetUrl()The URL to perform this request on. Map<String, String>getHeaders()The headers to use for this request. ObjectgetData()The data for the body of this request. BooleangetAllowRedirects()If redirects should be followed. HostnameVerifiergetHostnameVerifier()URL's hostname and the server's identification hostname validation ByteArraygetBody()The body of the request to be sent. StringgetMethod()The HTTP method for this request. Map<String, String>getParams()The URL parameters to use for this request. ObjectgetJson()An object to use as the JSON payload for this request. AuthorizationgetAuth()The HTTP basic auth username and password. Map<String, String>getCookies()A Map of cookies to send with this request. DoublegetTimeout()The amount of time to wait, in seconds, for the server to send data. BooleangetStream()If the response content should be immediately downloaded ( false) or streamed (true).List<FileLike>getFiles()List of FileLike objects to include in the request. SSLContextgetSslContext()SSL configuration for the request -
-
Method Detail
-
getHeaders
Map<String, String> getHeaders()
The headers to use for this request.
-
getAllowRedirects
Boolean getAllowRedirects()
If redirects should be followed.
-
getHostnameVerifier
HostnameVerifier getHostnameVerifier()
URL's hostname and the server's identification hostname validation
-
getJson
Object getJson()
An object to use as the JSON payload for this request. Some special things happen if this isn't
null.If this is not
null,whatever is specified in data will be overwritten
the
Content-Typeheader becomesapplication/jsonthe object specified is coerced into either a JSONArray or a JSONObject
JSONObjects and JSONArrays are treated as such and will not undergo coercion
Maps become JSONObjects by using the appropriate constructor. Keys are converted to Strings, with
nullbecoming"null"Collections becomes JSONArrays by using the appropriate constructor.
Arrays become JSONArrays by using the appropriate constructor.
any other Iterables becomes JSONArrays using a custom method.
any other object throws an IllegalArgumentException
-
getAuth
Authorization getAuth()
The HTTP basic auth username and password.
-
getCookies
Map<String, String> getCookies()
A Map of cookies to send with this request. Note that CookieJar is a map. It also has a constructor that takes a map, for easy conversion.
-
getTimeout
Double getTimeout()
The amount of time to wait, in seconds, for the server to send data.
-
getStream
Boolean getStream()
If the response content should be immediately downloaded (
false) or streamed (true).
-
getSslContext
SSLContext getSslContext()
SSL configuration for the request
-
-
-
-