@Override public void configure() throws Exception { // configure rest-dsl restConfiguration() // to use spark-rest component and run on port 8080 .component("spark-rest").port(8080); // rest services under the orders context-path rest("/orders") .get("{id}") .to("bean:orderService?method=getOrder(${header.id})") .post() .to("bean:orderService?method=createOrder") .put() .to("bean:orderService?method=updateOrder") .delete("{id}") .to("bean:orderService?method=cancelOrder(${header.id})"); } }
@Override public void configure() throws Exception { // see the application.properties file for setup of the rest configuration // rest services under the orders context-path rest("/orders") // need to specify the POJO types the binding is using (otherwise json binding defaults to Map based) .get("{id}").outType(Order.class) .to("bean:orderService?method=getOrder(${header.id})") // need to specify the POJO types the binding is using (otherwise json binding defaults to Map based) .post().type(Order.class) .to("bean:orderService?method=createOrder") // need to specify the POJO types the binding is using (otherwise json binding defaults to Map based) .put().type(Order.class) .to("bean:orderService?method=updateOrder") .delete("{id}") .to("bean:orderService?method=cancelOrder(${header.id})"); } }
@Override public void configure() throws Exception { // configure rest-dsl restConfiguration() // to use jetty component and run on port 8080 .component("jetty").port(8080) // use a smaller thread pool in jetty as we do not have so high demand yet .componentProperty("minThreads", "1") .componentProperty("maxThreads", "16") // to setup jetty to use the security handler .endpointProperty("handlers", "#securityHandler"); // rest services under the orders context-path rest("/orders") .get("{id}") .to("bean:orderService?method=getOrder(${header.id})") .post() .to("bean:orderService?method=createOrder") .put() .to("bean:orderService?method=updateOrder") .delete("{id}") .to("bean:orderService?method=cancelOrder(${header.id})"); } }
@Override public void configure() throws Exception { // configure rest-dsl restConfiguration() // to use jetty component and run on port 8080 .component("jetty").port(8080) // use a smaller thread pool in jetty as we do not have so high demand yet .componentProperty("minThreads", "1") .componentProperty("maxThreads", "16") // to setup jetty to use the security handler .endpointProperty("handlers", "#securityHandler"); // rest services under the orders context-path rest("/orders") .get("{id}") .to("bean:orderService?method=getOrder(${header.id})") .post() .to("bean:orderService?method=createOrder") .put() .to("bean:orderService?method=updateOrder") .delete("{id}") .to("bean:orderService?method=cancelOrder(${header.id})"); } }
@Override public void configure() throws Exception { // configure rest-dsl restConfiguration() // to use spark-rest component and run on port 8080 .component("spark-rest").port(8080) // and enable json binding mode .bindingMode(RestBindingMode.json) // lets enable pretty printing json responses .dataFormatProperty("prettyPrint", "true"); // rest services under the orders context-path rest("/orders") // need to specify the POJO types the binding is using (otherwise json binding defaults to Map based) .get("{id}").outType(Order.class) .to("bean:orderService?method=getOrder(${header.id})") // need to specify the POJO types the binding is using (otherwise json binding defaults to Map based) .post().type(Order.class) .to("bean:orderService?method=createOrder") // need to specify the POJO types the binding is using (otherwise json binding defaults to Map based) .put().type(Order.class) .to("bean:orderService?method=updateOrder") .delete("{id}") .to("bean:orderService?method=cancelOrder(${header.id})"); } }
rest("/orders")
rest("/orders").description("Order services")