Hi, thanks for the solution.
A last question:
I've tryed with the 2.5-SNAPSHOT and it works, also if I don't create a new
HTTP component from code, but only using a different http url dynamically
loaded with recipientList. This is the code:
from(FROM_URL)
.process(new Processor() {
public void process(Exchange exc) throws Exception {
String username =
((HttpServletRequest)exc.getIn().getBody(HttpServletRequest.class)).getParameter("username");
String password =
((HttpServletRequest)exc.getIn().getBody(HttpServletRequest.class)).getParameter("password");
//Setting final endpoint with dynamic proxy username/password,
read from user input
exc.getIn().setHeader("FinalEndpoint",
"http:/host:port/CB?proxyHost=proxy&proxyPort=port&proxyAuthMethod=Basic&proxyAuthUsername="+username+"&proxyAuthPassword="
+ password);
}
})
.recipientList(header("FinalEndpoint"));
The question is: does it work also in case of concurrent requests? I've the
suspect that in this case there is only one http component, reconfigured at
runtime. Is this solution safe in concurrent case? Or is it preferrable to
create new "httpX" components with a progressive 'X' in each call, in order to
avoid the reuse of the same component?
Thanks.
________________________________________
Da: Willem Jiang [[email protected]]
Inviato: sabato 17 luglio 2010 13.15
A: Willem Jiang
Cc: [email protected]
Oggetto: Re: R: Dynamically change HTTP endpoint parameters
FYI,the patch of CAMEL-2950 is applied into camel trunk, please check
out the latest Camel 2.5-SNAPSHOT to verify the fix :)
Willem
----------------------------------
Apache Camel, Apache CXF committer
Open Source Integration http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang
Willem Jiang wrote:
> Yes, they are the same problem.
> Current camel-http component can't deal with the address part rightly.
> It should skip the URI which protocal part is not start with http: or
> https, in this way we could register a customer protocal name for it.
>
> I just create a JIRA[1] for it.
>
> [1]https://issues.apache.org/activemq/browse/CAMEL-2950
>
> Willem
> ----------------------------------
> Apache Camel, Apache CXF committer
> Open SOA http://www.fusesource.com
> Blog http://willemjiang.blogspot.com
> Tiwtter http://twitter.com/willemjiang
>
> Cappa Roberto wrote:
>> The two versions:
>>
>> HttpComponent httpComponent = new HttpComponent();
>> getContext().addComponent("http2", httpComponent);
>>
>>
>> or
>> getContext().addComponent("http2", getContext().getComponent("http"));
>>
>> have the same behaviour when the endpoint is used (the "unsupported
>> protocol: 'http2'" exception). Probably there is another problem.
>>
>> Thanks
>>