Skip to content

Instantly share code, notes, and snippets.

@caponetto
Last active September 11, 2020 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caponetto/e96c7be7fa89f5ce73aade5fbf73c189 to your computer and use it in GitHub Desktop.
Save caponetto/e96c7be7fa89f5ce73aade5fbf73c189 to your computer and use it in GitHub Desktop.
Backend sample service: Rest endpoint
package org.kie.kogito.extended.services.quarkus.sample;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/sample")
public class SampleResource {
@Inject
SampleService sampleService;
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response hello(final HelloRequest request) {
final String message = sampleService.hello(request.getName(), request.getDelay());
return Response.ok(new HelloResponse(message)).build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment