On Mon, Nov 9, 2009 at 10:46 AM, Willem Jiang <willem.ji...@gmail.com> wrote:
> I checked the code of http client 3.1, there is no parameter key of
> "http.protocol.handle-redirects".
> This option is part of client 4.0.
> Maybe we should consider to upgrade camel-http to use httpclient 4.0.
>

Yeah sometime after Camel 2.1 as we should keep camel-http stable as
3.1 vs 4.0 is a lot changed in the API.
There is already a ticket about this upgrade.


> Willem
>
> Willem Jiang wrote:
>>
>> Oh, camel-http component doesn't support to take the
>> parameter like "http.protocol.handle-redirects".
>>
>> After digging the code for a while, I think I can do some enhancement on
>> the camel-http endpoint this weekend :)
>>
>> Willem
>>
>> Markus Wolf wrote:
>>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Hi Willem,
>>>
>>>> Please try to set http endpoint uri like this
>>>>
>>>> http://www.example.com/example?httpClient.http.protocol.handle-redirects=false
>>>>
>>> this results in the following exception:
>>>
>>> org.apache.camel.ResolveEndpointFailedException: Failed to resolve
>>> endpoint:
>>>
>>> http://127.0.0.1:8888/track-link?e=1&httpClient.http.protocol.handle-redirects=false&l=2
>>> due to: Failed to resolve endpoint:
>>>
>>> http://127.0.0.1:8888/track-link?e=1&httpClient.http.protocol.handle-redirects=false&l=2
>>> due to: There are 1 parameters that couldn't be set on the endpoint.
>>> Check the uri if the parameters are spelt correctly and that they are
>>> properties of the endpoint. Unknown
>>> parameters=[{http.protocol.handle-redirects=false}]
>>>    at
>>>
>>> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:414)
>>>    at
>>>
>>> org.apache.camel.impl.DefaultProducerTemplate.resolveMandatoryEndpoint(DefaultProducerTemplate.java:402)
>>>    at
>>>
>>> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:87)
>>>    at
>>>
>>> org.apache.camel.impl.DefaultProducerTemplate.request(DefaultProducerTemplate.java:262)
>>>    at
>>>
>>> de.llynch.esb.tracker.LinkTrackerImplTest.testLinkClickWithParameters(LinkTrackerImplTest.java:62)
>>>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>    at
>>>
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>    at
>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>    at java.lang.reflect.Method.invoke(Method.java:597)
>>>    at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
>>>    at
>>>
>>> org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
>>>    at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
>>>    at
>>>
>>> org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
>>>    at
>>> org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
>>>    at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
>>>    at
>>>
>>> org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
>>>    at
>>>
>>> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
>>>    at
>>>
>>> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
>>>    at
>>>
>>> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
>>>    at
>>> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
>>>    at
>>>
>>> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
>>>    at
>>>
>>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
>>>    at
>>>
>>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>>    at
>>>
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>>    at
>>>
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>>    at
>>>
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>>    at
>>>
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>>> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
>>> resolve endpoint:
>>>
>>> http://127.0.0.1:8888/track-link?e=1&httpClient.http.protocol.handle-redirects=false&l=2
>>> due to: There are 1 parameters that couldn't be set on the endpoint.
>>> Check the uri if the parameters are spelt correctly and that they are
>>> properties of the endpoint. Unknown
>>> parameters=[{http.protocol.handle-redirects=false}]
>>>    at
>>>
>>> org.apache.camel.impl.DefaultComponent.validateParameters(DefaultComponent.java:115)
>>>    at
>>>
>>> org.apache.camel.component.http.HttpComponent.createEndpoint(HttpComponent.java:117)
>>>    at
>>>
>>> org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:79)
>>>    at
>>>
>>> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:394)
>>>    ... 26 more
>>>
>>>
>>>
>>>
>>> This behaviour is caused, because there is not javabean setter for the
>>> property in the HttpClientParam class.
>>>
>>> But thanks anyway :)
>>>
>>>
>>>> You can dig the HttpClient's document[1] for more information.
>>>>
>>>>
>>>> [1]http://hc.apache.org/httpcomponents-client/tutorial/html/httpagent.html#d4e1015
>>>>
>>>>
>>>> Willem
>>>>
>>>> Markus Wolf wrote:
>>>> Hi there,
>>>>
>>>> I would like to write a unit test that verifies that our services
>>>> processor returns an expected redirect after processing. But the
>>>> httpclient always implicitly redirects and returns that result.
>>>>
>>>> Is there a way to force the http-client endpoint to do not redirect but
>>>> set the http-status header and the location header?
>>>>
>>>> Thanks
>>>> Markus Wolf
>>>
>>> - --
>>> NMMN - New Media Markets & Networks GmbH
>>> Langbehnstrasse 6, 22761 Hamburg
>>> Geschäftsführung: Kfm. Michael Schütt
>>> Finanzamt HH-Altona - UStID DE 812 699 852 - HRB 71102 Hamburg
>>> HypoVereinsbank   -   BLZ 200 300 00   -   Konto-Nr. 156 29 82
>>>
>>> http://www.nmmn.com
>>> Tel.: +49 40 284 118-0  -  Fax: +49 40 284118-999
>>> Softwareentwicklung LLynch: -720
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.9 (GNU/Linux)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>>
>>> iEYEARECAAYFAkr0KFUACgkQDBHISU1oEKFeGgCgm7cs3uxYQRN2ggJQTg1R38at
>>> 76gAnRKYtHE8LEO680+Kp/RD4BkYjHbs
>>> =cxyP
>>> -----END PGP SIGNATURE-----
>>>
>>
>>
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to