Examples of HttpHost


Examples of org.apache.commons.httpclient.HttpHost

    public Object clone() {
        return new ProtocolAwareHostConfiguration(this);
    }

    public synchronized void setHost(String host, int port, String scheme) {
        setHost(new HttpHost(host, port, keepProtocol(host, port, scheme)));
    }
View Full Code Here

Examples of org.apache.http.HttpHost

    }
    return PageFetchStatus.UnknownError;
  }

  public static void setProxy(String proxyHost, int proxyPort) {
    HttpHost proxy = new HttpHost(proxyHost, proxyPort);
    httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
  }
View Full Code Here

Examples of org.apache.http.HttpHost

        }
       

        if (proxyProperties != null)
        {
            HttpHost proxy = new HttpHost(
                    proxyProperties.getProxyHostName(),
                    proxyProperties.getProxyPort());

          client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
View Full Code Here

Examples of org.apache.http.HttpHost

     *
     * @return the HttpHost to be used as proxy
     */
    public static HttpHost getProxyHost() {
      if (!use) return null;
      return new HttpHost(host, port);
    }
View Full Code Here

Examples of org.apache.http.HttpHost

    // for statistics same value should also be set here
    ConnectionInfo.setMaxcount(maxcon);
    // connections per host (2 default)
    clientConnectionManager.setDefaultMaxPerRoute(2);
    // Increase max connections for localhost
    final HttpHost localhost = new HttpHost("localhost");
    clientConnectionManager.setMaxForRoute(new HttpRoute(localhost), maxcon);
    /**
     * HTTP protocol settings
     */
    HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);
View Full Code Here

Examples of org.apache.http.HttpHost

     * this method sets a host on which more than the default of 2 router per host are allowed
     *
     * @param the host to be raised in 'route per host'
     */
    public static void setMaxRouteHost(final String host) {
      final HttpHost mHost = new HttpHost(host);
      ((ThreadSafeClientConnManager) httpClient.getConnectionManager()).setMaxForRoute(new HttpRoute(mHost), 50);
    }
View Full Code Here

Examples of org.apache.http.HttpHost

    if (userPreferences.isProxyEnabled()) {
      // set up HTTP proxy
      final String proxyHostname = userPreferences.getProxyHostname();
      final int proxyPort = userPreferences.getProxyPort();

      final HttpHost proxy = new HttpHost(proxyHostname, proxyPort);
      httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

      if (userPreferences.isProxyAuthenticationEnabled()) {
        final AuthScope authScope = new AuthScope(proxyHostname, proxyPort);
        final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(
View Full Code Here

Examples of org.apache.http.HttpHost

                Integer.valueOf((int) csPolicy.getReceiveTimeout()));
       
        Proxy p = proxyFactory.createProxy(csPolicy , uri);
        if (p != null) {
            InetSocketAddress isa = (InetSocketAddress)p.address();
            HttpHost proxy = new HttpHost(isa.getHostName(), isa.getPort());
            ConnRouteParams.setDefaultProxy(e.getParams(), proxy);
        }
        message.put(CXFHttpRequest.class, e);
    }
View Full Code Here

Examples of org.apache.http.HttpHost

        }
    }

    public static void release(NHttpClientConnection conn) {

        HttpHost host = (HttpHost) conn.getContext().getAttribute(
            ExecutionContext.HTTP_TARGET_HOST);
        String key = host.getHostName() + ":" + Integer.toString(host.getPort());

        List connections = (List) connMap.get(key);
        if (connections == null) {
            synchronized(connMap) {
                // use double locking to make sure
                connections = (List) connMap.get(key);
                if (connections == null) {
                    connections = Collections.synchronizedList(new LinkedList());
                    connMap.put(key, connections);
                }
            }
        }

        cleanConnectionReferences(conn);
        connections.add(conn);

        if (log.isDebugEnabled()) {
            log.debug("Released a connection to host: " + host.getHostName() + " on port : " +
                    host.getPort() + " to the connection pool of current size : " + connections.size());
        }
    }
View Full Code Here

Examples of org.apache.http.HttpHost

        conn.resetOutput();
    }

    public static void forget(NHttpClientConnection conn) {

        HttpHost host = (HttpHost) conn.getContext().getAttribute(
            ExecutionContext.HTTP_TARGET_HOST);
        String key = host.getHostName() + ":" + Integer.toString(host.getPort());

        List connections = (List) connMap.get(key);
        if (connections != null) {
            synchronized(connections) {
                connections.remove(conn);
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.