Package com.auth0.net
Class MultipartRequest<T>
java.lang.Object
com.auth0.net.BaseRequest<T>
com.auth0.net.MultipartRequest<T>
- Type Parameters:
T
- The type expected to be received as part of the response.
- All Implemented Interfaces:
Request<T>
Request class that accepts parts to be sent encoded in a form.
The content type of this request is "multipart/form-data".
This class is not thread-safe:
It makes use of HashMap
for storing the parameters. Make sure to not modify headers or the parameters
from a different or un-synchronized thread.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMultipartRequest
(Auth0HttpClient client, TokenProvider tokenProvider, String url, HttpMethod method, com.fasterxml.jackson.core.type.TypeReference<T> tType) -
Method Summary
Modifier and TypeMethodDescriptionAdds an HTTP header to the requestAdds a file part to the form of this requestAdds a key-value part to the form of this requestprotected HttpRequestBody
Responsible for creating the payload that will be set as body on this request.protected String
Getter for the content-type header value to use on this requestprotected T
readResponseBody
(Auth0HttpResponse response) Responsible for parsing the payload that is received as part of the response.Methods inherited from class com.auth0.net.BaseRequest
addParameter, createRequest, createResponseException, execute, executeAsync, parseResponseBody, setBody
-
Constructor Details
-
MultipartRequest
public MultipartRequest(Auth0HttpClient client, TokenProvider tokenProvider, String url, HttpMethod method, com.fasterxml.jackson.core.type.TypeReference<T> tType)
-
-
Method Details
-
getContentType
Description copied from class:BaseRequest
Getter for the content-type header value to use on this request- Overrides:
getContentType
in classBaseRequest<T>
- Returns:
- the content-type
-
createRequestBody
Description copied from class:BaseRequest
Responsible for creating the payload that will be set as body on this request.- Overrides:
createRequestBody
in classBaseRequest<T>
- Returns:
- the body to send as part of the request.
- Throws:
IOException
- if an error is raised during the creation of the body.
-
readResponseBody
Description copied from class:BaseRequest
Responsible for parsing the payload that is received as part of the response.- Overrides:
readResponseBody
in classBaseRequest<T>
- Parameters:
response
- the received response. The body buffer will automatically closed.- Returns:
- the instance of type T, result of interpreting the payload.
- Throws:
IOException
- if an error is raised during the parsing of the body.
-
addHeader
Description copied from class:BaseRequest
Adds an HTTP header to the request -
addPart
Adds a file part to the form of this request- Parameters:
name
- the name of the partfile
- the file contents to send in this partmediaType
- the file contents media type- Returns:
- this same request instance
-
addPart
Adds a key-value part to the form of this request- Parameters:
name
- the name of the partvalue
- the value of the part- Returns:
- this same request instance
-