Skip to content
charlie edited this page Aug 11, 2014 · 1 revision

Camelot uses Jersey 2 to create RESTful Web service from your application.

@Path("/count-by-day")
public class TestsCountByDayResource {

    @Repository
    private AggregatorRepository aggregatorRepository;

    @MainInput
    private EventProducer input;

    @GET
    @Path("{day}")
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response get(@PathParam("day") String day) {
        return Response.ok(aggregatorRepository.get(day)).build();
    }

    @PUT
    @Path("/events")
    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response sendMessage(TestMessage message) {
        input.produce(TestMessage);
        return Response.ok("ok").build();
    }
}

You can inject to resource class the following beans:

  • Output
  • MainInput
  • Input
  • ClientSender
  • PluginStorage
  • Plugin

More information about injections you can find on camelot injections wiki page.

Clone this wiki locally