All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ftl.rest.client.method.$$RestClientWithoutParametersMethodBodyTemplateftl Maven / Gradle / Ivy

There is a newer version: 0.11
Show newest version
<#include "../rest-client-lib.javaftl">
<#-- -------------------------------------------------------------------------------------------------------- -->
<#if HEADERS?has_content>
final HeaderBuilder headerBuilder = new HeaderBuilder();
<#list HEADERS as HEADER>
headerBuilder.add("${HEADER.key}", ${HEADER.value});


<#if QUERY_PARAMS?has_content>
final QueryBuilder queryBuilder = new QueryBuilder();
<#list QUERY_PARAMS as PARAM>
queryBuilder.add("${PARAM.key}", ${PARAM.value});


<#-- -------------------------------------------------------------------------------------------------------- -->
<#-- -------------------------------------------------------------------------------------------------------- -->
<#-- -------------------------------------------------------------------------------------------------------- -->
<#if HEADERS?has_content>
final CompletableFuture response = client
        .sendAsync("${HTTP_METHOD}", "${PATH}", headerBuilder.build())
        .handle(throwExceptionIfNotSuccess());
<#elseif QUERY_PARAMS?has_content>
final CompletableFuture response = client
        .sendAsync("${HTTP_METHOD}", joinPath("${PATH}", queryBuilder.build()), EMPTY_HEADERS)
        .handle(throwExceptionIfNotSuccess());
<#else>
final CompletableFuture response = client
        .sendAsync("${HTTP_METHOD}", "${PATH}", EMPTY_HEADERS)
        .handle(throwExceptionIfNotSuccess());

<#-- -------------------------------------------------------------------------------------------------------- -->
<@returnResult/>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy