Java 类org.apache.camel.model.rest.RestBindingMode 实例源码

项目:Camel    文件:UserRouteBuilder.java   
@Override
public void configure() throws Exception {

    // configure we want to use spark-rest on port 8080 as the component for the rest DSL
    // and for the swagger api-doc as well
    restConfiguration().component("spark-rest").apiContextPath("api-doc").port(8080)
        // and we enable json binding mode
        .bindingMode(RestBindingMode.json)
        // and output using pretty print
        .dataFormatProperty("prettyPrint", "true");

    // this user REST service is json only
    rest("/user").consumes("application/json").produces("application/json")

        .get("/view/{id}").outType(User.class)
            .to("bean:userService?method=getUser(${header.id})")

        .get("/list").outTypeList(User.class)
            .to("bean:userService?method=listUsers")

        .put("/update").type(User.class).outType(User.class)
            .to("bean:userService?method=updateUser");
}
项目:Camel    文件:RestNettyHttpPostJsonJaxbPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use netty-http on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("netty-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserJaxbPojo.class)
                    .to("mock:input");
        }
    };
}
项目:camelinaction2    文件:CartRoute.java   
@Override
public void configure() throws Exception {

    // use jetty for rest service
    restConfiguration("jetty").port("{{port}}").contextPath("api")
            // turn on json binding
            .bindingMode(RestBindingMode.json)
            // turn off binding error on empty beans
            .dataFormatProperty("disableFeatures", "FAIL_ON_EMPTY_BEANS")
            // enable swagger api documentation
            .apiContextPath("api-doc")
            .enableCORS(true);

    // define the rest service
    rest("/cart").consumes("application/json").produces("application/json")
        // get returns List<CartDto>
        .get().outType(CartDto[].class).description("Returns the items currently in the shopping cart")
            .to("bean:cart?method=getItems")
        // get accepts CartDto
        .post().type(CartDto.class).description("Adds the item to the shopping cart")
            .to("bean:cart?method=addItem")
        .delete().description("Removes the item from the shopping cart")
            .param().name("itemId").description("Id of item to remove").endParam()
            .to("bean:cart?method=removeItem");
}
项目:camel-springboot    文件:RestConfiguration.java   
@Override
public void configure() throws Exception {
    /************************
     * Rest configuration. There should be only one in a CamelContext
     ************************/
    restConfiguration().component("servlet") //Requires "CamelServlet" to be registered
        .bindingMode(RestBindingMode.json)
        //Customize in/out Jackson objectmapper, see JsonDataFormat. Two different instances): json.in.*, json.out.*
        .dataFormatProperty("json.in.moduleClassNames", "com.fasterxml.jackson.datatype.jsr310.JavaTimeModule")
        .dataFormatProperty("json.out.include", "NON_NULL")
        .dataFormatProperty("json.out.disableFeatures", "WRITE_DATES_AS_TIMESTAMPS")
        .dataFormatProperty("json.out.moduleClassNames", "com.fasterxml.jackson.datatype.jsr310.JavaTimeModule")


        //Enable swagger endpoint. It's actually served by a Camel route
        .apiContextPath("/swagger") //swagger endpoint path; Final URL: Camel path + apiContextPath: /api/swagger
        .apiContextRouteId("swagger") //id of route providing the swagger endpoint

        .contextPath("/api") //base.path swagger property; use the mapping URL set for CamelServlet camel.component.servlet.mapping.contextPath
        .apiProperty("api.title", "Example REST api")
        .apiProperty("api.version", "1.0")
        //.apiProperty("schemes", "" ) //Setting empty string as scheme to support relative urls
        .apiProperty("schemes", serverProperties.getSsl() != null && serverProperties.getSsl().isEnabled() ? "https" : "http" )
        .apiProperty("host", "") //Setting empty string as host so swagger-ui make relative url calls. By default 0.0.0.0 is used
        ;
}
项目:wildfly-camel-examples    文件:RestAPIRouteBuilder.java   
public void configure() throws Exception {
    restConfiguration()
        .contextPath("/rest/api")
        .apiContextPath("/api-doc")
        .apiProperty("api.title", "Camel REST API")
        .apiProperty("api.version", "1.0")
        .apiProperty("cors", "true")
        .apiContextRouteId("doc-api")
        .component("undertow")
        .bindingMode(RestBindingMode.json);

    rest("/books").description("Books REST service")
        .get("/").description("The list of all the books")
            .route()
                .toF("jpa:%s?nativeQuery=select distinct description from orders", Order.class.getName())
            .endRest()
        .get("order/{id}").description("Details of an order by id")
            .route()
                .toF("jpa:%s?consumeDelete=false&parameters=#queryParameters&nativeQuery=select * from orders where id = :id", Order.class.getName())
                .process("jpaResultProcessor")
            .endRest();
}
项目:camel-spring    文件:HelloRouter.java   
@Override
public void configure() {

    // configure to use jetty on localhost with the given port and enable auto binding mode
    restConfiguration()
            .component("jetty")
            .host("0.0.0.0").port(9090)
            .bindingMode(RestBindingMode.json)
            .dataFormatProperty("json.in.disableFeatures", "FAIL_ON_UNKNOWN_PROPERTIES, ADJUST_DATES_TO_CONTEXT_TIME_ZONE")
            .dataFormatProperty("json.in.enableFeatures", "FAIL_ON_NUMBERS_FOR_ENUMS, USE_BIG_DECIMAL_FOR_FLOATS")
            .apiContextPath("/api-doc")
            .apiProperty("api.title", "API")
            .apiProperty("api.version", "1.0.0")
            .apiProperty("cors", "true");

    rest("/say")
            .description("Say hello")
            .consumes("application/json")
            .produces("application/json")
            .get("/hello")
            .route()
            .routeId("Hello REST")
            .transform().constant("Say hello to REST!");
}
项目:Camel    文件:RestNettyHttpPostXmlJaxbPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use netty-http on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("netty-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserJaxbPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestNettyHttpPostJsonPojoListTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use netty-http on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("netty-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").typeList(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestNettyHttpPostJsonPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use netty-http on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("netty-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestNettyHttpPojoInOutTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use netty-http on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("netty-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                // just return the default country here
                .get("lives").to("direct:start")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                    .bean(new UserService(), "livesWhere");

            CountryPojo country = new CountryPojo();
            country.setIso("EN");
            country.setCountry("England");
            from("direct:start").transform().constant(country);
        }
    };
}
项目:Camel    文件:RestServletPojoInOutTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use servlet and enable auto binding mode
            restConfiguration().component("servlet").bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                // just return the default country here
                .get("lives").to("direct:start")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                    .bean(new UserService(), "livesWhere");

            CountryPojo country = new CountryPojo();
            country.setIso("EN");
            country.setCountry("England");
            from("direct:start").transform().constant(country);
        }
    };
}
项目:Camel    文件:RestNettyHttpPostJsonJaxbPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use netty4-http on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserJaxbPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestNettyHttpPostXmlJaxbPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use netty4-http on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserJaxbPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestNettyHttpPostJsonPojoListTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use netty4-http on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").typeList(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestNettyHttpPostJsonPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use netty4-http on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestNettyHttpPojoInOutTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use netty4-http on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                // just return the default country here
                .get("lives").to("direct:start")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                    .bean(new UserService(), "livesWhere");

            CountryPojo country = new CountryPojo();
            country.setIso("EN");
            country.setCountry("England");

            from("direct:start").transform().constant(country);

        }
    };
}
项目:Camel    文件:RestUndertowHttpPojoInOutTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use undertow on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("undertow").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                // just return the default country here
                .get("lives").to("direct:start")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                    .bean(new UserService(), "livesWhere");

            CountryPojo country = new CountryPojo();
            country.setIso("EN");
            country.setCountry("England");

            from("direct:start").transform().constant(country);

        }
    };
}
项目:Camel    文件:RestUndertowHttpPostJsonJaxbPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use undertow on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("undertow").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserJaxbPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestUndertowHttpPostJsonPojoListTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use undertow on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("undertow").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").typeList(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestUndertowHttpPostJsonPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use undertow on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("undertow").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestUndertowHttpPostXmlJaxbPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use undertow on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("undertow").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserJaxbPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestRestletPojoInOutTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use restlet on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                    .bean(new UserService(), "livesWhere");
        }
    };
}
项目:Camel    文件:RestRestletBindingInJaxbOutStringWithXmlTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto)
                    // turn off must be JAXB as we create the output type ourselves as xml in a String type
                    .dataFormatProperty("xml.out.mustBeJAXBElement", "false");

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").consumes("application/xml").produces("application/xml").type(UserJaxbPojo.class)
                    .route()
                    .to("mock:input")
                    .transform().constant("<message>Thanks for calling us</message>");
        }
    };
}
项目:Camel    文件:RestRestletPostJsonJaxbPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use restlet on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserJaxbPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestRestletPojoInOutCustomErrorResponseTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.json);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                        .choice()
                            .when().simple("${body.id} < 100")
                                .bean(new UserErrorService(), "idToLowError")
                            .otherwise()
                                .bean(new UserService(), "livesWhere");
        }
    };
}
项目:Camel    文件:RestRestletPostJsonPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use restlet on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestRestletComponentConfigurationTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use restlet on localhost with the given port
            // and enable auto binding mode
            restConfiguration()
                    .component("restlet")
                    .host("localhost").port(portNum)
                    .bindingMode(RestBindingMode.auto)
                    .componentProperty("controllerDaemon", "false")
                    .componentProperty("maxThreads", "3");

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                    .bean(new UserService(), "livesWhere");
        }
    };
}
项目:Camel    文件:RestRestletPostJsonPojoListTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use restlet on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").typeList(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestRestletPostXmlJaxbPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use restlet on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserJaxbPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestRestletCustomDataFormatInvalidTest.java   
@Test
public void testCustom() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.json).jsonDataFormat("bla");

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                        .choice()
                            .when().simple("${body.id} < 100")
                                .bean(new UserErrorService(), "idToLowError")
                            .otherwise()
                                .bean(new UserService(), "livesWhere");
        }
    });
    try {
        context.start();
        fail("Should have thrown exception");
    } catch (FailedToCreateRouteException e) {
        assertEquals("JsonDataFormat name: bla must not be an existing bean instance from the registry", e.getCause().getMessage());
    }
}
项目:Camel    文件:RestRestletPostJsonPojoOnExceptionTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use restlet on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto);

            onException(JsonParseException.class)
                .handled(true)
                .to("mock:error")
                .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(400))
                .setBody().constant("Invalid json data");

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestRestletCustomDataFormatTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.json).jsonDataFormat("json-jackson");

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                        .choice()
                            .when().simple("${body.id} < 100")
                                .bean(new UserErrorService(), "idToLowError")
                            .otherwise()
                                .bean(new UserService(), "livesWhere");
        }
    };
}
项目:Camel    文件:RestJettyCustomContentTypeTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // enable json binding
            restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.json);

            rest("/users/").consumes("application/json").produces("application/json")
                .get("blob").to("direct:blob")
                .get("lives").to("direct:lives");

            from("direct:blob")
                // but send back non json data
                .setHeader(Exchange.CONTENT_TYPE, constant("application/foobar"))
                .transform().constant("Some foobar stuff goes here");

            CountryPojo country = new CountryPojo();
            country.setIso("EN");
            country.setCountry("England");
            from("direct:lives").transform().constant(country);
        }
    };
}
项目:Camel    文件:RestJettyPojoInOutTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use jetty on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                // just return the default country here
                .get("lives").to("direct:start")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                    .bean(new UserService(), "livesWhere");

            CountryPojo country = new CountryPojo();
            country.setIso("EN");
            country.setCountry("England");
            from("direct:start").transform().constant(country);
        }
    };
}
项目:Camel    文件:RestJettyPostXmlJaxbPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use jetty on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserJaxbPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestJettyPostJsonJaxbPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use jetty on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserJaxbPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestJettyPostJsonPojoTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use jetty on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestJettyPostJsonPojoDisableFeatureTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure json to not fail on unknown properties
            restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.json)
                    .dataFormatProperty("json.in.disableFeatures", "FAIL_ON_UNKNOWN_PROPERTIES");

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").type(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestJettyPostJsonPojoListTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use jetty on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("new").typeList(UserPojo.class)
                    .to("mock:input");
        }
    };
}
项目:Camel    文件:RestCamelSparkPojoInOutTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // configure to use spark on localhost with the given port
            // and enable auto binding mode
            restConfiguration().component("spark-rest").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);

            // use the rest DSL to define the rest services
            rest("/users/")
                .post("lives").type(UserPojo.class).outType(CountryPojo.class)
                    .route()
                    .bean(new UserService(), "livesWhere");
        }
    };
}