io.micronaut.http.annotation.Produces Java Examples
The following examples show how to use
io.micronaut.http.annotation.Produces.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReadOperationAnnotationMapper.java From micronaut-spring with Apache License 2.0 | 5 votes |
@Override protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) { final String[] produces = annotation.get("produces", String[].class).orElse(null); final AnnotationValue<?> readOp = AnnotationValue.builder("io.micronaut.management.endpoint.annotation." + operationName()).build(); List<AnnotationValue<?>> annotationValues = new ArrayList<>(2); annotationValues.add(readOp); if (produces != null) { final AnnotationValue<Produces> producesAnn = AnnotationValue.builder(Produces.class).member("value", produces).build(); annotationValues.add(producesAnn); } return annotationValues; }
Example #2
Source File: SimpleController.java From micronaut-gcp with Apache License 2.0 | 4 votes |
@Produces("text/plain") @Get("/text") String text() { return "good"; }
Example #3
Source File: SimpleController.java From micronaut-gcp with Apache License 2.0 | 4 votes |
@Produces("application/json") @Get("/simplePojo") Person simplePojo() { return new Person("good"); }
Example #4
Source File: MicronautLambdaContainerHandler.java From micronaut-aws with Apache License 2.0 | 4 votes |
private void applyRouteConfig(MicronautAwsProxyResponse<?> containerResponse, MethodBasedRouteMatch finalRoute) { if (!containerResponse.getContentType().isPresent()) { finalRoute.getValue(Produces.class, String.class).ifPresent(containerResponse::contentType); } finalRoute.getValue(Status.class, HttpStatus.class).ifPresent(httpStatus -> containerResponse.status(httpStatus)); }
Example #5
Source File: HelloController.java From java-docs-samples with Apache License 2.0 | 4 votes |
@Get("/") @Produces(MediaType.TEXT_PLAIN) public String index() { return "Hello World!"; }