Java 类org.apache.camel.model.dataformat.JsonLibrary 实例源码

项目:funktion-connectors    文件:AgentKT.java   
private void assertWaitForResults(String namespace, String elasticSearchResource, SamplePayload payload) throws Throwable {
    final String pollUrl = pathJoin(elasticSearchResource, "/_source");
    LOG.info("Querying elasticsearch URL: " + pollUrl);

    CamelTester.assertIsSatisfied(new TestRouteBuilder() {
        @Override
        protected void configureTest() throws Exception {
            // expectations
            results.expectedBodiesReceived(payload);
            results.setResultWaitTime(60 * 1000L);

            from("timer://poller?delay=10000&period=2000").errorHandler(deadLetterChannel(errors)).
                    to(pollUrl).
                    unmarshal().json(JsonLibrary.Jackson, SamplePayload.class).
                    to(results);
        }
    });
}
项目:Camel    文件:JacksonJsonDataFormatTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:in").marshal().json(JsonLibrary.Jackson);
            from("direct:back").unmarshal().json(JsonLibrary.Jackson).to("mock:reverse");

            from("direct:inPretty").marshal().json(JsonLibrary.Jackson, true);
            from("direct:backPretty").unmarshal().json(JsonLibrary.Jackson).to("mock:reverse");

            from("direct:inPojo").marshal().json(JsonLibrary.Jackson);
            from("direct:backPojo").unmarshal().json(JsonLibrary.Jackson, TestPojo.class).to("mock:reversePojo");
        }
    };
}
项目:Camel    文件:JacksonMarshalViewTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {

            // START SNIPPET: format
            from("direct:inPojoAgeView").marshal().json(TestPojoView.class, Views.Age.class);
            // END SNIPPET: format
            from("direct:backPojoAgeView").unmarshal().json(JsonLibrary.Jackson, TestPojoView.class).to("mock:reversePojoAgeView");

            from("direct:inPojoWeightView").marshal().json(TestPojoView.class, Views.Weight.class);
            from("direct:backPojoWeightView").unmarshal().json(JsonLibrary.Jackson, TestPojoView.class).to("mock:reversePojoWeightView");
        }
    };
}
项目:camel-cxfrs-jdbc-rest    文件:RestRouteBuilder.java   
@Override
public void configure() throws Exception {
      from("cxfrs:http://0.0.0.0:9090?resourceClasses=cc.notsoclever.examples.CompanyService&bindingStyle=SimpleConsumer")
            .choice()
                .when(header("operationName").isEqualTo("getCompany"))
                  .to("sql:SELECT * from company where id = :#id")
                .when(header("operationName").isEqualTo("createCompany"))
                  .to("sql:INSERT INTO company(name, symbol) VALUES (:#name, :#symbol)")
                .when(header("operationName").isEqualTo("getCompanies"))
                  .to("sql:select * from company")
                .when(header("operationName").isEqualTo("updateCompany"))
                  .to("sql:UPDATE company SET name = :#name, symbol = :#symbol where id = :#id")
                .when(header("operationName").isEqualTo("deleteCompany"))
                 .to("sql:DELETE FROM company where id = :#id")
            .end()
            .marshal().json(JsonLibrary.Jackson);
}
项目:wildfly-camel    文件:JSONDataFormatTest.java   
@Test
public void testMarshalXStream() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .marshal().json(JsonLibrary.XStream);
        }
    });

    String expected = "{'" + Customer.class.getName() + "':{'firstName':'John','lastName':'Doe'}}";

    camelctx.start();
    try {
        ProducerTemplate producer = camelctx.createProducerTemplate();
        String result = producer.requestBody("direct:start", new Customer("John", "Doe"), String.class);
        Assert.assertEquals(expected.replace('\'', '"'), result);
    } finally {
        camelctx.stop();
    }
}
项目:wildfly-camel    文件:JSONDataFormatTest.java   
@Test
public void testUnmarshalXStream() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .unmarshal().json(JsonLibrary.XStream, Customer.class);
        }
    });

    String input = "{'" + Customer.class.getName() + "':{'firstName':'John','lastName':'Doe'}}";

    camelctx.start();
    try {
        ProducerTemplate producer = camelctx.createProducerTemplate();
        Customer customer = producer.requestBody("direct:start", input, Customer.class);
        Assert.assertEquals("John", customer.getFirstName());
        Assert.assertEquals("Doe", customer.getLastName());
    } finally {
        camelctx.stop();
    }
}
项目:wildfly-camel    文件:JSONDataFormatTest.java   
@Test
public void testMarshalJackson() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .marshal().json(JsonLibrary.Jackson);
        }
    });

    String expected = "{'firstName':'John','lastName':'Doe'}";

    camelctx.start();
    try {
        ProducerTemplate producer = camelctx.createProducerTemplate();
        String result = producer.requestBody("direct:start", new Customer("John", "Doe"), String.class);
        Assert.assertEquals(expected.replace('\'', '"'), result);
    } finally {
        camelctx.stop();
    }
}
项目:wildfly-camel    文件:JSONDataFormatTest.java   
@Test
public void testUnmarshalJackson() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .unmarshal().json(JsonLibrary.Jackson, Customer.class);
        }
    });

    String input = "{'firstName':'John','lastName':'Doe'}";

    camelctx.start();
    try {
        ProducerTemplate producer = camelctx.createProducerTemplate();
        Customer customer = producer.requestBody("direct:start", input.replace('\'', '"'), Customer.class);
        Assert.assertEquals("John", customer.getFirstName());
        Assert.assertEquals("Doe", customer.getLastName());
    } finally {
        camelctx.stop();
    }
}
项目:wildfly-camel    文件:JSONDataFormatTest.java   
@Test
public void testMarshalGson() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .marshal().json(JsonLibrary.Gson);
        }
    });

    String expected = "{'firstName':'John','lastName':'Doe'}";

    camelctx.start();
    try {
        ProducerTemplate producer = camelctx.createProducerTemplate();
        String result = producer.requestBody("direct:start", new Customer("John", "Doe"), String.class);
        Assert.assertEquals(expected.replace('\'', '"'), result);
    } finally {
        camelctx.stop();
    }
}
项目:wildfly-camel    文件:JSONDataFormatTest.java   
@Test
public void testUnmarshalGson() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .unmarshal().json(JsonLibrary.Gson, Customer.class);
        }
    });

    String input = "{'firstName':'John','lastName':'Doe'}";

    camelctx.start();
    try {
        ProducerTemplate producer = camelctx.createProducerTemplate();
        Customer customer = producer.requestBody("direct:start", input.replace('\'', '"'), Customer.class);
        Assert.assertEquals("John", customer.getFirstName());
        Assert.assertEquals("Doe", customer.getLastName());
    } finally {
        camelctx.stop();
    }
}
项目:wildfly-camel    文件:JSONDataFormatTest.java   
@Test
public void testMarshalJohnzon() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .marshal().json(JsonLibrary.Johnzon);
        }
    });

    String expected = "{'firstName':'John','lastName':'Doe'}";

    camelctx.start();
    try {
        ProducerTemplate producer = camelctx.createProducerTemplate();
        String result = producer.requestBody("direct:start", new Customer("John", "Doe"), String.class);
        Assert.assertEquals(expected.replace('\'', '"'), result);
    } finally {
        camelctx.stop();
    }
}
项目:wildfly-camel    文件:JSONDataFormatTest.java   
@Test
public void testUnmarshalJohnzon() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .unmarshal().json(JsonLibrary.Johnzon, Customer.class);
        }
    });

    String input = "{'firstName':'John','lastName':'Doe'}";

    camelctx.start();
    try {
        ProducerTemplate producer = camelctx.createProducerTemplate();
        Customer customer = producer.requestBody("direct:start", input.replace('\'', '"'), Customer.class);
        Assert.assertEquals("John", customer.getFirstName());
        Assert.assertEquals("Doe", customer.getLastName());
    } finally {
        camelctx.stop();
    }
}
项目:kagura    文件:ServerRoutes.java   
@Override
public void configure() throws Exception {
    from("cxfrs:bean:rsServer?bindingStyle=SimpleConsumer")
            .log("Executed ${header.operationName}")
            .recipientList(simple("direct:rs-${header.operationName}"))
            .routeId("cxfrsInRouteId");

    from("direct:rs-test")
            .setBody(simple("hi"))
            .routeId("rsTestRouteId");

    from("direct:rs-test2")
            .process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                    exchange.getIn().setBody(exchange.getIn().getHeaders().keySet());
                }
            })
            .marshal().json(JsonLibrary.Jackson)
            .routeId("rsTest2RouteId");

}
项目:syndesis    文件:SplitHandler.java   
@Override
public Optional<ProcessorDefinition> handle(Split step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
    CamelContext context = routeBuilder.getContext();
    Expression expression = JsonSimpleHelpers.getMandatoryExpression(context, step, step.getExpression());
    ProcessorDefinition split = route.split(expression).marshal().json(JsonLibrary.Jackson);

    routeBuilder.addSteps(split, step.getSteps());

    return Optional.empty();
}
项目:syndesis-integration-runtime    文件:SplitHandler.java   
@Override
public ProcessorDefinition handle(Split step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
    CamelContext context = routeBuilder.getContext();
    Expression expression = JsonSimpleHelpers.getMandatoryExpression(context, step, step.getExpression());
    ProcessorDefinition split = route.split(expression).marshal().json(JsonLibrary.Jackson);
    return routeBuilder.addSteps(split, step.getSteps());
}
项目:openex-worker    文件:OpenexContext.java   
private void createContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("openexRouter", new OpenexRouter());
    registry.put("openexStrategy", new OpenexAggregationStrategy());
    registry.put("openexCallback", new OpenexCallbackBuilder());
    context.setRegistry(registry);
    context.addComponent("properties", buildPropertiesComponent());
    context.getExecutorServiceManager().registerThreadPoolProfile(threadPoolProfileRemote());
    context.getExecutorServiceManager().registerThreadPoolProfile(threadPoolProfileExecutor());
    context.setTracing(true);

    //Populate data formats
    JsonDataFormat jsonDataFormat = new JsonDataFormat(JsonLibrary.Gson);
    jsonDataFormat.setUseList(true);
    context.setDataFormats(Collections.singletonMap("json", jsonDataFormat));

    //Rest direct call routes
    InputStream defaultRoutesStream = getClass().getResourceAsStream("routes.xml");
    context.addRouteDefinitions(context.loadRoutesDefinition(defaultRoutesStream).getRoutes());

    //Dynamic routes building
    for (Executor executor : workerRegistry.workers().values()) {
        registerCamelModule(executor);
    }

    //Starting context
    context.start();
}
项目:hacep    文件:ExecuteCommandsFromJmsRoute.java   
@Override
public void configure() throws Exception {
    from("jms:" + queueName)
            .setExchangePattern(ExchangePattern.InOut)
            .to("log:it.redhat.hacep.camel.Router?level=INFO&showAll=true&multiline=true")
            .unmarshal().json(JsonLibrary.Jackson, Command.class)
            .to("direct:execute-command");

    from("direct:execute-command")
            .setExchangePattern(ExchangePattern.InOut)
            .recipientList()
            .simple("direct:${body.command}");
}
项目:Camel    文件:JacksonConcurrentTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:start").
                    marshal().json(JsonLibrary.Jackson).
                    to("log:marshalled").
                    to("direct:marshalled");

            from("direct:marshalled").
                    unmarshal().json(JsonLibrary.Jackson, TestPojo.class).
                    to("mock:result");
        }
    };
}
项目:Camel    文件:UnmarshalThenMarshalJSONTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:start").
                    marshal().json(JsonLibrary.XStream, PurchaseOrder.class).
                    process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            log.debug("marshalled: " + exchange.getIn().getBody(String.class));
                        }
                    }).
                    unmarshal().json(JsonLibrary.XStream, PurchaseOrder.class).
                    to("mock:result");
        }
    };
}
项目:Camel    文件:MarshalDomainObjectJSONTest.java   
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        public void configure() throws Exception {
            from("direct:in").marshal().json().to("mock:result");

            // just used for helping to marshal
            from("direct:marshal").marshal().json();

            from("direct:reverse").unmarshal().json(JsonLibrary.XStream, PurchaseOrder.class).to("mock:reverse");

            from("direct:inPretty").marshal().json(true);
            from("direct:backPretty").unmarshal().json(JsonLibrary.XStream, PurchaseOrder.class, true).to("mock:reverse");
        }
    };
}
项目:Camel    文件:GsonConcurrentTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:start").
                    marshal().json(JsonLibrary.Gson).
                    to("log:marshalled").
                    to("direct:marshalled");

            from("direct:marshalled").
                    unmarshal().json(JsonLibrary.Gson, TestPojo.class).
                    to("mock:result");
        }
    };
}
项目:Camel    文件:GsonJsonDataFormatTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:in").marshal().json(JsonLibrary.Gson);
            from("direct:back").unmarshal().json(JsonLibrary.Gson).to("mock:reverse");

            from("direct:inPojo").marshal().json(JsonLibrary.Gson);
            from("direct:backPojo").unmarshal().json(JsonLibrary.Gson, TestPojo.class).to("mock:reversePojo");

            from("direct:json").unmarshal().json(JsonLibrary.Gson, Map.class);
        }
    };
}
项目:camelinaction2    文件:PurchaseOrderJSONTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("jetty://http://0.0.0.0:8080/order/service")
                .bean("orderService", "lookup")
                .marshal().json(JsonLibrary.Jackson);
        }
    };
}
项目:camelskeleton    文件:DemoRoute.java   
@Override
public void configure() {
    from(demoFolder).routeId(getClass().getSimpleName())
        .convertBodyTo(String.class)
        .wireTap(wireTap)
        .process(demoProcessor).id("MyProcessor")
        .marshal().json(JsonLibrary.Gson)
        .convertBodyTo(String.class)
        .to(demoLogger);
}
项目:citrus-demo-devoxx    文件:BakeryRouter.java   
@Override
public void configure() throws Exception {
    restConfiguration()
            .component("servlet")
            .contextPath("bakery/services")
            .port(18001)
            .dataFormatProperty("prettyPrint", "true");

    rest("/order")
        .consumes("application/json")
        .post().route().unmarshal().json(JsonLibrary.Jackson).process(this).to("direct:bakery");

    from("jms:queue:bakery.order.inbound").routeId("bakery_jms_inbound")
        .to("direct:bakery");

    from("direct:bakery").routeId("bakery")
        .choice()
            .when(xpath("order/type/text() = 'blueberry'"))
                .inOnly("jms:queue:factory.blueberry.inbound")
            .when(xpath("order/type/text() = 'caramel'"))
                .inOnly("jms:queue:factory.caramel.inbound")
            .when(xpath("order/type/text() = 'chocolate'"))
                .inOnly("jms:queue:factory.chocolate.inbound")
            .otherwise()
                .inOnly("jms:queue:factory.unknown.inbound")
        .end()
        .setBody(simple(""));
}
项目:camelinaction    文件:PurchaseOrderJSONTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("jetty://http://0.0.0.0:8080/order/service")
                .beanRef("orderService", "lookup")
                .marshal().json(JsonLibrary.Jackson);
        }
    };
}
项目:boundary-event-sdk    文件:MeterRouteBuilder.java   
@Override
public void configure() {
    String url = getUrl();
    LOG.info("url: " + url);

    // Configure the HTTP endpoint
    setConfiguration();

    RouteDefinition routeDefinition = from(fromUri)
        .startupOrder(startUpOrder)
        .routeId(routeId)
        .unmarshal().serialization()
        .log(INFO,"MeterData: ${body}")
        .bean(MeterAPIProcessor.class, "process")
        .marshal().json(JsonLibrary.Jackson)
        .setHeader(HTTP_AUTHORIZATION,constant(" Basic " + getAuthentication()))
        .setHeader(Exchange.ACCEPT_CONTENT_TYPE, constant("application/json"))
        .setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
        .setHeader(Exchange.HTTP_METHOD, constant("POST"))
        .to("log:com.boundary.sdk.metric.MeasureRouteBuilder?level=INFO&groupInterval=60000&groupDelay=60000&groupActiveOnly=false")
        .log(INFO, url.toString())
        .log(INFO,"${headers}")
        .to(url.toString())
        .log(DEBUG,"HTTP Method: ${headers.CamelHttpMethod},AcceptContentType={headers.CamelAcceptContentType}")
        .log(INFO,"HTTP Response Code: ${headers.CamelHttpResponseCode},Location: ${headers.Location}")
        ;
    if (getToUri() != null) {
        routeDefinition.to(getToUri());
    }
}
项目:boundary-event-sdk    文件:MeasureRouteBuilder.java   
@Override
public void configure() {
    String url = getUrl();

    // Configure the HTTP endpoint
    setConfiguration();

    RouteDefinition routeDefinition = from(this.getFromUri())
        .startupOrder(startUpOrder)
        .routeId(routeId)
        .unmarshal().serialization()
        .marshal().json(JsonLibrary.Jackson)
        .log(INFO,"Measurement: ${body}")
        .setHeader(HTTP_AUTHORIZATION,constant(" Basic " + getAuthentication()))
        .setHeader(Exchange.ACCEPT_CONTENT_TYPE, constant("application/json"))
        .setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
        .setHeader(Exchange.HTTP_METHOD, constant("POST"))
        .to("log:com.boundary.sdk.metric.MeasureRouteBuilder?level=INFO&groupInterval=60000&groupDelay=60000&groupActiveOnly=false")
        .log(DEBUG, url.toString())
        .log(DEBUG,"${headers}")
        .to(url.toString())
        .log(DEBUG,"HTTP Method: ${headers.CamelHttpMethod},AcceptContentType={headers.CamelAcceptContentType}")
        .log(INFO,"HTTP Response Code: ${headers.CamelHttpResponseCode}")
        ;
    if (this.getToUri() != null && this.getToUri().length() > 0) {
        routeDefinition.to(getToUri());
    }
}
项目:boundary-event-sdk    文件:BoundaryEventRouteBuilder.java   
/**
 * Configures the Camel route that receives {@link RawEvent}
 * and then sends to the Boundary API
 * 
 */
@Override
public void configure() {
    // Create the URL used to send events
    String url = String.format("https://%s:%d/v%d/events",host,port,version);
    LOG.debug("boundary event api url: " + url);

    // Configure our HTTP connection to use BASIC authentication
    HttpConfiguration config = new HttpConfiguration();
    config.setAuthMethod(AuthMethod.Basic);
    config.setAuthUsername(this.getUser());
    config.setAuthPassword(this.getPassword());

    HttpComponent http = this.getContext().getComponent("https",HttpComponent.class);
    http.setHttpConfiguration(config);

    from(fromUri)
        .startupOrder(startUpOrder)
        .routeId(routeId)
        .unmarshal().serialization()
        .marshal().json(JsonLibrary.Jackson)
        .log(INFO,"RawEvent: ${body}")
        .setHeader(Exchange.ACCEPT_CONTENT_TYPE, constant("application/json"))
        .setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
        .setHeader(Exchange.HTTP_METHOD, constant("POST"))
        .to("log:com.boundary.sdk.event.BoundaryEventRouteBuilder?level=INFO&groupInterval=60000&groupDelay=60000&groupActiveOnly=false")
        .to(url.toString())
        .log(DEBUG,"HTTP Method: ${headers.CamelHttpMethod},AcceptContentType={headers.CamelAcceptContentType}")
        .log(INFO,"HTTP Response Code: ${headers.CamelHttpResponseCode},Location: ${headers.Location}")
        ;
}
项目:boundary-event-sdk    文件:WebHookRouteBuilder.java   
@Override
    public void configure() throws Exception {
        String s = null;

        // Create an instance of JacksonDataFormat to convert to JSON to
        // a {@link Notification} instance
        JacksonDataFormat format = new JacksonDataFormat();
        format.setUnmarshalType(Notification.class);
        from(getFromUri())
        .routeId(getRouteId())
        .startupOrder(getStartUpOrder())
//      .log(DEBUG,"headers: ${headers}")
//      .log(DEBUG,"body: ${body}")
//      .log(DEBUG,"body: ${body}")
//      .log(DEBUG,"class: ${body.getClass.toString}")
//      .process(new Processor() {
//                  public void process(Exchange exchange) throws Exception {
//                      HttpMessage msg = exchange.getIn(HttpMessage.class);
//
//                      InputStreamCache sis = msg.getBody(InputStreamCache.class);
//
//                      String s = exchange.getContext().getTypeConverter().convertTo(String.class, sis);
//                      LOG.debug("process body: " + s);
//
//                      Message newMessage = new DefaultMessage();
//                      newMessage.setHeaders(msg.getHeaders());
//                      newMessage.setBody(s);
//                      exchange.setIn(newMessage);
//                  }
//      })
//      .log(DEBUG,"BEFORE CLASS: ${body.getClass.toString}")
//      .log(DEBUG,"BEFORE SIZE: ${body.length}")
//      .log(DEBUG,"BEFORE BODY: ${body}")
//      .unmarshal().string("UTF-8")
//      .log(DEBUG,"AFTER CLASS: ${body.getClass.toString}")
//      .log(DEBUG,"AFTER SIZE: ${body.length}")
//      .log(DEBUG,"AFTER BODY: ${body}")
        .unmarshal().json(JsonLibrary.Jackson,Notification.class)
        .to(getToUri());
    }
项目:HelloMySQL    文件:HelloRoute.java   
@Override
public void configure() throws Exception {
    from("servlet:///list")
        .to("log:in")
        .to("sql:SELECT * FROM  myitems WHERE user_id = :#id")
        .marshal().json(JsonLibrary.Gson)
        .to("log:out");
}
项目:camel-cookbook-examples    文件:JsonRoute.java   
@Override
public void configure() throws Exception {
    from("direct:marshal")
        .marshal().json(JsonLibrary.XStream)
        .to("mock:marshalResult");

    from("direct:unmarshal")
        .unmarshal().json(JsonLibrary.XStream, View.class)
        .to("mock:unmarshalResult");
}
项目:camel-cookbook-examples    文件:JsonJacksonRoute.java   
@Override
public void configure() throws Exception {
    from("direct:marshal")
        .marshal().json(JsonLibrary.Jackson)
        .to("mock:marshalResult");

    from("direct:unmarshal")
        .unmarshal().json(JsonLibrary.Jackson, View.class)
        .to("mock:unmarshalResult");
}
项目:osgicxfcamelmultiparams    文件:RestToBeanRouter.java   
@Override
public void configure() throws Exception {

    from ("cxfrs://bean://rsServer")
            .process(new ParamProcessor())
            .multicast()
            .parallelProcessing()
            .aggregationStrategy(new ResultAggregator())
            .beanRef("restServiceImpl", "getNameEmailResult")
            .beanRef("restServiceImpl", "getAgePhoneResult")
            .end()
            .marshal().json(JsonLibrary.Jackson)
            .to("log://camelLogger?level=DEBUG");
}
项目:karafcxfcamel    文件:RestToBeanRouter.java   
@Override
public void configure() throws Exception {

    from ("cxfrs://bean://rsServer")
            .multicast()
            .parallelProcessing()
            .aggregationStrategy(new ResultAggregator())
            .beanRef("restServiceImpl", "getNameEmailResult")
            .beanRef("restServiceImpl", "getAgePhoneResult")
            .end()
            .marshal().json(JsonLibrary.Jackson)
            .to("log://camelLogger?level=DEBUG");
}
项目:jentrata    文件:RestApiRouteBuilder.java   
@Override
public void configure() throws Exception {
    from(restAPIEndpoint)
        .setExchangePattern(ExchangePattern.InOut)
        .removeHeader("accept-encoding")
        .process(new HttpPathProcessor())
        .recipientList(simple("direct:${header.serviceName}-${header.operationName}"))
        .choice()
            .when(header(EbmsConstants.CONTENT_TYPE).isEqualTo("application/json"))
                .marshal().json(JsonLibrary.Jackson)
         .end()
        .process(new HttpResponseProcessor())
    .routeId("_jentrataRestApiImpl");

}
项目:kagura    文件:ReportsRoutes.java   
@Override
public void configure() throws Exception {
    DataFormat jsonDataFormat = new JacksonDataFormat();
    from("cxfrs:bean:rsReportsServer?bindingStyle=SimpleConsumer")
            .log("Executing ${header.operationName}")
            .doTry()
                .beanRef("authBean", "isLoggedIn")
                .beanRef("authBean", "canAccessReport")
                .recipientList(simple("direct:rs-${header.operationName}")).end()
            .doCatch(AuthenticationException.class)
                .log("Authentication failed ${header.operationName}")
                .beanRef("authBean", "buildAuthFail")
                .marshal(jsonDataFormat)
            .doCatch(AuthorizationException.class)
                .log("Report authorization failed ${header.operationName} ${header.reportId}")
                .beanRef("reportBean", "noSuchReport")
                .marshal(jsonDataFormat)
            .end()
            .routeId("cxfrsReportsInRouteId");

    from("direct:rs-reportDetails")
            .beanRef("reportBean", "getReportsDetailed")
            .marshal().json(JsonLibrary.Jackson)
            .routeId("rsReportDetailsRouteId");

    from("direct:rs-runReport")
            .beanRef("reportBean", "run")
            .marshal().json(JsonLibrary.Jackson)
            .routeId("rsRunReportRouteId");

    from("direct:rs-detailsAndRunReport")
            .beanRef("reportBean", "detailsAndRun")
            .marshal().json(JsonLibrary.Jackson)
            .routeId("rsDetailsAndRunReportRouteId");

    from("direct:rs-exportReport")
            .beanRef("reportBean", "export")
            .routeId("rsExportReportRouteId");
}
项目:java-intro-course    文件:EnrichRouteGetAggregate.java   
@Override
public void configure() throws Exception {
    from("timer://ordergen").bean(new OrderGenerator(), "generate")
            .enrich("direct:enricher", new OrderAggregationStrategy()).marshal().json(JsonLibrary.Jackson)
            .log("${body}");
    from("direct:enricher")
            .setHeader(Exchange.HTTP_URI, simple("http://localhost:8680/rest/order/lookup/${body.orderNumber}"))
            .transform().simple("${null}").to("http://ignored").unmarshal().json(JsonLibrary.Jackson, OrderInfo.class);
}
项目:java-intro-course    文件:EnrichRoutePost.java   
@Override
public void configure() throws Exception {
    from("timer://ordergen").bean(new OrderGenerator(), "generate")
            .marshal().json(JsonLibrary.Jackson)
            .setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
            .enrich("http://localhost:8680/rest/order/lookup").log("${body}");
}
项目:t4f-data    文件:PurchaseOrderJSONTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("jetty://http://0.0.0.0:8080/order/service")
                .beanRef("orderService", "lookup")
                .marshal().json(JsonLibrary.Jackson);
        }
    };
}