Http Endpoint

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Http Endpoint

jpcook01
Hello,

I am playing around with the http endpoint in camel 2 and I thought a good starting point would be to run the testHttpGet() in http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java

So nothing happens. It just hangs. I suspect this might be because I need to configure a proxy but I'm not sure how to do that and I can't find any examples really apart from an old post but again it isn't clear to me.

This is the configure method:
@Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() {            
            from("direct:start")
                .setHeader(HttpConstants.HTTP_METHOD, constant(org.apache.camel.component.http.HttpMethods.GET))
                    .to("http://www.google.co.uk").to("mock:results");
            }
        };
    }

I also tried specifying the time out in the endpoint eg)
"http://www.google.co.uk?httpClient.soTimeout(5000)"

But that didn't do anything. I wasn't sure if there was a way I could at least get something back.

I've also read this useful page. Maybe it would be useful to have an example as most corporations will be using proxy servers. http://camel.apache.org/http.html

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

Claus Ibsen-2
On Thu, May 7, 2009 at 6:37 PM, jpcook <[hidden email]> wrote:

>
> Hello,
>
> I am playing around with the http endpoint in camel 2 and I thought a good
> starting point would be to run the testHttpGet() in
> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>
> So nothing happens. It just hangs. I suspect this might be because I need to
> configure a proxy but I'm not sure how to do that and I can't find any
> examples really apart from an old post but again it isn't clear to me.
>
> This is the configure method:
> @Override
>    protected RouteBuilder createRouteBuilder() throws Exception {
>        return new RouteBuilder() {
>            public void configure() {
>                from("direct:start")
>                .setHeader(HttpConstants.HTTP_METHOD,
> constant(org.apache.camel.component.http.HttpMethods.GET))
>                    .to("http://www.google.co.uk").to("mock:results");
>            }
>        };
>    }
>
> I also tried specifying the time out in the endpoint eg)
> "http://www.google.co.uk?httpClient.soTimeout(5000)"
You should set it with = as parameter, its like URI parameters.
"http://www.google.co.uk?httpClient.soTimeout=5000"



>
> But that didn't do anything. I wasn't sure if there was a way I could at
> least get something back.
>
> I've also read this useful page. Maybe it would be useful to have an example
> as most corporations will be using proxy servers.
> http://camel.apache.org/http.html
Yeah socket proxy in Java kinda sucks as you often need to set it with
system properties.

Maybe  the HTTP client have nice configuration for proxy. Feel free to
look at Apache HTTP Client how to work with proxy.
And report your findings, then we can improve Camel to ease the proxy
configuration.


>
> Thanks
> --
> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

jpcook01
And is it possible to get at the Apache HttpClient via the Camel Http endpoint?
Claus Ibsen-2 wrote
On Thu, May 7, 2009 at 6:37 PM, jpcook <jonathan.cook@erars.plus.com> wrote:
>
> Hello,
>
> I am playing around with the http endpoint in camel 2 and I thought a good
> starting point would be to run the testHttpGet() in
> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>
> So nothing happens. It just hangs. I suspect this might be because I need to
> configure a proxy but I'm not sure how to do that and I can't find any
> examples really apart from an old post but again it isn't clear to me.
>
> This is the configure method:
> @Override
>    protected RouteBuilder createRouteBuilder() throws Exception {
>        return new RouteBuilder() {
>            public void configure() {
>                from("direct:start")
>                .setHeader(HttpConstants.HTTP_METHOD,
> constant(org.apache.camel.component.http.HttpMethods.GET))
>                    .to("http://www.google.co.uk").to("mock:results");
>            }
>        };
>    }
>
> I also tried specifying the time out in the endpoint eg)
> "http://www.google.co.uk?httpClient.soTimeout(5000)"
You should set it with = as parameter, its like URI parameters.
"http://www.google.co.uk?httpClient.soTimeout=5000"



>
> But that didn't do anything. I wasn't sure if there was a way I could at
> least get something back.
>
> I've also read this useful page. Maybe it would be useful to have an example
> as most corporations will be using proxy servers.
> http://camel.apache.org/http.html
Yeah socket proxy in Java kinda sucks as you often need to set it with
system properties.

Maybe  the HTTP client have nice configuration for proxy. Feel free to
look at Apache HTTP Client how to work with proxy.
And report your findings, then we can improve Camel to ease the proxy
configuration.


>
> Thanks
> --
> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

Claus Ibsen-2
On Thu, May 7, 2009 at 10:03 PM, jpcook <[hidden email]> wrote:
>
> And is it possible to get at the Apache HttpClient via the Camel Http
> endpoint?
Yes there should be some getter/setters to configure how you like it.


>
> Claus Ibsen-2 wrote:
>>
>> On Thu, May 7, 2009 at 6:37 PM, jpcook <[hidden email]>
>> wrote:
>>>
>>> Hello,
>>>
>>> I am playing around with the http endpoint in camel 2 and I thought a
>>> good
>>> starting point would be to run the testHttpGet() in
>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>>>
>>> So nothing happens. It just hangs. I suspect this might be because I need
>>> to
>>> configure a proxy but I'm not sure how to do that and I can't find any
>>> examples really apart from an old post but again it isn't clear to me.
>>>
>>> This is the configure method:
>>> @Override
>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>        return new RouteBuilder() {
>>>            public void configure() {
>>>                from("direct:start")
>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>            }
>>>        };
>>>    }
>>>
>>> I also tried specifying the time out in the endpoint eg)
>>> "http://www.google.co.uk?httpClient.soTimeout(5000)"
>> You should set it with = as parameter, its like URI parameters.
>> "http://www.google.co.uk?httpClient.soTimeout=5000"
>>
>>
>>
>>>
>>> But that didn't do anything. I wasn't sure if there was a way I could at
>>> least get something back.
>>>
>>> I've also read this useful page. Maybe it would be useful to have an
>>> example
>>> as most corporations will be using proxy servers.
>>> http://camel.apache.org/http.html
>> Yeah socket proxy in Java kinda sucks as you often need to set it with
>> system properties.
>>
>> Maybe  the HTTP client have nice configuration for proxy. Feel free to
>> look at Apache HTTP Client how to work with proxy.
>> And report your findings, then we can improve Camel to ease the proxy
>> configuration.
>>
>>
>>>
>>> Thanks
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
>>> Sent from the Camel - Users (activemq) mailing list archive at
>>> Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> Apache Camel Reference Card:
>> http://refcardz.dzone.com/refcardz/enterprise-integration
>> Interview with me:
>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23434084.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

jpcook01
In reply to this post by jpcook01
I have successfully created a simple unit test testing a get using the apache http client without camel.

public static void main(String[] args) {
                // TODO Auto-generated method stub
                HttpClient client = new HttpClient();
        HttpMethod method = new GetMethod("http://www.google.co.uk");
 
        HostConfiguration config = client.getHostConfiguration();
        config.setProxy(PROXY_HOST, PROXY_PORT);      
 
        try {
            client.executeMethod(method);
 
            if (method.getStatusCode() == HttpStatus.SC_OK) {
                String response = method.getResponseBodyAsString();
                System.out.println("Response = " + response);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            method.releaseConnection();
        }
    }    

The above works nicely. However I'm struggling to put this back into my configure method with camel.

public void configure() {
            HttpClient client = new HttpClient();
            client.getHostConfiguration().setProxy("PROXY_HOST", PROXY_PORT);
            HttpEndpoint endpoint = context.getEndpoint("http://www.google.co.uk",HttpEndpoint.class);            
            BasicAuthenticationHttpClientConfigurer config = new BasicAuthenticationHttpClientConfigurer("","");
            config.configureHttpClient(client);
            endpoint.setHttpClientConfigurer(config);            
           
            from("direct:start")
                .setHeader(HttpConstants.HTTP_METHOD, constant(org.apache.camel.component.http.HttpMethods.GET))
                    .to("http://www.google.co.uk").to("mock:results");
            }

The problem I have is that the setHttpClientConfigurer takes a HttpClientConfigurer which is an interface and the only implementation is the BasicAuthenticationHttpClientConfigurer which has to have a username and password which I don't require. I thought I could maybe hack around it above but it doesn't work.

The question is should I create my own subclass of HttpClientConfigurer or am I going about this completely the wrong way? Or maybe it is better for me to write my own HttpProducer/Consumer or custom processor which would be a bit of a shame.

Thanks

jpcook wrote
And is it possible to get at the Apache HttpClient via the Camel Http endpoint?
Claus Ibsen-2 wrote
On Thu, May 7, 2009 at 6:37 PM, jpcook <jonathan.cook@erars.plus.com> wrote:
>
> Hello,
>
> I am playing around with the http endpoint in camel 2 and I thought a good
> starting point would be to run the testHttpGet() in
> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>
> So nothing happens. It just hangs. I suspect this might be because I need to
> configure a proxy but I'm not sure how to do that and I can't find any
> examples really apart from an old post but again it isn't clear to me.
>
> This is the configure method:
> @Override
>    protected RouteBuilder createRouteBuilder() throws Exception {
>        return new RouteBuilder() {
>            public void configure() {
>                from("direct:start")
>                .setHeader(HttpConstants.HTTP_METHOD,
> constant(org.apache.camel.component.http.HttpMethods.GET))
>                    .to("http://www.google.co.uk").to("mock:results");
>            }
>        };
>    }
>
> I also tried specifying the time out in the endpoint eg)
> "http://www.google.co.uk?httpClient.soTimeout(5000)"
You should set it with = as parameter, its like URI parameters.
"http://www.google.co.uk?httpClient.soTimeout=5000"



>
> But that didn't do anything. I wasn't sure if there was a way I could at
> least get something back.
>
> I've also read this useful page. Maybe it would be useful to have an example
> as most corporations will be using proxy servers.
> http://camel.apache.org/http.html
Yeah socket proxy in Java kinda sucks as you often need to set it with
system properties.

Maybe  the HTTP client have nice configuration for proxy. Feel free to
look at Apache HTTP Client how to work with proxy.
And report your findings, then we can improve Camel to ease the proxy
configuration.


>
> Thanks
> --
> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

Claus Ibsen-2
Hi

Good findings.

Lets add the proxy options to camel-http so you can set it easily from the URI.
Looks like the HostConfiguration object isnt easy to access currently.

Do you mind creating a JIRA ticket for this?

Link to JIRA from this page:
http://camel.apache.org/support.html



On Fri, May 8, 2009 at 4:12 PM, jpcook <[hidden email]> wrote:

>
> I have successfully created a simple unit test testing a get using the apache
> http client without camel.
>
> public static void main(String[] args) {
>                // TODO Auto-generated method stub
>                HttpClient client = new HttpClient();
>        HttpMethod method = new GetMethod("http://www.google.co.uk");
>
>        HostConfiguration config = client.getHostConfiguration();
>        config.setProxy(PROXY_HOST, PROXY_PORT);
>
>        try {
>            client.executeMethod(method);
>
>            if (method.getStatusCode() == HttpStatus.SC_OK) {
>                String response = method.getResponseBodyAsString();
>                System.out.println("Response = " + response);
>            }
>        } catch (IOException e) {
>            e.printStackTrace();
>        } finally {
>            method.releaseConnection();
>        }
>    }
>
> The above works nicely. However I'm struggling to put this back into my
> configure method with camel.
>
> public void configure() {
>                HttpClient client = new HttpClient();
>                client.getHostConfiguration().setProxy("PROXY_HOST",
> PROXY_PORT);
>                HttpEndpoint endpoint =
> context.getEndpoint("http://www.google.co.uk",HttpEndpoint.class);
>                BasicAuthenticationHttpClientConfigurer config = new
> BasicAuthenticationHttpClientConfigurer("","");
>                config.configureHttpClient(client);
>                endpoint.setHttpClientConfigurer(config);
>
>                from("direct:start")
>                .setHeader(HttpConstants.HTTP_METHOD,
> constant(org.apache.camel.component.http.HttpMethods.GET))
>                    .to("http://www.google.co.uk").to("mock:results");
>            }
>
> The problem I have is that the setHttpClientConfigurer takes a
> HttpClientConfigurer which is an interface and the only implementation is
> the BasicAuthenticationHttpClientConfigurer which has to have a username and
> password which I don't require. I thought I could maybe hack around it above
> but it doesn't work.
>
> The question is should I create my own subclass of HttpClientConfigurer or
> am I going about this completely the wrong way? Or maybe it is better for me
> to write my own HttpProducer/Consumer or custom processor which would be a
> bit of a shame.
>
> Thanks
>
>
> jpcook wrote:
>>
>> And is it possible to get at the Apache HttpClient via the Camel Http
>> endpoint?
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Thu, May 7, 2009 at 6:37 PM, jpcook <[hidden email]>
>>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> I am playing around with the http endpoint in camel 2 and I thought a
>>>> good
>>>> starting point would be to run the testHttpGet() in
>>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>>>>
>>>> So nothing happens. It just hangs. I suspect this might be because I
>>>> need to
>>>> configure a proxy but I'm not sure how to do that and I can't find any
>>>> examples really apart from an old post but again it isn't clear to me.
>>>>
>>>> This is the configure method:
>>>> @Override
>>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>>        return new RouteBuilder() {
>>>>            public void configure() {
>>>>                from("direct:start")
>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>            }
>>>>        };
>>>>    }
>>>>
>>>> I also tried specifying the time out in the endpoint eg)
>>>> "http://www.google.co.uk?httpClient.soTimeout(5000)"
>>> You should set it with = as parameter, its like URI parameters.
>>> "http://www.google.co.uk?httpClient.soTimeout=5000"
>>>
>>>
>>>
>>>>
>>>> But that didn't do anything. I wasn't sure if there was a way I could at
>>>> least get something back.
>>>>
>>>> I've also read this useful page. Maybe it would be useful to have an
>>>> example
>>>> as most corporations will be using proxy servers.
>>>> http://camel.apache.org/http.html
>>> Yeah socket proxy in Java kinda sucks as you often need to set it with
>>> system properties.
>>>
>>> Maybe  the HTTP client have nice configuration for proxy. Feel free to
>>> look at Apache HTTP Client how to work with proxy.
>>> And report your findings, then we can improve Camel to ease the proxy
>>> configuration.
>>>
>>>
>>>>
>>>> Thanks
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> Apache Camel Reference Card:
>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>> Interview with me:
>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23446776.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

jpcook01
Yes I can do it a bit later. I might even submit a patch :)

When you say via URI do you mean something like:
http://www.google.co.uk?httpClient.proxyName=host?httpClient.proxyPort=8080

Claus Ibsen-2 wrote
Hi

Good findings.

Lets add the proxy options to camel-http so you can set it easily from the URI.
Looks like the HostConfiguration object isnt easy to access currently.

Do you mind creating a JIRA ticket for this?

Link to JIRA from this page:
http://camel.apache.org/support.html



On Fri, May 8, 2009 at 4:12 PM, jpcook <jonathan.cook@erars.plus.com> wrote:
>
> I have successfully created a simple unit test testing a get using the apache
> http client without camel.
>
> public static void main(String[] args) {
>                // TODO Auto-generated method stub
>                HttpClient client = new HttpClient();
>        HttpMethod method = new GetMethod("http://www.google.co.uk");
>
>        HostConfiguration config = client.getHostConfiguration();
>        config.setProxy(PROXY_HOST, PROXY_PORT);
>
>        try {
>            client.executeMethod(method);
>
>            if (method.getStatusCode() == HttpStatus.SC_OK) {
>                String response = method.getResponseBodyAsString();
>                System.out.println("Response = " + response);
>            }
>        } catch (IOException e) {
>            e.printStackTrace();
>        } finally {
>            method.releaseConnection();
>        }
>    }
>
> The above works nicely. However I'm struggling to put this back into my
> configure method with camel.
>
> public void configure() {
>                HttpClient client = new HttpClient();
>                client.getHostConfiguration().setProxy("PROXY_HOST",
> PROXY_PORT);
>                HttpEndpoint endpoint =
> context.getEndpoint("http://www.google.co.uk",HttpEndpoint.class);
>                BasicAuthenticationHttpClientConfigurer config = new
> BasicAuthenticationHttpClientConfigurer("","");
>                config.configureHttpClient(client);
>                endpoint.setHttpClientConfigurer(config);
>
>                from("direct:start")
>                .setHeader(HttpConstants.HTTP_METHOD,
> constant(org.apache.camel.component.http.HttpMethods.GET))
>                    .to("http://www.google.co.uk").to("mock:results");
>            }
>
> The problem I have is that the setHttpClientConfigurer takes a
> HttpClientConfigurer which is an interface and the only implementation is
> the BasicAuthenticationHttpClientConfigurer which has to have a username and
> password which I don't require. I thought I could maybe hack around it above
> but it doesn't work.
>
> The question is should I create my own subclass of HttpClientConfigurer or
> am I going about this completely the wrong way? Or maybe it is better for me
> to write my own HttpProducer/Consumer or custom processor which would be a
> bit of a shame.
>
> Thanks
>
>
> jpcook wrote:
>>
>> And is it possible to get at the Apache HttpClient via the Camel Http
>> endpoint?
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Thu, May 7, 2009 at 6:37 PM, jpcook <jonathan.cook@erars.plus.com>
>>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> I am playing around with the http endpoint in camel 2 and I thought a
>>>> good
>>>> starting point would be to run the testHttpGet() in
>>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>>>>
>>>> So nothing happens. It just hangs. I suspect this might be because I
>>>> need to
>>>> configure a proxy but I'm not sure how to do that and I can't find any
>>>> examples really apart from an old post but again it isn't clear to me.
>>>>
>>>> This is the configure method:
>>>> @Override
>>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>>        return new RouteBuilder() {
>>>>            public void configure() {
>>>>                from("direct:start")
>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>            }
>>>>        };
>>>>    }
>>>>
>>>> I also tried specifying the time out in the endpoint eg)
>>>> "http://www.google.co.uk?httpClient.soTimeout(5000)"
>>> You should set it with = as parameter, its like URI parameters.
>>> "http://www.google.co.uk?httpClient.soTimeout=5000"
>>>
>>>
>>>
>>>>
>>>> But that didn't do anything. I wasn't sure if there was a way I could at
>>>> least get something back.
>>>>
>>>> I've also read this useful page. Maybe it would be useful to have an
>>>> example
>>>> as most corporations will be using proxy servers.
>>>> http://camel.apache.org/http.html
>>> Yeah socket proxy in Java kinda sucks as you often need to set it with
>>> system properties.
>>>
>>> Maybe  the HTTP client have nice configuration for proxy. Feel free to
>>> look at Apache HTTP Client how to work with proxy.
>>> And report your findings, then we can improve Camel to ease the proxy
>>> configuration.
>>>
>>>
>>>>
>>>> Thanks
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> Apache Camel Reference Card:
>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>> Interview with me:
>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23446776.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

Claus Ibsen-2
On Fri, May 8, 2009 at 5:49 PM, jpcook <[hidden email]> wrote:
>
> Yes I can do it a bit later. I might even submit a patch :)
>
> When you say via URI do you mean something like:
> http://www.google.co.uk?httpClient.proxyName=host?httpClient.proxyPort=8080

Yeah but the httpClient prefix should not be needed. So tis
http://www.google.co.uk?proxyName=host&proxyPort=8080


We love contributions and patches. So please with your great findings
you should be able to grok that in the HttpComponent to set the proxy
as well.

there is a method you can use to get the parameters in HttpComponent
String proxyName = getAndRemoveParameter("proxyName", parameters);
String proxyPort = getAndRemoveParameter("proxyPort", parameters);

HttpComponent is the factory to create the http endpoint.


>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> Good findings.
>>
>> Lets add the proxy options to camel-http so you can set it easily from the
>> URI.
>> Looks like the HostConfiguration object isnt easy to access currently.
>>
>> Do you mind creating a JIRA ticket for this?
>>
>> Link to JIRA from this page:
>> http://camel.apache.org/support.html
>>
>>
>>
>> On Fri, May 8, 2009 at 4:12 PM, jpcook <[hidden email]>
>> wrote:
>>>
>>> I have successfully created a simple unit test testing a get using the
>>> apache
>>> http client without camel.
>>>
>>> public static void main(String[] args) {
>>>                // TODO Auto-generated method stub
>>>                HttpClient client = new HttpClient();
>>>        HttpMethod method = new GetMethod("http://www.google.co.uk");
>>>
>>>        HostConfiguration config = client.getHostConfiguration();
>>>        config.setProxy(PROXY_HOST, PROXY_PORT);
>>>
>>>        try {
>>>            client.executeMethod(method);
>>>
>>>            if (method.getStatusCode() == HttpStatus.SC_OK) {
>>>                String response = method.getResponseBodyAsString();
>>>                System.out.println("Response = " + response);
>>>            }
>>>        } catch (IOException e) {
>>>            e.printStackTrace();
>>>        } finally {
>>>            method.releaseConnection();
>>>        }
>>>    }
>>>
>>> The above works nicely. However I'm struggling to put this back into my
>>> configure method with camel.
>>>
>>> public void configure() {
>>>                HttpClient client = new HttpClient();
>>>                client.getHostConfiguration().setProxy("PROXY_HOST",
>>> PROXY_PORT);
>>>                HttpEndpoint endpoint =
>>> context.getEndpoint("http://www.google.co.uk",HttpEndpoint.class);
>>>                BasicAuthenticationHttpClientConfigurer config = new
>>> BasicAuthenticationHttpClientConfigurer("","");
>>>                config.configureHttpClient(client);
>>>                endpoint.setHttpClientConfigurer(config);
>>>
>>>                from("direct:start")
>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>            }
>>>
>>> The problem I have is that the setHttpClientConfigurer takes a
>>> HttpClientConfigurer which is an interface and the only implementation is
>>> the BasicAuthenticationHttpClientConfigurer which has to have a username
>>> and
>>> password which I don't require. I thought I could maybe hack around it
>>> above
>>> but it doesn't work.
>>>
>>> The question is should I create my own subclass of HttpClientConfigurer
>>> or
>>> am I going about this completely the wrong way? Or maybe it is better for
>>> me
>>> to write my own HttpProducer/Consumer or custom processor which would be
>>> a
>>> bit of a shame.
>>>
>>> Thanks
>>>
>>>
>>> jpcook wrote:
>>>>
>>>> And is it possible to get at the Apache HttpClient via the Camel Http
>>>> endpoint?
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>>
>>>>> On Thu, May 7, 2009 at 6:37 PM, jpcook <[hidden email]>
>>>>> wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I am playing around with the http endpoint in camel 2 and I thought a
>>>>>> good
>>>>>> starting point would be to run the testHttpGet() in
>>>>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>>>>>>
>>>>>> So nothing happens. It just hangs. I suspect this might be because I
>>>>>> need to
>>>>>> configure a proxy but I'm not sure how to do that and I can't find any
>>>>>> examples really apart from an old post but again it isn't clear to me.
>>>>>>
>>>>>> This is the configure method:
>>>>>> @Override
>>>>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>>>>        return new RouteBuilder() {
>>>>>>            public void configure() {
>>>>>>                from("direct:start")
>>>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>>>            }
>>>>>>        };
>>>>>>    }
>>>>>>
>>>>>> I also tried specifying the time out in the endpoint eg)
>>>>>> "http://www.google.co.uk?httpClient.soTimeout(5000)"
>>>>> You should set it with = as parameter, its like URI parameters.
>>>>> "http://www.google.co.uk?httpClient.soTimeout=5000"
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> But that didn't do anything. I wasn't sure if there was a way I could
>>>>>> at
>>>>>> least get something back.
>>>>>>
>>>>>> I've also read this useful page. Maybe it would be useful to have an
>>>>>> example
>>>>>> as most corporations will be using proxy servers.
>>>>>> http://camel.apache.org/http.html
>>>>> Yeah socket proxy in Java kinda sucks as you often need to set it with
>>>>> system properties.
>>>>>
>>>>> Maybe  the HTTP client have nice configuration for proxy. Feel free to
>>>>> look at Apache HTTP Client how to work with proxy.
>>>>> And report your findings, then we can improve Camel to ease the proxy
>>>>> configuration.
>>>>>
>>>>>
>>>>>>
>>>>>> Thanks
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
>>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>>> Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>> Apache Camel Reference Card:
>>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>>> Interview with me:
>>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Http-Endpoint-tp23430772p23446776.html
>>> Sent from the Camel - Users (activemq) mailing list archive at
>>> Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> Apache Camel Reference Card:
>> http://refcardz.dzone.com/refcardz/enterprise-integration
>> Interview with me:
>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23448297.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

Claus Ibsen-2
On Fri, May 8, 2009 at 5:53 PM, Claus Ibsen <[hidden email]> wrote:

> On Fri, May 8, 2009 at 5:49 PM, jpcook <[hidden email]> wrote:
>>
>> Yes I can do it a bit later. I might even submit a patch :)
>>
>> When you say via URI do you mean something like:
>> http://www.google.co.uk?httpClient.proxyName=host?httpClient.proxyPort=8080
>
> Yeah but the httpClient prefix should not be needed. So tis
> http://www.google.co.uk?proxyName=host&proxyPort=8080
>
>
> We love contributions and patches. So please with your great findings
> you should be able to grok that in the HttpComponent to set the proxy
> as well.
>
> there is a method you can use to get the parameters in HttpComponent
> String proxyName = getAndRemoveParameter("proxyName", parameters);
> String proxyPort = getAndRemoveParameter("proxyPort", parameters);
>
> HttpComponent is the factory to create the http endpoint.

And I would suggest to add support for proxy on the HttpComponent itself.
Just add regular java getter/setter.

Then you can overload the standard http component and configure it with proxy.
Then it works globally for all the http endpoints you do routing with

Something like

<bean id="http" class="...HttpComponent">
    <property name="proxyName" value="xxx"/>
    ...
</bean>




>
>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> Good findings.
>>>
>>> Lets add the proxy options to camel-http so you can set it easily from the
>>> URI.
>>> Looks like the HostConfiguration object isnt easy to access currently.
>>>
>>> Do you mind creating a JIRA ticket for this?
>>>
>>> Link to JIRA from this page:
>>> http://camel.apache.org/support.html
>>>
>>>
>>>
>>> On Fri, May 8, 2009 at 4:12 PM, jpcook <[hidden email]>
>>> wrote:
>>>>
>>>> I have successfully created a simple unit test testing a get using the
>>>> apache
>>>> http client without camel.
>>>>
>>>> public static void main(String[] args) {
>>>>                // TODO Auto-generated method stub
>>>>                HttpClient client = new HttpClient();
>>>>        HttpMethod method = new GetMethod("http://www.google.co.uk");
>>>>
>>>>        HostConfiguration config = client.getHostConfiguration();
>>>>        config.setProxy(PROXY_HOST, PROXY_PORT);
>>>>
>>>>        try {
>>>>            client.executeMethod(method);
>>>>
>>>>            if (method.getStatusCode() == HttpStatus.SC_OK) {
>>>>                String response = method.getResponseBodyAsString();
>>>>                System.out.println("Response = " + response);
>>>>            }
>>>>        } catch (IOException e) {
>>>>            e.printStackTrace();
>>>>        } finally {
>>>>            method.releaseConnection();
>>>>        }
>>>>    }
>>>>
>>>> The above works nicely. However I'm struggling to put this back into my
>>>> configure method with camel.
>>>>
>>>> public void configure() {
>>>>                HttpClient client = new HttpClient();
>>>>                client.getHostConfiguration().setProxy("PROXY_HOST",
>>>> PROXY_PORT);
>>>>                HttpEndpoint endpoint =
>>>> context.getEndpoint("http://www.google.co.uk",HttpEndpoint.class);
>>>>                BasicAuthenticationHttpClientConfigurer config = new
>>>> BasicAuthenticationHttpClientConfigurer("","");
>>>>                config.configureHttpClient(client);
>>>>                endpoint.setHttpClientConfigurer(config);
>>>>
>>>>                from("direct:start")
>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>            }
>>>>
>>>> The problem I have is that the setHttpClientConfigurer takes a
>>>> HttpClientConfigurer which is an interface and the only implementation is
>>>> the BasicAuthenticationHttpClientConfigurer which has to have a username
>>>> and
>>>> password which I don't require. I thought I could maybe hack around it
>>>> above
>>>> but it doesn't work.
>>>>
>>>> The question is should I create my own subclass of HttpClientConfigurer
>>>> or
>>>> am I going about this completely the wrong way? Or maybe it is better for
>>>> me
>>>> to write my own HttpProducer/Consumer or custom processor which would be
>>>> a
>>>> bit of a shame.
>>>>
>>>> Thanks
>>>>
>>>>
>>>> jpcook wrote:
>>>>>
>>>>> And is it possible to get at the Apache HttpClient via the Camel Http
>>>>> endpoint?
>>>>>
>>>>> Claus Ibsen-2 wrote:
>>>>>>
>>>>>> On Thu, May 7, 2009 at 6:37 PM, jpcook <[hidden email]>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am playing around with the http endpoint in camel 2 and I thought a
>>>>>>> good
>>>>>>> starting point would be to run the testHttpGet() in
>>>>>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>>>>>>>
>>>>>>> So nothing happens. It just hangs. I suspect this might be because I
>>>>>>> need to
>>>>>>> configure a proxy but I'm not sure how to do that and I can't find any
>>>>>>> examples really apart from an old post but again it isn't clear to me.
>>>>>>>
>>>>>>> This is the configure method:
>>>>>>> @Override
>>>>>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>>>>>        return new RouteBuilder() {
>>>>>>>            public void configure() {
>>>>>>>                from("direct:start")
>>>>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>>>>            }
>>>>>>>        };
>>>>>>>    }
>>>>>>>
>>>>>>> I also tried specifying the time out in the endpoint eg)
>>>>>>> "http://www.google.co.uk?httpClient.soTimeout(5000)"
>>>>>> You should set it with = as parameter, its like URI parameters.
>>>>>> "http://www.google.co.uk?httpClient.soTimeout=5000"
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> But that didn't do anything. I wasn't sure if there was a way I could
>>>>>>> at
>>>>>>> least get something back.
>>>>>>>
>>>>>>> I've also read this useful page. Maybe it would be useful to have an
>>>>>>> example
>>>>>>> as most corporations will be using proxy servers.
>>>>>>> http://camel.apache.org/http.html
>>>>>> Yeah socket proxy in Java kinda sucks as you often need to set it with
>>>>>> system properties.
>>>>>>
>>>>>> Maybe  the HTTP client have nice configuration for proxy. Feel free to
>>>>>> look at Apache HTTP Client how to work with proxy.
>>>>>> And report your findings, then we can improve Camel to ease the proxy
>>>>>> configuration.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
>>>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>>>> Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>> Apache Camel Reference Card:
>>>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>>>> Interview with me:
>>>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23446776.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> Apache Camel Reference Card:
>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>> Interview with me:
>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23448297.html
>> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> Apache Camel Reference Card:
> http://refcardz.dzone.com/refcardz/enterprise-integration
> Interview with me:
> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

jpcook01
Thanks for the advice. I created a new ticket (CAMEL-1599) and hope to submit a patch today or tomorrow :)
Claus Ibsen-2 wrote
On Fri, May 8, 2009 at 5:53 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> On Fri, May 8, 2009 at 5:49 PM, jpcook <jonathan.cook@erars.plus.com> wrote:
>>
>> Yes I can do it a bit later. I might even submit a patch :)
>>
>> When you say via URI do you mean something like:
>> http://www.google.co.uk?httpClient.proxyName=host?httpClient.proxyPort=8080
>
> Yeah but the httpClient prefix should not be needed. So tis
> http://www.google.co.uk?proxyName=host&proxyPort=8080
>
>
> We love contributions and patches. So please with your great findings
> you should be able to grok that in the HttpComponent to set the proxy
> as well.
>
> there is a method you can use to get the parameters in HttpComponent
> String proxyName = getAndRemoveParameter("proxyName", parameters);
> String proxyPort = getAndRemoveParameter("proxyPort", parameters);
>
> HttpComponent is the factory to create the http endpoint.

And I would suggest to add support for proxy on the HttpComponent itself.
Just add regular java getter/setter.

Then you can overload the standard http component and configure it with proxy.
Then it works globally for all the http endpoints you do routing with

Something like

<bean id="http" class="...HttpComponent">
    <property name="proxyName" value="xxx"/>
    ...
</bean>




>
>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> Good findings.
>>>
>>> Lets add the proxy options to camel-http so you can set it easily from the
>>> URI.
>>> Looks like the HostConfiguration object isnt easy to access currently.
>>>
>>> Do you mind creating a JIRA ticket for this?
>>>
>>> Link to JIRA from this page:
>>> http://camel.apache.org/support.html
>>>
>>>
>>>
>>> On Fri, May 8, 2009 at 4:12 PM, jpcook <jonathan.cook@erars.plus.com>
>>> wrote:
>>>>
>>>> I have successfully created a simple unit test testing a get using the
>>>> apache
>>>> http client without camel.
>>>>
>>>> public static void main(String[] args) {
>>>>                // TODO Auto-generated method stub
>>>>                HttpClient client = new HttpClient();
>>>>        HttpMethod method = new GetMethod("http://www.google.co.uk");
>>>>
>>>>        HostConfiguration config = client.getHostConfiguration();
>>>>        config.setProxy(PROXY_HOST, PROXY_PORT);
>>>>
>>>>        try {
>>>>            client.executeMethod(method);
>>>>
>>>>            if (method.getStatusCode() == HttpStatus.SC_OK) {
>>>>                String response = method.getResponseBodyAsString();
>>>>                System.out.println("Response = " + response);
>>>>            }
>>>>        } catch (IOException e) {
>>>>            e.printStackTrace();
>>>>        } finally {
>>>>            method.releaseConnection();
>>>>        }
>>>>    }
>>>>
>>>> The above works nicely. However I'm struggling to put this back into my
>>>> configure method with camel.
>>>>
>>>> public void configure() {
>>>>                HttpClient client = new HttpClient();
>>>>                client.getHostConfiguration().setProxy("PROXY_HOST",
>>>> PROXY_PORT);
>>>>                HttpEndpoint endpoint =
>>>> context.getEndpoint("http://www.google.co.uk",HttpEndpoint.class);
>>>>                BasicAuthenticationHttpClientConfigurer config = new
>>>> BasicAuthenticationHttpClientConfigurer("","");
>>>>                config.configureHttpClient(client);
>>>>                endpoint.setHttpClientConfigurer(config);
>>>>
>>>>                from("direct:start")
>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>            }
>>>>
>>>> The problem I have is that the setHttpClientConfigurer takes a
>>>> HttpClientConfigurer which is an interface and the only implementation is
>>>> the BasicAuthenticationHttpClientConfigurer which has to have a username
>>>> and
>>>> password which I don't require. I thought I could maybe hack around it
>>>> above
>>>> but it doesn't work.
>>>>
>>>> The question is should I create my own subclass of HttpClientConfigurer
>>>> or
>>>> am I going about this completely the wrong way? Or maybe it is better for
>>>> me
>>>> to write my own HttpProducer/Consumer or custom processor which would be
>>>> a
>>>> bit of a shame.
>>>>
>>>> Thanks
>>>>
>>>>
>>>> jpcook wrote:
>>>>>
>>>>> And is it possible to get at the Apache HttpClient via the Camel Http
>>>>> endpoint?
>>>>>
>>>>> Claus Ibsen-2 wrote:
>>>>>>
>>>>>> On Thu, May 7, 2009 at 6:37 PM, jpcook <jonathan.cook@erars.plus.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am playing around with the http endpoint in camel 2 and I thought a
>>>>>>> good
>>>>>>> starting point would be to run the testHttpGet() in
>>>>>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>>>>>>>
>>>>>>> So nothing happens. It just hangs. I suspect this might be because I
>>>>>>> need to
>>>>>>> configure a proxy but I'm not sure how to do that and I can't find any
>>>>>>> examples really apart from an old post but again it isn't clear to me.
>>>>>>>
>>>>>>> This is the configure method:
>>>>>>> @Override
>>>>>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>>>>>        return new RouteBuilder() {
>>>>>>>            public void configure() {
>>>>>>>                from("direct:start")
>>>>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>>>>            }
>>>>>>>        };
>>>>>>>    }
>>>>>>>
>>>>>>> I also tried specifying the time out in the endpoint eg)
>>>>>>> "http://www.google.co.uk?httpClient.soTimeout(5000)"
>>>>>> You should set it with = as parameter, its like URI parameters.
>>>>>> "http://www.google.co.uk?httpClient.soTimeout=5000"
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> But that didn't do anything. I wasn't sure if there was a way I could
>>>>>>> at
>>>>>>> least get something back.
>>>>>>>
>>>>>>> I've also read this useful page. Maybe it would be useful to have an
>>>>>>> example
>>>>>>> as most corporations will be using proxy servers.
>>>>>>> http://camel.apache.org/http.html
>>>>>> Yeah socket proxy in Java kinda sucks as you often need to set it with
>>>>>> system properties.
>>>>>>
>>>>>> Maybe  the HTTP client have nice configuration for proxy. Feel free to
>>>>>> look at Apache HTTP Client how to work with proxy.
>>>>>> And report your findings, then we can improve Camel to ease the proxy
>>>>>> configuration.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
>>>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>>>> Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>> Apache Camel Reference Card:
>>>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>>>> Interview with me:
>>>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23446776.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> Apache Camel Reference Card:
>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>> Interview with me:
>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23448297.html
>> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> Apache Camel Reference Card:
> http://refcardz.dzone.com/refcardz/enterprise-integration
> Interview with me:
> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

Claus Ibsen-2
On Mon, May 11, 2009 at 10:15 AM, jpcook <[hidden email]> wrote:
>
> Thanks for the advice. I created a new ticket (CAMEL-1599) and hope to submit
> a patch today or tomorrow :)
Fantastic. Submitting patches open a door. That is how I got started
with Camel :)


>
> Claus Ibsen-2 wrote:
>>
>> On Fri, May 8, 2009 at 5:53 PM, Claus Ibsen <[hidden email]> wrote:
>>> On Fri, May 8, 2009 at 5:49 PM, jpcook <[hidden email]>
>>> wrote:
>>>>
>>>> Yes I can do it a bit later. I might even submit a patch :)
>>>>
>>>> When you say via URI do you mean something like:
>>>> http://www.google.co.uk?httpClient.proxyName=host?httpClient.proxyPort=8080
>>>
>>> Yeah but the httpClient prefix should not be needed. So tis
>>> http://www.google.co.uk?proxyName=host&proxyPort=8080
>>>
>>>
>>> We love contributions and patches. So please with your great findings
>>> you should be able to grok that in the HttpComponent to set the proxy
>>> as well.
>>>
>>> there is a method you can use to get the parameters in HttpComponent
>>> String proxyName = getAndRemoveParameter("proxyName", parameters);
>>> String proxyPort = getAndRemoveParameter("proxyPort", parameters);
>>>
>>> HttpComponent is the factory to create the http endpoint.
>>
>> And I would suggest to add support for proxy on the HttpComponent itself.
>> Just add regular java getter/setter.
>>
>> Then you can overload the standard http component and configure it with
>> proxy.
>> Then it works globally for all the http endpoints you do routing with
>>
>> Something like
>>
>> <bean id="http" class="...HttpComponent">
>>     <property name="proxyName" value="xxx"/>
>>     ...
>> </bean>
>>
>>
>>
>>
>>>
>>>
>>>>
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> Good findings.
>>>>>
>>>>> Lets add the proxy options to camel-http so you can set it easily from
>>>>> the
>>>>> URI.
>>>>> Looks like the HostConfiguration object isnt easy to access currently.
>>>>>
>>>>> Do you mind creating a JIRA ticket for this?
>>>>>
>>>>> Link to JIRA from this page:
>>>>> http://camel.apache.org/support.html
>>>>>
>>>>>
>>>>>
>>>>> On Fri, May 8, 2009 at 4:12 PM, jpcook <[hidden email]>
>>>>> wrote:
>>>>>>
>>>>>> I have successfully created a simple unit test testing a get using the
>>>>>> apache
>>>>>> http client without camel.
>>>>>>
>>>>>> public static void main(String[] args) {
>>>>>>                // TODO Auto-generated method stub
>>>>>>                HttpClient client = new HttpClient();
>>>>>>        HttpMethod method = new GetMethod("http://www.google.co.uk");
>>>>>>
>>>>>>        HostConfiguration config = client.getHostConfiguration();
>>>>>>        config.setProxy(PROXY_HOST, PROXY_PORT);
>>>>>>
>>>>>>        try {
>>>>>>            client.executeMethod(method);
>>>>>>
>>>>>>            if (method.getStatusCode() == HttpStatus.SC_OK) {
>>>>>>                String response = method.getResponseBodyAsString();
>>>>>>                System.out.println("Response = " + response);
>>>>>>            }
>>>>>>        } catch (IOException e) {
>>>>>>            e.printStackTrace();
>>>>>>        } finally {
>>>>>>            method.releaseConnection();
>>>>>>        }
>>>>>>    }
>>>>>>
>>>>>> The above works nicely. However I'm struggling to put this back into
>>>>>> my
>>>>>> configure method with camel.
>>>>>>
>>>>>> public void configure() {
>>>>>>                HttpClient client = new HttpClient();
>>>>>>                client.getHostConfiguration().setProxy("PROXY_HOST",
>>>>>> PROXY_PORT);
>>>>>>                HttpEndpoint endpoint =
>>>>>> context.getEndpoint("http://www.google.co.uk",HttpEndpoint.class);
>>>>>>                BasicAuthenticationHttpClientConfigurer config = new
>>>>>> BasicAuthenticationHttpClientConfigurer("","");
>>>>>>                config.configureHttpClient(client);
>>>>>>                endpoint.setHttpClientConfigurer(config);
>>>>>>
>>>>>>                from("direct:start")
>>>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>>>            }
>>>>>>
>>>>>> The problem I have is that the setHttpClientConfigurer takes a
>>>>>> HttpClientConfigurer which is an interface and the only implementation
>>>>>> is
>>>>>> the BasicAuthenticationHttpClientConfigurer which has to have a
>>>>>> username
>>>>>> and
>>>>>> password which I don't require. I thought I could maybe hack around it
>>>>>> above
>>>>>> but it doesn't work.
>>>>>>
>>>>>> The question is should I create my own subclass of
>>>>>> HttpClientConfigurer
>>>>>> or
>>>>>> am I going about this completely the wrong way? Or maybe it is better
>>>>>> for
>>>>>> me
>>>>>> to write my own HttpProducer/Consumer or custom processor which would
>>>>>> be
>>>>>> a
>>>>>> bit of a shame.
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>> jpcook wrote:
>>>>>>>
>>>>>>> And is it possible to get at the Apache HttpClient via the Camel Http
>>>>>>> endpoint?
>>>>>>>
>>>>>>> Claus Ibsen-2 wrote:
>>>>>>>>
>>>>>>>> On Thu, May 7, 2009 at 6:37 PM, jpcook
>>>>>>>> <[hidden email]>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I am playing around with the http endpoint in camel 2 and I thought
>>>>>>>>> a
>>>>>>>>> good
>>>>>>>>> starting point would be to run the testHttpGet() in
>>>>>>>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>>>>>>>>>
>>>>>>>>> So nothing happens. It just hangs. I suspect this might be because
>>>>>>>>> I
>>>>>>>>> need to
>>>>>>>>> configure a proxy but I'm not sure how to do that and I can't find
>>>>>>>>> any
>>>>>>>>> examples really apart from an old post but again it isn't clear to
>>>>>>>>> me.
>>>>>>>>>
>>>>>>>>> This is the configure method:
>>>>>>>>> @Override
>>>>>>>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>>>>>>>        return new RouteBuilder() {
>>>>>>>>>            public void configure() {
>>>>>>>>>                from("direct:start")
>>>>>>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>>>>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>>>>>>
>>>>>>>>>  .to("http://www.google.co.uk").to("mock:results");
>>>>>>>>>            }
>>>>>>>>>        };
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>> I also tried specifying the time out in the endpoint eg)
>>>>>>>>> "http://www.google.co.uk?httpClient.soTimeout(5000)"
>>>>>>>> You should set it with = as parameter, its like URI parameters.
>>>>>>>> "http://www.google.co.uk?httpClient.soTimeout=5000"
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> But that didn't do anything. I wasn't sure if there was a way I
>>>>>>>>> could
>>>>>>>>> at
>>>>>>>>> least get something back.
>>>>>>>>>
>>>>>>>>> I've also read this useful page. Maybe it would be useful to have
>>>>>>>>> an
>>>>>>>>> example
>>>>>>>>> as most corporations will be using proxy servers.
>>>>>>>>> http://camel.apache.org/http.html
>>>>>>>> Yeah socket proxy in Java kinda sucks as you often need to set it
>>>>>>>> with
>>>>>>>> system properties.
>>>>>>>>
>>>>>>>> Maybe  the HTTP client have nice configuration for proxy. Feel free
>>>>>>>> to
>>>>>>>> look at Apache HTTP Client how to work with proxy.
>>>>>>>> And report your findings, then we can improve Camel to ease the
>>>>>>>> proxy
>>>>>>>> configuration.
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
>>>>>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>>>>>> Nabble.com.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Claus Ibsen
>>>>>>>> Apache Camel Committer
>>>>>>>>
>>>>>>>> Open Source Integration: http://fusesource.com
>>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>>>> Apache Camel Reference Card:
>>>>>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>>>>>> Interview with me:
>>>>>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23446776.html
>>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>>> Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>> Apache Camel Reference Card:
>>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>>> Interview with me:
>>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23448297.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> Apache Camel Reference Card:
>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>> Interview with me:
>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> Apache Camel Reference Card:
>> http://refcardz.dzone.com/refcardz/enterprise-integration
>> Interview with me:
>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23478899.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

jpcook01
In reply to this post by Claus Ibsen-2
Hi,

About this last point, do you mean overload the httpcomponents constructor? Currently it doesn't have one. I'm not that familiar with the xml configuration side of things. Is there a unit test I could look at? I searched for xml with bean id in but there isn't anything in camel core or the camel http projects at the moment. What should the getters and setters be for as I've created a new subclass of the httpclientconfigurer like the basicauthentication subclass except for proxy configuration.

Sorry to ask but this is my first patch :)




Claus Ibsen-2 wrote
On Fri, May 8, 2009 at 5:53 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> On Fri, May 8, 2009 at 5:49 PM, jpcook <jonathan.cook@erars.plus.com> wrote:
>>
>> Yes I can do it a bit later. I might even submit a patch :)
>>
>> When you say via URI do you mean something like:
>> http://www.google.co.uk?httpClient.proxyName=host?httpClient.proxyPort=8080
>
> Yeah but the httpClient prefix should not be needed. So tis
> http://www.google.co.uk?proxyName=host&proxyPort=8080
>
>
> We love contributions and patches. So please with your great findings
> you should be able to grok that in the HttpComponent to set the proxy
> as well.
>
> there is a method you can use to get the parameters in HttpComponent
> String proxyName = getAndRemoveParameter("proxyName", parameters);
> String proxyPort = getAndRemoveParameter("proxyPort", parameters);
>
> HttpComponent is the factory to create the http endpoint.

And I would suggest to add support for proxy on the HttpComponent itself.
Just add regular java getter/setter.

Then you can overload the standard http component and configure it with proxy.
Then it works globally for all the http endpoints you do routing with

Something like

<bean id="http" class="...HttpComponent">
    <property name="proxyName" value="xxx"/>
    ...
</bean>




>
>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> Good findings.
>>>
>>> Lets add the proxy options to camel-http so you can set it easily from the
>>> URI.
>>> Looks like the HostConfiguration object isnt easy to access currently.
>>>
>>> Do you mind creating a JIRA ticket for this?
>>>
>>> Link to JIRA from this page:
>>> http://camel.apache.org/support.html
>>>
>>>
>>>
>>> On Fri, May 8, 2009 at 4:12 PM, jpcook <jonathan.cook@erars.plus.com>
>>> wrote:
>>>>
>>>> I have successfully created a simple unit test testing a get using the
>>>> apache
>>>> http client without camel.
>>>>
>>>> public static void main(String[] args) {
>>>>                // TODO Auto-generated method stub
>>>>                HttpClient client = new HttpClient();
>>>>        HttpMethod method = new GetMethod("http://www.google.co.uk");
>>>>
>>>>        HostConfiguration config = client.getHostConfiguration();
>>>>        config.setProxy(PROXY_HOST, PROXY_PORT);
>>>>
>>>>        try {
>>>>            client.executeMethod(method);
>>>>
>>>>            if (method.getStatusCode() == HttpStatus.SC_OK) {
>>>>                String response = method.getResponseBodyAsString();
>>>>                System.out.println("Response = " + response);
>>>>            }
>>>>        } catch (IOException e) {
>>>>            e.printStackTrace();
>>>>        } finally {
>>>>            method.releaseConnection();
>>>>        }
>>>>    }
>>>>
>>>> The above works nicely. However I'm struggling to put this back into my
>>>> configure method with camel.
>>>>
>>>> public void configure() {
>>>>                HttpClient client = new HttpClient();
>>>>                client.getHostConfiguration().setProxy("PROXY_HOST",
>>>> PROXY_PORT);
>>>>                HttpEndpoint endpoint =
>>>> context.getEndpoint("http://www.google.co.uk",HttpEndpoint.class);
>>>>                BasicAuthenticationHttpClientConfigurer config = new
>>>> BasicAuthenticationHttpClientConfigurer("","");
>>>>                config.configureHttpClient(client);
>>>>                endpoint.setHttpClientConfigurer(config);
>>>>
>>>>                from("direct:start")
>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>            }
>>>>
>>>> The problem I have is that the setHttpClientConfigurer takes a
>>>> HttpClientConfigurer which is an interface and the only implementation is
>>>> the BasicAuthenticationHttpClientConfigurer which has to have a username
>>>> and
>>>> password which I don't require. I thought I could maybe hack around it
>>>> above
>>>> but it doesn't work.
>>>>
>>>> The question is should I create my own subclass of HttpClientConfigurer
>>>> or
>>>> am I going about this completely the wrong way? Or maybe it is better for
>>>> me
>>>> to write my own HttpProducer/Consumer or custom processor which would be
>>>> a
>>>> bit of a shame.
>>>>
>>>> Thanks
>>>>
>>>>
>>>> jpcook wrote:
>>>>>
>>>>> And is it possible to get at the Apache HttpClient via the Camel Http
>>>>> endpoint?
>>>>>
>>>>> Claus Ibsen-2 wrote:
>>>>>>
>>>>>> On Thu, May 7, 2009 at 6:37 PM, jpcook <jonathan.cook@erars.plus.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am playing around with the http endpoint in camel 2 and I thought a
>>>>>>> good
>>>>>>> starting point would be to run the testHttpGet() in
>>>>>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>>>>>>>
>>>>>>> So nothing happens. It just hangs. I suspect this might be because I
>>>>>>> need to
>>>>>>> configure a proxy but I'm not sure how to do that and I can't find any
>>>>>>> examples really apart from an old post but again it isn't clear to me.
>>>>>>>
>>>>>>> This is the configure method:
>>>>>>> @Override
>>>>>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>>>>>        return new RouteBuilder() {
>>>>>>>            public void configure() {
>>>>>>>                from("direct:start")
>>>>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>>>>            }
>>>>>>>        };
>>>>>>>    }
>>>>>>>
>>>>>>> I also tried specifying the time out in the endpoint eg)
>>>>>>> "http://www.google.co.uk?httpClient.soTimeout(5000)"
>>>>>> You should set it with = as parameter, its like URI parameters.
>>>>>> "http://www.google.co.uk?httpClient.soTimeout=5000"
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> But that didn't do anything. I wasn't sure if there was a way I could
>>>>>>> at
>>>>>>> least get something back.
>>>>>>>
>>>>>>> I've also read this useful page. Maybe it would be useful to have an
>>>>>>> example
>>>>>>> as most corporations will be using proxy servers.
>>>>>>> http://camel.apache.org/http.html
>>>>>> Yeah socket proxy in Java kinda sucks as you often need to set it with
>>>>>> system properties.
>>>>>>
>>>>>> Maybe  the HTTP client have nice configuration for proxy. Feel free to
>>>>>> look at Apache HTTP Client how to work with proxy.
>>>>>> And report your findings, then we can improve Camel to ease the proxy
>>>>>> configuration.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
>>>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>>>> Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>> Apache Camel Reference Card:
>>>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>>>> Interview with me:
>>>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23446776.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> Apache Camel Reference Card:
>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>> Interview with me:
>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23448297.html
>> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> Apache Camel Reference Card:
> http://refcardz.dzone.com/refcardz/enterprise-integration
> Interview with me:
> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

jpcook01
Hi, so this works and I have added support for proxy username and password. As I have subclassed the httpclientconfigurer it should already be possible to use the existing getter/setter methods in the http component from the spring configuration.

eg) something like:

<bean id="http" class="org.apache.camel.component.http.HttpComponent">
    <property name="camelContext" ref="camel"/>
    <property name="httpClientConfigurer" ref="myHttpClientConfigurer"/>
</bean>

<bean id="myHttpClientConfigurer" class="org.apache.camel.component.http.ProxyHttpClientConfigurer">
    <property name="proxyHost" value="host"/>
    <property name="proxyPort" value="80"/>
    <property name="username" value="username"/>
    <property name="password" value="password"/>
</bean>

Not sure how to write a unit test for the above but I wrote another one to test from the uri with my companies proxy details and that worked but obviously don't want to submit that as it won't work for anyone else :)

jpcook wrote
Hi,

About this last point, do you mean overload the httpcomponents constructor? Currently it doesn't have one. I'm not that familiar with the xml configuration side of things. Is there a unit test I could look at? I searched for xml with bean id in but there isn't anything in camel core or the camel http projects at the moment. What should the getters and setters be for as I've created a new subclass of the httpclientconfigurer like the basicauthentication subclass except for proxy configuration.

Sorry to ask but this is my first patch :)




Claus Ibsen-2 wrote
On Fri, May 8, 2009 at 5:53 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> On Fri, May 8, 2009 at 5:49 PM, jpcook <jonathan.cook@erars.plus.com> wrote:
>>
>> Yes I can do it a bit later. I might even submit a patch :)
>>
>> When you say via URI do you mean something like:
>> http://www.google.co.uk?httpClient.proxyName=host?httpClient.proxyPort=8080
>
> Yeah but the httpClient prefix should not be needed. So tis
> http://www.google.co.uk?proxyName=host&proxyPort=8080
>
>
> We love contributions and patches. So please with your great findings
> you should be able to grok that in the HttpComponent to set the proxy
> as well.
>
> there is a method you can use to get the parameters in HttpComponent
> String proxyName = getAndRemoveParameter("proxyName", parameters);
> String proxyPort = getAndRemoveParameter("proxyPort", parameters);
>
> HttpComponent is the factory to create the http endpoint.

And I would suggest to add support for proxy on the HttpComponent itself.
Just add regular java getter/setter.

Then you can overload the standard http component and configure it with proxy.
Then it works globally for all the http endpoints you do routing with

Something like

<bean id="http" class="...HttpComponent">
    <property name="proxyName" value="xxx"/>
    ...
</bean>




>
>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> Good findings.
>>>
>>> Lets add the proxy options to camel-http so you can set it easily from the
>>> URI.
>>> Looks like the HostConfiguration object isnt easy to access currently.
>>>
>>> Do you mind creating a JIRA ticket for this?
>>>
>>> Link to JIRA from this page:
>>> http://camel.apache.org/support.html
>>>
>>>
>>>
>>> On Fri, May 8, 2009 at 4:12 PM, jpcook <jonathan.cook@erars.plus.com>
>>> wrote:
>>>>
>>>> I have successfully created a simple unit test testing a get using the
>>>> apache
>>>> http client without camel.
>>>>
>>>> public static void main(String[] args) {
>>>>                // TODO Auto-generated method stub
>>>>                HttpClient client = new HttpClient();
>>>>        HttpMethod method = new GetMethod("http://www.google.co.uk");
>>>>
>>>>        HostConfiguration config = client.getHostConfiguration();
>>>>        config.setProxy(PROXY_HOST, PROXY_PORT);
>>>>
>>>>        try {
>>>>            client.executeMethod(method);
>>>>
>>>>            if (method.getStatusCode() == HttpStatus.SC_OK) {
>>>>                String response = method.getResponseBodyAsString();
>>>>                System.out.println("Response = " + response);
>>>>            }
>>>>        } catch (IOException e) {
>>>>            e.printStackTrace();
>>>>        } finally {
>>>>            method.releaseConnection();
>>>>        }
>>>>    }
>>>>
>>>> The above works nicely. However I'm struggling to put this back into my
>>>> configure method with camel.
>>>>
>>>> public void configure() {
>>>>                HttpClient client = new HttpClient();
>>>>                client.getHostConfiguration().setProxy("PROXY_HOST",
>>>> PROXY_PORT);
>>>>                HttpEndpoint endpoint =
>>>> context.getEndpoint("http://www.google.co.uk",HttpEndpoint.class);
>>>>                BasicAuthenticationHttpClientConfigurer config = new
>>>> BasicAuthenticationHttpClientConfigurer("","");
>>>>                config.configureHttpClient(client);
>>>>                endpoint.setHttpClientConfigurer(config);
>>>>
>>>>                from("direct:start")
>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>            }
>>>>
>>>> The problem I have is that the setHttpClientConfigurer takes a
>>>> HttpClientConfigurer which is an interface and the only implementation is
>>>> the BasicAuthenticationHttpClientConfigurer which has to have a username
>>>> and
>>>> password which I don't require. I thought I could maybe hack around it
>>>> above
>>>> but it doesn't work.
>>>>
>>>> The question is should I create my own subclass of HttpClientConfigurer
>>>> or
>>>> am I going about this completely the wrong way? Or maybe it is better for
>>>> me
>>>> to write my own HttpProducer/Consumer or custom processor which would be
>>>> a
>>>> bit of a shame.
>>>>
>>>> Thanks
>>>>
>>>>
>>>> jpcook wrote:
>>>>>
>>>>> And is it possible to get at the Apache HttpClient via the Camel Http
>>>>> endpoint?
>>>>>
>>>>> Claus Ibsen-2 wrote:
>>>>>>
>>>>>> On Thu, May 7, 2009 at 6:37 PM, jpcook <jonathan.cook@erars.plus.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am playing around with the http endpoint in camel 2 and I thought a
>>>>>>> good
>>>>>>> starting point would be to run the testHttpGet() in
>>>>>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>>>>>>>
>>>>>>> So nothing happens. It just hangs. I suspect this might be because I
>>>>>>> need to
>>>>>>> configure a proxy but I'm not sure how to do that and I can't find any
>>>>>>> examples really apart from an old post but again it isn't clear to me.
>>>>>>>
>>>>>>> This is the configure method:
>>>>>>> @Override
>>>>>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>>>>>        return new RouteBuilder() {
>>>>>>>            public void configure() {
>>>>>>>                from("direct:start")
>>>>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>>>>            }
>>>>>>>        };
>>>>>>>    }
>>>>>>>
>>>>>>> I also tried specifying the time out in the endpoint eg)
>>>>>>> "http://www.google.co.uk?httpClient.soTimeout(5000)"
>>>>>> You should set it with = as parameter, its like URI parameters.
>>>>>> "http://www.google.co.uk?httpClient.soTimeout=5000"
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> But that didn't do anything. I wasn't sure if there was a way I could
>>>>>>> at
>>>>>>> least get something back.
>>>>>>>
>>>>>>> I've also read this useful page. Maybe it would be useful to have an
>>>>>>> example
>>>>>>> as most corporations will be using proxy servers.
>>>>>>> http://camel.apache.org/http.html
>>>>>> Yeah socket proxy in Java kinda sucks as you often need to set it with
>>>>>> system properties.
>>>>>>
>>>>>> Maybe  the HTTP client have nice configuration for proxy. Feel free to
>>>>>> look at Apache HTTP Client how to work with proxy.
>>>>>> And report your findings, then we can improve Camel to ease the proxy
>>>>>> configuration.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
>>>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>>>> Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>> Apache Camel Reference Card:
>>>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>>>> Interview with me:
>>>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23446776.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> Apache Camel Reference Card:
>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>> Interview with me:
>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23448297.html
>> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> Apache Camel Reference Card:
> http://refcardz.dzone.com/refcardz/enterprise-integration
> Interview with me:
> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
Reply | Threaded
Open this post in threaded view
|

Re: Http Endpoint

Claus Ibsen-2
On Sun, May 24, 2009 at 9:28 PM, jpcook <[hidden email]> wrote:

>
> Hi, so this works and I have added support for proxy username and password.
> As I have subclassed the httpclientconfigurer it should already be possible
> to use the existing getter/setter methods in the http component from the
> spring configuration.
>
> eg) something like:
>
> <bean id="http" class="org.apache.camel.component.http.HttpComponent">
>    <property name="camelContext" ref="camel"/>
>    <property name="httpClientConfigurer" ref="myHttpClientConfigurer"/>
> </bean>
>
> <bean id="myHttpClientConfigurer"
> class="org.apache.camel.component.http.ProxyHttpClientConfigurer">
>    <property name="proxyHost" value="host"/>
>    <property name="proxyPort" value="80"/>
>    <property name="username" value="username"/>
>    <property name="password" value="password"/>
> </bean>
>
> Not sure how to write a unit test for the above but I wrote another one to
> test from the uri with my companies proxy details and that worked but
> obviously don't want to submit that as it won't work for anyone else :)
Hi

Looks nice.

Yeah testing proxy settings can be tricky. But we can review the code
and then be sure it configures the proxy.
I guess maybe looking at how Apache HTTP Client unit tests its proxy
support could give a hint.


>
>
> jpcook wrote:
>>
>> Hi,
>>
>> About this last point, do you mean overload the httpcomponents
>> constructor? Currently it doesn't have one. I'm not that familiar with the
>> xml configuration side of things. Is there a unit test I could look at? I
>> searched for xml with bean id in but there isn't anything in camel core or
>> the camel http projects at the moment. What should the getters and setters
>> be for as I've created a new subclass of the httpclientconfigurer like the
>> basicauthentication subclass except for proxy configuration.
>>
>> Sorry to ask but this is my first patch :)
>>
>>
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Fri, May 8, 2009 at 5:53 PM, Claus Ibsen <[hidden email]>
>>> wrote:
>>>> On Fri, May 8, 2009 at 5:49 PM, jpcook <[hidden email]>
>>>> wrote:
>>>>>
>>>>> Yes I can do it a bit later. I might even submit a patch :)
>>>>>
>>>>> When you say via URI do you mean something like:
>>>>> http://www.google.co.uk?httpClient.proxyName=host?httpClient.proxyPort=8080
>>>>
>>>> Yeah but the httpClient prefix should not be needed. So tis
>>>> http://www.google.co.uk?proxyName=host&proxyPort=8080
>>>>
>>>>
>>>> We love contributions and patches. So please with your great findings
>>>> you should be able to grok that in the HttpComponent to set the proxy
>>>> as well.
>>>>
>>>> there is a method you can use to get the parameters in HttpComponent
>>>> String proxyName = getAndRemoveParameter("proxyName", parameters);
>>>> String proxyPort = getAndRemoveParameter("proxyPort", parameters);
>>>>
>>>> HttpComponent is the factory to create the http endpoint.
>>>
>>> And I would suggest to add support for proxy on the HttpComponent itself.
>>> Just add regular java getter/setter.
>>>
>>> Then you can overload the standard http component and configure it with
>>> proxy.
>>> Then it works globally for all the http endpoints you do routing with
>>>
>>> Something like
>>>
>>> <bean id="http" class="...HttpComponent">
>>>     <property name="proxyName" value="xxx"/>
>>>     ...
>>> </bean>
>>>
>>>
>>>
>>>
>>>>
>>>>
>>>>>
>>>>>
>>>>> Claus Ibsen-2 wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> Good findings.
>>>>>>
>>>>>> Lets add the proxy options to camel-http so you can set it easily from
>>>>>> the
>>>>>> URI.
>>>>>> Looks like the HostConfiguration object isnt easy to access currently.
>>>>>>
>>>>>> Do you mind creating a JIRA ticket for this?
>>>>>>
>>>>>> Link to JIRA from this page:
>>>>>> http://camel.apache.org/support.html
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, May 8, 2009 at 4:12 PM, jpcook <[hidden email]>
>>>>>> wrote:
>>>>>>>
>>>>>>> I have successfully created a simple unit test testing a get using
>>>>>>> the
>>>>>>> apache
>>>>>>> http client without camel.
>>>>>>>
>>>>>>> public static void main(String[] args) {
>>>>>>>                // TODO Auto-generated method stub
>>>>>>>                HttpClient client = new HttpClient();
>>>>>>>        HttpMethod method = new GetMethod("http://www.google.co.uk");
>>>>>>>
>>>>>>>        HostConfiguration config = client.getHostConfiguration();
>>>>>>>        config.setProxy(PROXY_HOST, PROXY_PORT);
>>>>>>>
>>>>>>>        try {
>>>>>>>            client.executeMethod(method);
>>>>>>>
>>>>>>>            if (method.getStatusCode() == HttpStatus.SC_OK) {
>>>>>>>                String response = method.getResponseBodyAsString();
>>>>>>>                System.out.println("Response = " + response);
>>>>>>>            }
>>>>>>>        } catch (IOException e) {
>>>>>>>            e.printStackTrace();
>>>>>>>        } finally {
>>>>>>>            method.releaseConnection();
>>>>>>>        }
>>>>>>>    }
>>>>>>>
>>>>>>> The above works nicely. However I'm struggling to put this back into
>>>>>>> my
>>>>>>> configure method with camel.
>>>>>>>
>>>>>>> public void configure() {
>>>>>>>                HttpClient client = new HttpClient();
>>>>>>>                client.getHostConfiguration().setProxy("PROXY_HOST",
>>>>>>> PROXY_PORT);
>>>>>>>                HttpEndpoint endpoint =
>>>>>>> context.getEndpoint("http://www.google.co.uk",HttpEndpoint.class);
>>>>>>>                BasicAuthenticationHttpClientConfigurer config = new
>>>>>>> BasicAuthenticationHttpClientConfigurer("","");
>>>>>>>                config.configureHttpClient(client);
>>>>>>>                endpoint.setHttpClientConfigurer(config);
>>>>>>>
>>>>>>>                from("direct:start")
>>>>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>>>>                    .to("http://www.google.co.uk").to("mock:results");
>>>>>>>            }
>>>>>>>
>>>>>>> The problem I have is that the setHttpClientConfigurer takes a
>>>>>>> HttpClientConfigurer which is an interface and the only
>>>>>>> implementation is
>>>>>>> the BasicAuthenticationHttpClientConfigurer which has to have a
>>>>>>> username
>>>>>>> and
>>>>>>> password which I don't require. I thought I could maybe hack around
>>>>>>> it
>>>>>>> above
>>>>>>> but it doesn't work.
>>>>>>>
>>>>>>> The question is should I create my own subclass of
>>>>>>> HttpClientConfigurer
>>>>>>> or
>>>>>>> am I going about this completely the wrong way? Or maybe it is better
>>>>>>> for
>>>>>>> me
>>>>>>> to write my own HttpProducer/Consumer or custom processor which would
>>>>>>> be
>>>>>>> a
>>>>>>> bit of a shame.
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>>
>>>>>>> jpcook wrote:
>>>>>>>>
>>>>>>>> And is it possible to get at the Apache HttpClient via the Camel
>>>>>>>> Http
>>>>>>>> endpoint?
>>>>>>>>
>>>>>>>> Claus Ibsen-2 wrote:
>>>>>>>>>
>>>>>>>>> On Thu, May 7, 2009 at 6:37 PM, jpcook
>>>>>>>>> <[hidden email]>
>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> I am playing around with the http endpoint in camel 2 and I
>>>>>>>>>> thought a
>>>>>>>>>> good
>>>>>>>>>> starting point would be to run the testHttpGet() in
>>>>>>>>>> http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
>>>>>>>>>>
>>>>>>>>>> So nothing happens. It just hangs. I suspect this might be because
>>>>>>>>>> I
>>>>>>>>>> need to
>>>>>>>>>> configure a proxy but I'm not sure how to do that and I can't find
>>>>>>>>>> any
>>>>>>>>>> examples really apart from an old post but again it isn't clear to
>>>>>>>>>> me.
>>>>>>>>>>
>>>>>>>>>> This is the configure method:
>>>>>>>>>> @Override
>>>>>>>>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>>>>>>>>        return new RouteBuilder() {
>>>>>>>>>>            public void configure() {
>>>>>>>>>>                from("direct:start")
>>>>>>>>>>                .setHeader(HttpConstants.HTTP_METHOD,
>>>>>>>>>> constant(org.apache.camel.component.http.HttpMethods.GET))
>>>>>>>>>>
>>>>>>>>>>  .to("http://www.google.co.uk").to("mock:results");
>>>>>>>>>>            }
>>>>>>>>>>        };
>>>>>>>>>>    }
>>>>>>>>>>
>>>>>>>>>> I also tried specifying the time out in the endpoint eg)
>>>>>>>>>> "http://www.google.co.uk?httpClient.soTimeout(5000)"
>>>>>>>>> You should set it with = as parameter, its like URI parameters.
>>>>>>>>> "http://www.google.co.uk?httpClient.soTimeout=5000"
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> But that didn't do anything. I wasn't sure if there was a way I
>>>>>>>>>> could
>>>>>>>>>> at
>>>>>>>>>> least get something back.
>>>>>>>>>>
>>>>>>>>>> I've also read this useful page. Maybe it would be useful to have
>>>>>>>>>> an
>>>>>>>>>> example
>>>>>>>>>> as most corporations will be using proxy servers.
>>>>>>>>>> http://camel.apache.org/http.html
>>>>>>>>> Yeah socket proxy in Java kinda sucks as you often need to set it
>>>>>>>>> with
>>>>>>>>> system properties.
>>>>>>>>>
>>>>>>>>> Maybe  the HTTP client have nice configuration for proxy. Feel free
>>>>>>>>> to
>>>>>>>>> look at Apache HTTP Client how to work with proxy.
>>>>>>>>> And report your findings, then we can improve Camel to ease the
>>>>>>>>> proxy
>>>>>>>>> configuration.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks
>>>>>>>>>> --
>>>>>>>>>> View this message in context:
>>>>>>>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23430772.html
>>>>>>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>>>>>>> Nabble.com.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Claus Ibsen
>>>>>>>>> Apache Camel Committer
>>>>>>>>>
>>>>>>>>> Open Source Integration: http://fusesource.com
>>>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>>>>> Apache Camel Reference Card:
>>>>>>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>>>>>>> Interview with me:
>>>>>>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23446776.html
>>>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>>>> Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>> Apache Camel Reference Card:
>>>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>>>> Interview with me:
>>>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Http-Endpoint-tp23430772p23448297.html
>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>> Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>> Apache Camel Reference Card:
>>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>> Interview with me:
>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> Apache Camel Reference Card:
>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>> Interview with me:
>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Http-Endpoint-tp23430772p23697179.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus