Examples of ConnManagerParamBean


Examples of org.apache.http.conn.params.ConnManagerParamBean

   
    // Create and configure HTTP client
    HttpParams params = new BasicHttpParams();
    HttpProtocolParamBean hppb = new HttpProtocolParamBean(params);
    HttpConnectionParamBean hcpb = new HttpConnectionParamBean(params);
    ConnManagerParamBean cmpb = new ConnManagerParamBean(params);
   
    // Set protocol parametes
    hppb.setVersion(HttpVersion.HTTP_1_1);
    hppb.setContentCharset(HTTP.ISO_8859_1);
    hppb.setUseExpectContinue(true);
    // Set connection parameters
    hcpb.setStaleCheckingEnabled(false);
    // Set connection manager parameters
    ConnPerRouteBean connPerRouteBean = new ConnPerRouteBean();
    connPerRouteBean.setDefaultMaxPerRoute(2);
    cmpb.setConnectionsPerRoute(connPerRouteBean);
   
    DroidsHttpClient httpclient = new DroidsHttpClient(params);
   
    HttpProtocol httpProtocol = new HttpProtocol(httpclient);
    protocolFactory.setMap(new HashMap<String, Object>());
View Full Code Here

Examples of org.apache.http.conn.params.ConnManagerParamBean

        Configuration routesConf = configuration.subset("proxy.http.route");
       
        if (!connManagerParamsConf.isEmpty() || !routesConf.isEmpty())
        {
            HttpParams connManagerParams = new BasicHttpParams();
            ConnManagerParamBean connManagerParamBean = new ConnManagerParamBean(connManagerParams);
            setBeanPropertiesByConfiguration(connManagerParamBean, connManagerParamsConf);
           
            Map<HttpHost, HttpRoute> proxyRouteMap = new HashMap<HttpHost, HttpRoute>();
           
            if (!routesConf.isEmpty())
            {
                ConnPerRouteBean connPerRouteBean = new ConnPerRouteBean();
                setBeanPropertiesByConfiguration(connPerRouteBean, routesConf.subset("param"));
               
                Map<HttpRoute, Integer> maxForRoutes = new HashMap<HttpRoute, Integer>();
               
                String [] routeNames = routesConf.getStringArray("");
               
                for (String routeName : routeNames)
                {
                    Configuration routeConf = routesConf.subset(routeName);
                   
                    try
                    {
                        HttpRoute httpRoute = buildHttpRoute(routeConf);
                       
                        int maxConnections = routeConf.getInt("maxConnections", -1);
                       
                        if (maxConnections >= 0)
                        {
                            maxForRoutes.put(httpRoute, maxConnections);
                        }
                       
                        if (httpRoute.getProxyHost() != null)
                        {
                            proxyRouteMap.put(httpRoute.getTargetHost(), httpRoute);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new ServletException(e);
                    }
                }
               
                connPerRouteBean.setMaxForRoutes(maxForRoutes);
                connManagerParamBean.setConnectionsPerRoute(connPerRouteBean);
            }
           
            tempProxyService.setConnectionManagerParams(connManagerParams);
           
            if (!proxyRouteMap.isEmpty())
View Full Code Here

Examples of org.apache.http.conn.params.ConnManagerParamBean

    protected ClientConnectionManager createConnectionManager() {
        SchemeRegistry schemeRegistry = new SchemeRegistry();

        // configure additional configurations
        HttpParams params = new BasicHttpParams();
        ConnManagerParamBean param = new ConnManagerParamBean(params);
        if (getMaxTotalConnections() > 0) {
            param.setMaxTotalConnections(getMaxTotalConnections());
        }
        if (getConnectionsPerRoute() > 0) {
            param.setConnectionsPerRoute(new ConnPerRouteBean(getConnectionsPerRoute()));
        }

        ThreadSafeClientConnManager answer = new ThreadSafeClientConnManager(params, schemeRegistry);
        LOG.info("Created ClientConnectionManager " + answer);
View Full Code Here

Examples of org.apache.http.conn.params.ConnManagerParamBean

        IntrospectionSupport.setProperties(clientParamBean, parameters, "httpClient.");

        ConnConnectionParamBean connConnectionParamBean = new ConnConnectionParamBean(clientParams);
        IntrospectionSupport.setProperties(connConnectionParamBean, parameters, "httpClient.");

        ConnManagerParamBean connManagerParamBean = new ConnManagerParamBean(clientParams);
        IntrospectionSupport.setProperties(connManagerParamBean, parameters, "httpClient.");

        ConnRouteParamBean connRouteParamBean = new ConnRouteParamBean(clientParams);
        IntrospectionSupport.setProperties(connRouteParamBean, parameters, "httpClient.");
View Full Code Here

Examples of org.apache.http.conn.params.ConnManagerParamBean

    protected ClientConnectionManager createConnectionManager() {
        SchemeRegistry schemeRegistry = new SchemeRegistry();

        // configure additional configurations
        HttpParams params = new BasicHttpParams();
        ConnManagerParamBean param = new ConnManagerParamBean(params);
        if (getMaxTotalConnections() > 0) {
            param.setMaxTotalConnections(getMaxTotalConnections());
        }
        if (getConnectionsPerRoute() > 0) {
            param.setConnectionsPerRoute(new ConnPerRouteBean(getConnectionsPerRoute()));
        }

        ThreadSafeClientConnManager answer = new ThreadSafeClientConnManager(params, schemeRegistry);
        LOG.info("Created ClientConnectionManager " + answer);
View Full Code Here

Examples of org.apache.http.conn.params.ConnManagerParamBean

        IntrospectionSupport.setProperties(clientParamBean, parameters, "httpClient.");

        ConnConnectionParamBean connConnectionParamBean = new ConnConnectionParamBean(clientParams);
        IntrospectionSupport.setProperties(connConnectionParamBean, parameters, "httpClient.");

        ConnManagerParamBean connManagerParamBean = new ConnManagerParamBean(clientParams);
        IntrospectionSupport.setProperties(connManagerParamBean, parameters, "httpClient.");

        ConnRouteParamBean connRouteParamBean = new ConnRouteParamBean(clientParams);
        IntrospectionSupport.setProperties(connRouteParamBean, parameters, "httpClient.");
View Full Code Here

Examples of org.apache.http.conn.params.ConnManagerParamBean

        Configuration routesConf = configuration.subset("proxy.http.route");
       
        if (!connManagerParamsConf.isEmpty() || !routesConf.isEmpty())
        {
            HttpParams connManagerParams = new BasicHttpParams();
            ConnManagerParamBean connManagerParamBean = new ConnManagerParamBean(connManagerParams);
            setBeanPropertiesByConfiguration(connManagerParamBean, connManagerParamsConf);
           
            Map<HttpHost, HttpRoute> proxyRouteMap = new HashMap<HttpHost, HttpRoute>();
           
            if (!routesConf.isEmpty())
            {
                ConnPerRouteBean connPerRouteBean = new ConnPerRouteBean();
                setBeanPropertiesByConfiguration(connPerRouteBean, routesConf.subset("param"));
               
                Map<HttpRoute, Integer> maxForRoutes = new HashMap<HttpRoute, Integer>();
               
                String [] routeNames = routesConf.getStringArray("");
               
                for (String routeName : routeNames)
                {
                    Configuration routeConf = routesConf.subset(routeName);
                   
                    try
                    {
                        HttpRoute httpRoute = buildHttpRoute(routeConf);
                       
                        int maxConnections = routeConf.getInt("maxConnections", -1);
                       
                        if (maxConnections >= 0)
                        {
                            maxForRoutes.put(httpRoute, maxConnections);
                        }
                       
                        if (httpRoute.getProxyHost() != null)
                        {
                            proxyRouteMap.put(httpRoute.getTargetHost(), httpRoute);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new ServletException(e);
                    }
                }
               
                connPerRouteBean.setMaxForRoutes(maxForRoutes);
                connManagerParamBean.setConnectionsPerRoute(connPerRouteBean);
            }
           
            tempProxyService.setConnectionManagerParams(connManagerParams);
           
            if (!proxyRouteMap.isEmpty())
View Full Code Here

Examples of org.apache.http.conn.params.ConnManagerParamBean

   
    // Create and configure HTTP client
    HttpParams params = new BasicHttpParams();
    HttpProtocolParamBean hppb = new HttpProtocolParamBean(params);
    HttpConnectionParamBean hcpb = new HttpConnectionParamBean(params);
    ConnManagerParamBean cmpb = new ConnManagerParamBean(params);
   
    // Set protocol parametes
    hppb.setVersion(HttpVersion.HTTP_1_1);
    hppb.setContentCharset(HTTP.ISO_8859_1);
    hppb.setUseExpectContinue(true);
    // Set connection parameters
    hcpb.setStaleCheckingEnabled(false);
    // Set connection manager parameters
    ConnPerRouteBean connPerRouteBean = new ConnPerRouteBean();
    connPerRouteBean.setDefaultMaxPerRoute(2);
    cmpb.setConnectionsPerRoute(connPerRouteBean);
   
    DroidsHttpClient httpclient = new DroidsHttpClient(params);
   
    HttpProtocol httpProtocol = new HttpProtocol(httpclient);
    protocolFactory.getMap().put("http", httpProtocol);
View Full Code Here

Examples of org.apache.http.conn.params.ConnManagerParamBean

        Configuration routesConf = configuration.subset("proxy.http.route");
       
        if (!connManagerParamsConf.isEmpty() || !routesConf.isEmpty())
        {
            HttpParams connManagerParams = new BasicHttpParams();
            ConnManagerParamBean connManagerParamBean = new ConnManagerParamBean(connManagerParams);
            setBeanPropertiesByConfiguration(connManagerParamBean, connManagerParamsConf);
           
            Map<HttpHost, HttpRoute> proxyRouteMap = new HashMap<HttpHost, HttpRoute>();
           
            if (!routesConf.isEmpty())
            {
                ConnPerRouteBean connPerRouteBean = new ConnPerRouteBean();
                setBeanPropertiesByConfiguration(connPerRouteBean, routesConf.subset("param"));
               
                Map<HttpRoute, Integer> maxForRoutes = new HashMap<HttpRoute, Integer>();
               
                String [] routeNames = routesConf.getStringArray("");
               
                for (String routeName : routeNames)
                {
                    Configuration routeConf = routesConf.subset(routeName);
                   
                    try
                    {
                        HttpRoute httpRoute = buildHttpRoute(routeConf);
                       
                        int maxConnections = routeConf.getInt("maxConnections", -1);
                       
                        if (maxConnections >= 0)
                        {
                            maxForRoutes.put(httpRoute, maxConnections);
                        }
                       
                        if (httpRoute.getProxyHost() != null)
                        {
                            proxyRouteMap.put(httpRoute.getTargetHost(), httpRoute);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new ServletException(e);
                    }
                }
               
                connPerRouteBean.setMaxForRoutes(maxForRoutes);
                connManagerParamBean.setConnectionsPerRoute(connPerRouteBean);
            }
           
            tempProxyService.setConnectionManagerParams(connManagerParams);
           
            if (!proxyRouteMap.isEmpty())
View Full Code Here

Examples of org.apache.http.conn.params.ConnManagerParamBean

    protected ClientConnectionManager createConnectionManager() {
        SchemeRegistry schemeRegistry = new SchemeRegistry();

        // configure additional configurations
        HttpParams params = new BasicHttpParams();
        ConnManagerParamBean param = new ConnManagerParamBean(params);
        if (getMaxTotalConnections() > 0) {
            param.setMaxTotalConnections(getMaxTotalConnections());
        }
        if (getConnectionsPerRoute() > 0) {
            param.setConnectionsPerRoute(new ConnPerRouteBean(getConnectionsPerRoute()));
        }

        ThreadSafeClientConnManager answer = new ThreadSafeClientConnManager(params, schemeRegistry);
        LOG.info("Created ClientConnectionManager " + answer);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.