1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- {{^reactive}}
- {{#examples}}
- {{#-first}}
- {{#async}}
- return CompletableFuture.supplyAsync(()-> {
- {{/async}}getRequest().ifPresent(request -> {
- {{#async}} {{/async}} for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
- {{/-first}}
- {{#async}} {{/async}}{{^async}} {{/async}} if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) {
- {{#async}} {{/async}}{{^async}} {{/async}} String exampleString = {{>exampleString}};
- {{#async}} {{/async}}{{^async}} {{/async}} ApiUtil.setExampleResponse(request, "{{{contentType}}}", exampleString);
- {{#async}} {{/async}}{{^async}} {{/async}} break;
- {{#async}} {{/async}}{{^async}} {{/async}} }
- {{#-last}}
- {{#async}} {{/async}}{{^async}} {{/async}} }
- {{#async}} {{/async}} });
- {{#async}} {{/async}} {{#useResponseEntity}}return new Result<>({{#returnSuccessCode}}HttpStatus.valueOf({{{statusCode}}}){{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}});
- {{/useResponseEntity}}
- {{^useResponseEntity}}throw new IllegalArgumentException("Not implemented");
- {{/useResponseEntity}}
- {{#async}}
- }, Runnable::run);
- {{/async}}
- {{/-last}}
- {{/examples}}
- {{^examples}}
- {{#useResponseEntity}}return {{#async}}CompletableFuture.completedFuture({{/async}}new Result<>({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}){{#async}}){{/async}};
- {{/useResponseEntity}}
- {{^useResponseEntity}}throw new IllegalArgumentException("Not implemented");
- {{/useResponseEntity}}
- {{/examples}}
- {{/reactive}}
- {{#reactive}}
- Mono<Void> result = Mono.empty();
- {{#examples}}
- {{#-first}}
- exchange.getResponse().setStatusCode({{#returnSuccessCode}}HttpStatus.valueOf({{{statusCode}}}){{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}});
- for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
- {{/-first}}
- if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) {
- String exampleString = {{>exampleString}};
- result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("{{{generatedContentType}}}"), exampleString);
- break;
- }
- {{#-last}}
- }
- {{/-last}}
- {{/examples}}
- {{^examples}}
- exchange.getResponse().setStatusCode({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}});
- {{/examples}}
- return result{{#allParams}}{{#isBodyParam}}{{^isArray}}{{#paramName}}.then({{.}}){{/paramName}}{{/isArray}}{{#isArray}}{{#paramName}}.thenMany({{.}}){{/paramName}}{{/isArray}}{{/isBodyParam}}{{/allParams}}.then(Mono.empty());
- {{/reactive}}
|