Package org.apache.camel.component.http4

Examples of org.apache.camel.component.http4.HttpProducer


        if (queryString == null) {
            queryString = endpoint.getHttpUri().getRawQuery();
        }

        // compute what method to use either GET or POST
        HttpMethods answer;
        HttpMethods m = exchange.getIn().getHeader(Exchange.HTTP_METHOD, HttpMethods.class);
        if (m != null) {
            // always use what end-user provides in a header
            answer = m;
        } else if (queryString != null) {
            // if a query string is provided then use GET
View Full Code Here


        assertEquals("http://www.google.com/search", url);
    }

    @Test
    public void createMethodAlwaysUseUserChoosenMethod() throws URISyntaxException {
        HttpMethods method = HttpHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader("q=camel", HttpMethods.POST),
                createHttpEndpoint(true, "http://www.google.com/search"),
                false);

        assertEquals(HttpMethods.POST, method);
View Full Code Here

        assertEquals(HttpMethods.POST, method);
    }

    @Test
    public void createMethodUseGETIfQueryIsProvidedInHeader() throws URISyntaxException {
        HttpMethods method = HttpHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader("q=camel", null),
                createHttpEndpoint(true, "http://www.google.com/search"),
                false);

        assertEquals(HttpMethods.GET, method);
View Full Code Here

        assertEquals(HttpMethods.GET, method);
    }

    @Test
    public void createMethodUseGETIfQueryIsProvidedInEndpointURI() throws URISyntaxException {
        HttpMethods method = HttpHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, null),
                createHttpEndpoint(true, "http://www.google.com/search?q=test"),
                false);

        assertEquals(HttpMethods.GET, method);
View Full Code Here

        assertEquals(HttpMethods.GET, method);
    }

    @Test
    public void createMethodUseGETIfNoneQueryOrPayloadIsProvided() throws URISyntaxException {
        HttpMethods method = HttpHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, null),
                createHttpEndpoint(true, "http://www.google.com/search"),
                false);

        assertEquals(HttpMethods.GET, method);
View Full Code Here

        assertEquals(HttpMethods.GET, method);
    }

    @Test
    public void createMethodUsePOSTIfNoneQueryButPayloadIsProvided() throws URISyntaxException {
        HttpMethods method = HttpHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, null),
                createHttpEndpoint(true, "http://www.google.com/search"),
                true);

        assertEquals(HttpMethods.POST, method);
View Full Code Here

      initHttpEndpoint(exchange);
     
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Creating new HTTP producer");
      }
      HttpProducer httpProducer = new HttpLoadBalancerProducer(httpEndpoint);
     
      if(this.primaryLoadBalancer != null) {
        if (LOGGER.isDebugEnabled()) {
          LOGGER.debug("Setting HTTP producer on primary load balancer");
        }
View Full Code Here

        return registry;
    }

    @Test
    public void httpsGetWithAuthentication() throws Exception {
        localServer.register("/", new AuthenticationValidationHandler("GET", null, null, getExpectedContent(), user, password));

        Exchange exchange = template.request("https4://127.0.0.1:" + getPort() + "/?username=camel&password=password&x509HostnameVerifier=x509HostnameVerifier", new Processor() {
            public void process(Exchange exchange) throws Exception {
            }
        });
View Full Code Here

        return httpproc;
    }

    @Override
    protected void registerHandler(LocalTestServer server) {
        server.register("/search", new AuthenticationValidationHandler("GET", null, null, getExpectedContent(), user, password));
    }
View Full Code Here

        return httpproc;
    }

    @Override
    protected void registerHandler(LocalTestServer server) {
        server.register("/search", new AuthenticationValidationHandler("GET", null, null, getExpectedContent(), user, password));
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.component.http4.HttpProducer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.