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

ftl.rest.server.method.$$RestControllerSimplestMethodBodyTemplateftl Maven / Gradle / Ivy

There is a newer version: 0.11
Show newest version
<#-- --------------------------------------------- Static headers -------------------------------------------------- -->
<#if STATIC_HEADERS?has_content>
<#if STATIC_HEADERS?size == 1>
final HttpHeaders headers = HttpHeaders.of(<#list STATIC_HEADERS as e>"${e.key}", "${e.value}");
<#elseif STATIC_HEADERS?size <= 10>
final HttpHeaders headers = HttpHeaders.of(
    <#list STATIC_HEADERS as e>
        "${e.key}", "${e.value}"<#if e?has_next>,
    
);
<#else>
final HttpHeaders headers = HttpHeaders.of(
    <#list STATIC_HEADERS as e>
        java.util.Map.entry("${e.key}", "${e.value}")<#if e?has_next>,
    
);

<#else>
final HttpHeaders headers = HttpHeaders.of();

<#-- --------------------------------------------- Reactive Void --------------------------------------------------- -->
<#if RETURN.reactiveVoid>
<#-- -------------------------------------- Spring Reactor Mono ---------------------------------------------- -->
<#if RETURN.mono>
return restController.${METHOD_NAME.simpleName}()
        .toFuture()
        .thenApply(nothing -> buildResponse(${STATUS_CODE}, headers));
<#-- ----------------------------------------- RxJava Completable -------------------------------------------------- -->
<#elseif RETURN.completable>
return restController.${METHOD_NAME.simpleName}()
        .toCompletionStage(buildResponse(${STATUS_CODE}, headers));
<#-- ------------------------------------ JSE CompletableFuture ---------------------------------------------- -->
<#elseif RETURN.future>
return restController.${METHOD_NAME.simpleName}()
        .thenApply(nothing -> buildResponse(${STATUS_CODE}, headers));
<#-- --------------------------------------------------------------------------------------------------------------- -->
<#else>
//"RxMicro does not know how to generate this method";

<#-- ------------------------------------------------ Void --------------------------------------------------------- -->
<#else>
restController.${METHOD_NAME.simpleName}();
return CompletableFuture.completedStage(buildResponse(${STATUS_CODE}, headers));
<#-- --------------------------------------------------------------------------------------------------------------- -->




© 2015 - 2024 Weber Informatics LLC | Privacy Policy