camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Mueller (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-1530) Upgrade camel-http to use httpclient 4.0
Date Mon, 21 Dec 2009 18:23:54 GMT

    [ https://issues.apache.org/activemq/browse/CAMEL-1530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56584#action_56584
] 

Christian Mueller commented on CAMEL-1530:
------------------------------------------

Sorry Claus, I'm a little bit confusing in my last post.
That's not the configuration for the timeout, but another valid httpParam - which is not a
String or primitive type.
At present, I prefere a builder which takes the map with the http client options and build
the HttpParams object like:

{code}
public class HttpParamsBuilder {
    
    private Map<String, Object> clientHttpParams;
    
    public HttpParamsBuilder(Map<String, Object> clientHttpParams) {
        this.clientHttpParams = clientHttpParams;
    }

    /**
     * Build the HttpParams with the provided http client options
     *
     * @param client the client
     */
    public HttpParams toHttpParams() {
        HttpParams httpParams = new BasicHttpParams();
        
        if (clientHttpParams == null || clientHttpParams.isEmpty()) {
            return httpParams;
        }
        
        if (clientHttpParams.containsKey(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE)) {
            String maxConnectionPerRoute = (String) clientHttpParams.get(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE);
            ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(Integer.parseInt(maxConnectionPerRoute)));
        }
        
        if (clientHttpParams.containsKey(ConnManagerPNames.MAX_TOTAL_CONNECTIONS)) {
            String maxConnectionTotal = (String) clientHttpParams.get(ConnManagerPNames.MAX_TOTAL_CONNECTIONS);
            ConnManagerParams.setMaxTotalConnections(httpParams, Integer.parseInt(maxConnectionTotal));
        }
        
        if (clientHttpParams.containsKey(ConnManagerPNames.TIMEOUT)) {
            String timeout = (String) clientHttpParams.get(ConnManagerPNames.TIMEOUT);
            ConnManagerParams.setTimeout(httpParams, Long.parseLong(timeout));
        }
        
        return httpParams;
    }
}
{code}

> Upgrade camel-http to use httpclient 4.0
> ----------------------------------------
>
>                 Key: CAMEL-1530
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1530
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>    Affects Versions: 2.0-M1
>            Reporter: Claus Ibsen
>            Assignee: Christian Mueller
>             Fix For: 2.2.0
>
>
> Upgrading httpclient from 3.1 to 4.0 requires changes in the camel-http code as the API
has change quite a lot.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message