Search in sources :

Example 1 with HttpEndpoint

use of org.apache.camel.component.http.HttpEndpoint in project camel by apache.

the class HttpHelperTest method createHttpEndpoint.

private HttpEndpoint createHttpEndpoint(boolean bridgeEndpoint, String endpointURI) throws URISyntaxException {
    HttpEndpoint endpoint = new HttpEndpoint();
    endpoint.setBridgeEndpoint(bridgeEndpoint);
    if (endpointURI != null) {
        endpoint.setHttpUri(new URI(endpointURI));
    }
    return endpoint;
}
Also used : HttpEndpoint(org.apache.camel.component.http.HttpEndpoint) URI(java.net.URI)

Example 2 with HttpEndpoint

use of org.apache.camel.component.http.HttpEndpoint in project camel by apache.

the class HttpMethodsHelperTest method createHttpEndpoint.

private HttpEndpoint createHttpEndpoint(boolean bridgeEndpoint, String endpointURI) throws URISyntaxException {
    HttpEndpoint endpoint = new HttpEndpoint();
    endpoint.setBridgeEndpoint(bridgeEndpoint);
    if (endpointURI != null) {
        endpoint.setHttpUri(new URI(endpointURI));
    }
    return endpoint;
}
Also used : HttpEndpoint(org.apache.camel.component.http.HttpEndpoint) URI(java.net.URI)

Example 3 with HttpEndpoint

use of org.apache.camel.component.http.HttpEndpoint in project camel by apache.

the class HttpBridgeMultipartRouteTest method createRouteBuilder.

protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        public void configure() {
            port1 = getPort();
            port2 = getNextPort();
            errorHandler(noErrorHandler());
            Processor serviceProc = new Processor() {

                public void process(Exchange exchange) throws Exception {
                    Message in = exchange.getIn();
                    // put the number of attachments in a response header
                    exchange.getOut().setHeader("numAttachments", in.getAttachments().size());
                    exchange.getOut().setBody(in.getHeader("body"));
                }
            };
            HttpEndpoint epOut = getContext().getEndpoint("http://localhost:" + port1 + "?bridgeEndpoint=true&throwExceptionOnFailure=false", HttpEndpoint.class);
            epOut.setHeaderFilterStrategy(new MultipartHeaderFilterStrategy());
            from("jetty:http://localhost:" + port2 + "/test/hello?enableMultipartFilter=false").to(epOut);
            from("jetty://http://localhost:" + port1 + "?matchOnUriPrefix=true").process(serviceProc);
        }
    };
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) RouteBuilder(org.apache.camel.builder.RouteBuilder) Message(org.apache.camel.Message) HttpEndpoint(org.apache.camel.component.http.HttpEndpoint)

Aggregations

HttpEndpoint (org.apache.camel.component.http.HttpEndpoint)3 URI (java.net.URI)2 Exchange (org.apache.camel.Exchange)1 Message (org.apache.camel.Message)1 Processor (org.apache.camel.Processor)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1