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

项目:drinkwater-java    文件:RestHelper.java   
public static void buildRestRoutes(RouteBuilder builder, Object bean,
                                   IDrinkWaterService drinkWaterService) {

    //check this for cors problems
    //http://camel.465427.n5.nabble.com/Workaround-with-REST-DSL-to-avoid-HTTP-method-not-allowed-405-td5771508.html
    try {

        String serviceHost = endpointFrom(drinkWaterService);
        drinkWaterService.getConfiguration().setServiceHost(serviceHost);

        RestPropertyDefinition corsAllowedHeaders = new RestPropertyDefinition();
        corsAllowedHeaders.setKey("Access-Control-Allow-Headers");
        corsAllowedHeaders.setValue(getAllowedCorsheaders(drinkWaterService));

        // builder.getContext().getDataFormats();
        RestConfigurationDefinition restConfig =
                builder.restConfiguration()
                        .component("jetty")
                        .enableCORS(true)
                        .scheme("http")
                        .host(host(drinkWaterService))
                        .port(port(drinkWaterService))
                        .contextPath(context(drinkWaterService, drinkWaterService.getConfiguration()))
                        .bindingMode(RestBindingMode.json)
                        .jsonDataFormat("json-drinkwater");

        restConfig.setCorsHeaders(singletonList(corsAllowedHeaders));

    } catch (Exception ex) {
        throw new RuntimeException("could not configure the rest service correctly", ex);
    }

    javaslang.collection
            .List.of(ReflectHelper.getPublicDeclaredMethods(bean.getClass()))
            .map(method -> buildRestRoute(builder, method, drinkWaterService.getTracer()))
            .map(tuple -> routeToBeanMethod(tuple._1, bean, tuple._2, drinkWaterService));
}
项目:drinkwater-java    文件:RestHelper.java   
public static void buildRestRoutes(RouteBuilder builder, Object bean,
                                   IDrinkWaterService drinkWaterService) {

    //check this for cors problems
    //http://camel.465427.n5.nabble.com/Workaround-with-REST-DSL-to-avoid-HTTP-method-not-allowed-405-td5771508.html
    try {

        String serviceHost = endpointFrom(drinkWaterService);
        drinkWaterService.getConfiguration().setServiceHost(serviceHost);

        RestPropertyDefinition corsAllowedHeaders = new RestPropertyDefinition();
        corsAllowedHeaders.setKey("Access-Control-Allow-Headers");
        corsAllowedHeaders.setValue(getAllowedCorsheaders(drinkWaterService));

        // builder.getContext().getDataFormats();
        RestConfigurationDefinition restConfig =
                builder.restConfiguration()
                        .component("jetty")
                        .enableCORS(true)
                        .scheme("http")
                        .host(host(drinkWaterService))
                        .port(port(drinkWaterService))
                        .contextPath(context(drinkWaterService, drinkWaterService.getConfiguration()))
                        .bindingMode(RestBindingMode.json)
                        .jsonDataFormat("json-drinkwater");

        restConfig.setCorsHeaders(singletonList(corsAllowedHeaders));

    } catch (Exception ex) {
        throw new RuntimeException("could not configure the rest service correctly", ex);
    }

    javaslang.collection
            .List.of(ReflectHelper.getPublicDeclaredMethods(bean.getClass()))
            .map(method -> buildRestRoute(builder, method, drinkWaterService.getTracer()))
            .map(tuple -> routeToBeanMethod(tuple._1, bean, tuple._2, drinkWaterService));
}
项目:Camel    文件:RouteBuilder.java   
public Map<String, RestConfigurationDefinition> getRestConfigurations() {
    return restConfigurations;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public RestConfigurationDefinition getRestConfiguration() {
    return restConfiguration;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public void setRestConfiguration(RestConfigurationDefinition restConfiguration) {
    this.restConfiguration = restConfiguration;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public RestConfigurationDefinition getRestConfiguration() {
    return restConfiguration;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public void setRestConfiguration(RestConfigurationDefinition restConfiguration) {
    this.restConfiguration = restConfiguration;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public RestConfigurationDefinition getRestConfiguration() {
    return restConfiguration;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public void setRestConfiguration(RestConfigurationDefinition restConfiguration) {
    this.restConfiguration = restConfiguration;
}
项目:switchyard    文件:CamelContextFactoryBeanDelegate.java   
@Override
public RestConfigurationDefinition getRestConfiguration() {
    return _factoryBean.getRestConfiguration();
}
项目:camel-cdi    文件:CamelContextFactoryBean.java   
public RestConfigurationDefinition getRestConfiguration() {
    return restConfiguration;
}
项目:camel-cdi    文件:CamelContextFactoryBean.java   
public void setRestConfiguration(RestConfigurationDefinition restConfiguration) {
    this.restConfiguration = restConfiguration;
}
项目:Camel    文件:RouteBuilder.java   
/**
 * Configures the REST services
 *
 * @return the builder
 */
public RestConfigurationDefinition restConfiguration() {
    return restConfiguration("");
}
项目:Camel    文件:AbstractCamelContextFactoryBean.java   
public abstract RestConfigurationDefinition getRestConfiguration();