Examples of HostConfiguration


Examples of org.apache.commons.httpclient.HostConfiguration

        defaults.add(new Header("this-header", "value1"));
        defaults.add(new Header("that-header", "value1"));
        defaults.add(new Header("that-header", "value2"));
        defaults.add(new Header("User-Agent", "test"));

        HostConfiguration hostconfig = new HostConfiguration();
        hostconfig.setHost(
                this.server.getLocalAddress(),
                this.server.getLocalPort(),
                Protocol.getProtocol("http"));
        hostconfig.getParams().setParameter(HostParams.DEFAULT_HEADERS, defaults);
       
        GetMethod httpget = new GetMethod("/miss/");
        try {
            this.client.executeMethod(hostconfig, httpget);
        } finally {
View Full Code Here

Examples of org.apache.commons.httpclient.HostConfiguration

        Log wireLog = LogFactory.getLog("httpclient.wire");
       
        URI url = new HttpURL(request.getRequestLine().getUri());

        HttpClient client = new HttpClient();
        HostConfiguration hc = new HostConfiguration();
        hc.setHost(url);
        client.setHostConfiguration(hc);
       
        //TODO support other methods
        HttpMethod method = new GetMethod(url.getPathQuery());
        Header[] headers = request.getHeaders();
View Full Code Here

Examples of org.apache.commons.httpclient.HostConfiguration

                String name = (String) e.nextElement();
                httpMethod.addRequestHeader(name, request.getHeader(name));
                log.debug("Header Name=" + name + "value=" + request.getHeader(name));
            }

            HostConfiguration hostConfiguration = new HostConfiguration();
            hostConfiguration.setHost(url.getHost(), url.getPort(), url.getProtocol());

            log.debug("\n----------------------------------------------------------------"
                    + "\n- Starting session at URI: " + url + "\n- Host:                    "
                    + url.getHost() + "\n- Port:                    " + url.getPort()
                    + "\n----------------------------------------------------------------");
View Full Code Here

Examples of org.apache.commons.httpclient.HostConfiguration

        Protocol protocol = Protocol.getProtocol(schema);

        String host = uri.getHost();
        int port = uri.getPort();
       
        HostConfiguration hc = new HostConfiguration();
        hc.setHost(host,port,protocol);
        if (httpConn!= null && hc.hostEquals(httpConn))
        {
          //Same details, no need to reset
        }
        else
        {
View Full Code Here

Examples of org.apache.commons.httpclient.HostConfiguration

        if (reset || client == null) {
            client = new HttpClient();
            // Set a state which allows lock tracking
            client.setState(new WebdavState());
            HostConfiguration hostConfig = client.getHostConfiguration();
            hostConfig.setHost(httpURL);
            if (proxyHost != null && proxyPort > 0)
                hostConfig.setProxy(proxyHost, proxyPort);

            if (hostCredentials == null) {
                String userName = httpURL.getUser();
                if (userName != null && userName.length() > 0) {
                    hostCredentials =
View Full Code Here

Examples of org.apache.commons.httpclient.HostConfiguration

     * Test that the httpURL is the same with the client.
     *
     * @return true if the given httpURL is the client for this resource.
     */
    protected synchronized boolean isTheClient() throws URIException {
        HostConfiguration hostConfig = client.getHostConfiguration();
        Credentials creds =
            client.getState().getCredentials(null, hostConfig.getHost());
        String userName = null;
        String password = null;

        if (creds instanceof UsernamePasswordCredentials) {
            UsernamePasswordCredentials upc = (UsernamePasswordCredentials) creds;
            userName = upc.getUserName();
            password = upc.getPassword();
        }
        String ref = httpURL.getUser();
        boolean userMatches = userName != null ? userName.equals(ref)
                                               : ref == null;
        if (userMatches) {
            ref = httpURL.getPassword();
            userMatches = password != null ? password.equals(ref)
                                           : ref == null;
        } else {
            return false;
        }
        if (userMatches) {
            return httpURL.getHost().equalsIgnoreCase(hostConfig.getHost())
                && httpURL.getPort()
                == hostConfig.getProtocol().resolvePort(hostConfig.getPort());
        }
        return false;
    }
View Full Code Here

Examples of org.apache.commons.httpclient.HostConfiguration

    {
        HttpClient client;
        try
        {
            client = new HttpClient(new MultiThreadedHttpConnectionManager());
            final HostConfiguration config = new HostConfiguration();
            config.setHost(hostname, port, scheme);

            if (fileSystemOptions != null)
            {
                String proxyHost = HttpFileSystemConfigBuilder.getInstance().getProxyHost(fileSystemOptions);
                int proxyPort = HttpFileSystemConfigBuilder.getInstance().getProxyPort(fileSystemOptions);

                if (proxyHost != null && proxyPort > 0)
                {
                    config.setProxy(proxyHost, proxyPort);
                }

                UserAuthenticator proxyAuth = HttpFileSystemConfigBuilder.getInstance().getProxyAuthenticator(fileSystemOptions);
                if (proxyAuth != null)
                {
View Full Code Here

Examples of org.apache.commons.httpclient.HostConfiguration

        Protocol protocol = Protocol.getProtocol(schema);

        String host = uri.getHost();
        int port = uri.getPort();
       
        HostConfiguration hc = new HostConfiguration();
        hc.setHost(host,port,protocol);
        if (httpConn!= null && hc.hostEquals(httpConn))
        {
          //Same details, no need to reset
        }
        else
        {
View Full Code Here

Examples of org.apache.commons.httpclient.HostConfiguration

            throw new PublishException("Unable to publish. "+io.getMessage(), io);
        }
    }

    private HostConfiguration getHostConfiguration(PortletPublishConfig config) {
        HostConfiguration host = new HostConfiguration();
        host.setHost(config.getHost(), config.getPort(), config.getProtocol());
        return host;
    }
View Full Code Here

Examples of org.apache.commons.httpclient.HostConfiguration

            throw new RepositoryException(e);
        }

        try {
            URI repositoryUri = new URI((uri.endsWith("/")) ? uri : uri+"/", true);
            hostConfig = new HostConfiguration();
            hostConfig.setHost(repositoryUri);

            nsCache = new NamespaceCache();
            uriResolver = new URIResolverImpl(repositoryUri, this, domFactory);
            NamePathResolver resolver = new NamePathResolverImpl(nsCache);
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.