public class HttpPoet extends AbstractHttpPoet implements groovy.lang.GroovyObject
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_HISTORY_LIMIT |
onPostExecute, onPreExecute| Constructor and Description |
|---|
HttpPoet() |
HttpPoet(Map<?,?> properties) |
HttpPoet(okhttp3.OkHttpClient client) |
HttpPoet(okhttp3.OkHttpClient okHttpClient,
String baseUrl) |
HttpPoet(String baseUrl) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInterceptor(groovy.lang.Closure<okhttp3.Response> interceptor) |
void |
addNetworkInterceptor(groovy.lang.Closure<okhttp3.Response> interceptor) |
protected Object |
defaultHandleErrorResponse(okhttp3.Response response,
Map<?,?> additionalParameters) |
Object |
delete(Map<?,?> additionalParameters,
String urlOrEndpoint)
Performs a delete request with the provided additional parameters and return the parsed result
|
Object |
delete(Map<?,?> additionalParameters,
String urlOrEndpoint,
Function responseHandler)
Performs a delete request with the provided response handler and the provided additional parameters
|
Object |
delete(String urlOrEndpoint)
Performs a delete request and return the parsed result
|
Object |
delete(String urlOrEndpoint,
Function responseHandler)
Performs a delete request with the provided response handler
|
protected Object |
doRequest(okhttp3.Request request,
Map<?,?> additionalParameters) |
Object |
get(Map<?,?> additionalParameters,
String urlOrEndpoint)
Get the following url/endpoint and returns the decoded response
|
Object |
get(Map<?,?> additionalParameters,
String urlOrEndpoint,
Function<Object,?> responseHandler)
Get the following url/endpoint and use the closure as a response handler
|
Object |
get(String urlOrEndpoint)
Performs a get request and return the parsed result
|
Object |
get(String urlOrEndpoint,
Function responseHandler)
Performs a get request with the provided response handler
|
groovy.lang.MetaClass |
getMetaClass() |
protected Object |
handleErrorResponse(okhttp3.Response response,
Map<?,?> additionalParameters) |
protected Object |
handleResponse(okhttp3.Response response,
Map<?,?> additionalParameters) |
Object |
invokeMethod(String name,
Object args) |
Object |
method(Map<?,?> additionalParameters,
String urlOrEndpoint,
HttpMethod method) |
Object |
method(Map<?,?> additionalParameters,
String urlOrEndpoint,
HttpMethod method,
Function responseHandler)
Performs a request with the provided method name, response handler and additional parameters
|
Object |
method(Map<?,?> additionalParameters,
String urlOrEndpoint,
String method)
Performs a request with the provided method name and additional parameters and return the parsed result
|
Object |
method(Map<?,?> additionalParameters,
String urlOrEndpoint,
String method,
Function responseHandler)
Performs a request with the provided method name, response handler and additional parameters
|
Object |
method(String urlOrEndpoint,
HttpMethod method) |
Object |
method(String urlOrEndpoint,
String method)
Performs a request with the given method name and return the parsed result
|
Object |
method(String urlOrEndpoint,
String method,
Function responseHandler)
Performs a request with the provided method name and response handler
|
protected Object |
parseResponse(okhttp3.Response response,
Map<?,?> additionalParameters) |
Object |
patch(Map<?,?> additionalParameters,
String urlOrEndpoint)
Performs a patch request with the provided additional parameters and return the parsed result
|
Object |
patch(Map<?,?> additionalParameters,
String urlOrEndpoint,
Function responseHandler)
Performs a patch request with the provided response handler and the provided additional parameters
|
Object |
patch(String urlOrEndpoint)
Performs a patch request and return the parsed result
|
Object |
patch(String urlOrEndpoint,
Function responseHandler)
Performs a patch request with the provided response handler
|
HttpPoem |
poem() |
Object |
poem(groovy.lang.Closure closure) |
Object |
post(Map<?,?> additionalParameters,
String urlOrEndpoint)
Performs a post request with the provided additional parameters and return the parsed result
|
Object |
post(Map<?,?> additionalParameters,
String urlOrEndpoint,
Function responseHandler)
Performs a post request with the provided response handler and the provided additional parameters
|
Object |
post(String urlOrEndpoint)
Performs a post request and return the parsed result
|
Object |
post(String urlOrEndpoint,
Function responseHandler)
Performs a post request with the provided response handler
|
Object |
put(Map<?,?> additionalParameters,
String urlOrEndpoint)
Performs a put request with the provided additional parameters and return the parsed result
|
Object |
put(Map<?,?> additionalParameters,
String urlOrEndpoint,
Function responseHandler)
Performs a put request with the provided response handler and the provided additional parameters
|
Object |
put(String urlOrEndpoint)
Performs a put request and return the parsed result
|
Object |
put(String urlOrEndpoint,
Function responseHandler)
Performs a put request with the provided response handler
|
okhttp3.Request |
request(HttpMethod method,
String urlOrEndpoint,
Map<?,?> additionalParameters) |
okhttp3.Request |
request(String method,
String urlOrEndpoint,
Map<?,?> additionalParameters) |
protected okhttp3.RequestBody |
requestBody(Object body,
Function composerOverride,
ContentType contentType,
String method) |
void |
setMetaClass(groovy.lang.MetaClass metaClass) |
addInterceptor, addNetworkInterceptor, configureOkHttpClient, defaultHandleErrorResponse, disableHistory, doRequest, doRequest, enableHistory, enableHistory, extractRequestBody, getAcceptContentType, getBaseUrl, getComposers, getContentType, getErrorResponseHandler, getHeaders, getHistory, getInterceptor, getInterceptors, getJsonGenerator, getMultivaluedQueryParamComposingType, getNetworkInterceptor, getNetworkInterceptors, getOkHttpClient, getOnPostExecute, getOnPreExecute, getParams, getParsers, getQueryParamComposer, getQueryParamConverters, getResponseContentType, handleErrorResponse, handleHistory, handleResponse, newPoet, parseResponse, putHeader, putHeader, removeHeader, request, setAcceptContentType, setBaseUrl, setContentType, setDefaultParser, setErrorResponseHandler, setHistory, setMultivaluedQueryParamComposingType, setOkHttpClient, setOnPostExecute, setOnPreExecute, toStringpublic static final int DEFAULT_HISTORY_LIMIT
public HttpPoet()
public HttpPoet(okhttp3.OkHttpClient client)
public HttpPoet(Map<?,?> properties)
public HttpPoet(String baseUrl)
public HttpPoet(okhttp3.OkHttpClient okHttpClient,
String baseUrl)
public Object method(String urlOrEndpoint, HttpMethod method) throws IOException
IOExceptionpublic Object method(String urlOrEndpoint, String method) throws IOException
urlOrEndpoint - the url or endpointmethod - the HTTP methodIOException - in case of I/O errorpublic Object method(Map<?,?> additionalParameters, String urlOrEndpoint, HttpMethod method) throws IOException
IOExceptionpublic Object method(Map<?,?> additionalParameters, String urlOrEndpoint, String method) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointmethod - the HTTP methodIOException - in case of I/O errorpublic Object method(String urlOrEndpoint, String method, Function responseHandler) throws IOException
urlOrEndpoint - the url or endpointmethod - the HTTP methodresponseHandler - the response handlerIOException - in case of I/O errorpublic Object method(Map<?,?> additionalParameters, String urlOrEndpoint, HttpMethod method, Function responseHandler) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointmethod - the HTTP methodresponseHandler - the response handlerIOException - in case of I/O errorpublic Object method(Map<?,?> additionalParameters, String urlOrEndpoint, String method, Function responseHandler) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointmethod - the HTTP methodresponseHandler - the response handlerIOException - in case of I/O errorpublic Object put(String urlOrEndpoint) throws IOException
urlOrEndpoint - the url or endpointIOException - in case of I/O errorpublic Object put(Map<?,?> additionalParameters, String urlOrEndpoint) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointIOException - in case of I/O errorpublic Object put(String urlOrEndpoint, Function responseHandler) throws IOException
urlOrEndpoint - the url or endpointresponseHandler - the response handlerIOException - in case of I/O errorpublic Object put(Map<?,?> additionalParameters, String urlOrEndpoint, Function responseHandler) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointresponseHandler - the response handlerIOException - in case of I/O errorpublic Object patch(String urlOrEndpoint) throws IOException
urlOrEndpoint - the url or endpointIOException - in case of I/O errorpublic Object patch(Map<?,?> additionalParameters, String urlOrEndpoint) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointIOException - in case of I/O errorpublic Object patch(String urlOrEndpoint, Function responseHandler) throws IOException
urlOrEndpoint - the url or endpointresponseHandler - the response handlerIOException - in case of I/O errorpublic Object patch(Map<?,?> additionalParameters, String urlOrEndpoint, Function responseHandler) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointresponseHandler - the response handlerIOException - in case of I/O errorpublic Object post(String urlOrEndpoint) throws IOException
urlOrEndpoint - the url or endpointIOException - in case of I/O errorpublic Object post(Map<?,?> additionalParameters, String urlOrEndpoint) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointIOException - in case of I/O errorpublic Object post(String urlOrEndpoint, Function responseHandler) throws IOException
urlOrEndpoint - the url or endpointresponseHandler - the response handlerIOException - in case of I/O errorpublic Object post(Map<?,?> additionalParameters, String urlOrEndpoint, Function responseHandler) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointresponseHandler - the response handlerIOException - in case of I/O errorpublic Object delete(String urlOrEndpoint) throws IOException
urlOrEndpoint - the url or endpointIOException - in case of I/O errorpublic Object delete(Map<?,?> additionalParameters, String urlOrEndpoint) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointIOException - in case of I/O errorpublic Object delete(String urlOrEndpoint, Function responseHandler) throws IOException
urlOrEndpoint - the url or endpointresponseHandler - the response handlerIOException - in case of I/O errorpublic Object delete(Map<?,?> additionalParameters, String urlOrEndpoint, Function responseHandler) throws IOException
additionalParameters - the additional parametersurlOrEndpoint - the url or endpointresponseHandler - the response handlerIOException - in case of I/O errorpublic Object get(String urlOrEndpoint) throws IOException
urlOrEndpoint - the url or endpointIOException - in case of I/O errorpublic Object get(Map<?,?> additionalParameters, String urlOrEndpoint) throws IOException
additionalParameters - additional parametersurlOrEndpoint - the url or endpointIOException - in case of I/O errorspublic Object get(String urlOrEndpoint, Function responseHandler) throws IOException
urlOrEndpoint - the url or endpointresponseHandler - the response handlerIOException - in case of I/O errorpublic Object get(Map<?,?> additionalParameters, String urlOrEndpoint, Function<Object,?> responseHandler) throws IOException
additionalParameters - additional parametersurlOrEndpoint - the url or endpointresponseHandler - the response handlerIOException - in case of I/O errorsprotected Object doRequest(okhttp3.Request request, Map<?,?> additionalParameters) throws IOException
IOExceptionprotected Object handleResponse(okhttp3.Response response, Map<?,?> additionalParameters)
protected Object parseResponse(okhttp3.Response response, Map<?,?> additionalParameters)
public okhttp3.Request request(HttpMethod method, String urlOrEndpoint, Map<?,?> additionalParameters) throws IOException
IOExceptionpublic okhttp3.Request request(String method, String urlOrEndpoint, Map<?,?> additionalParameters) throws IOException
IOExceptionprotected Object handleErrorResponse(okhttp3.Response response, Map<?,?> additionalParameters)
protected Object defaultHandleErrorResponse(okhttp3.Response response, Map<?,?> additionalParameters)
public Object invokeMethod(String name, Object args)
invokeMethod in interface groovy.lang.GroovyObjectpublic void addInterceptor(groovy.lang.Closure<okhttp3.Response> interceptor)
public void addNetworkInterceptor(groovy.lang.Closure<okhttp3.Response> interceptor)
public HttpPoem poem()
public Object poem(@DelegatesTo(value=HttpPoem.class) groovy.lang.Closure closure)
protected okhttp3.RequestBody requestBody(Object body, Function composerOverride, ContentType contentType, String method) throws IOException
requestBody in class AbstractHttpPoetIOExceptionpublic groovy.lang.MetaClass getMetaClass()
getMetaClass in interface groovy.lang.GroovyObjectpublic void setMetaClass(groovy.lang.MetaClass metaClass)
setMetaClass in interface groovy.lang.GroovyObjectCopyright © 2021–2024 Tambapps. All rights reserved.