Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpConnection$WrappedInputStream


        }
       
        Iterator connectionIter = connectionToAdded.keySet().iterator();
       
        while (connectionIter.hasNext()) {
            HttpConnection conn = (HttpConnection) connectionIter.next();
            Long connectionTime = (Long) connectionToAdded.get(conn);
            if (connectionTime.longValue() <= idleTimeout) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Closing connection, connection time: "  + connectionTime);
                }
                connectionIter.remove();
                conn.close();
            }
        }
    }
View Full Code Here


      GetMethod getMethod = new GetMethod(url);
        getMethod.setDoAuthentication(true);
        Credentials credentials = new UsernamePasswordCredentials(username, password);
        HttpState httpState = new HttpState();
        httpState.setCredentials(null, host, credentials);
        int state = getMethod.execute(httpState, new HttpConnection(host, port, protocol));
        if ( state == HttpStatus.SC_OK ) {
            return credentials;
        }
        return null;
    }
View Full Code Here

          URI userUri = new URIValue(users+username);
          MkcolMethod mkcolMethod = new MkcolMethod(domain+userUri.toString());
          mkcolMethod.setDoAuthentication(true);
            HttpState httpState = new HttpState();
            httpState.setCredentials(null, host, credentials);
            int state = mkcolMethod.execute(httpState, new HttpConnection(host, port, protocol));
            if ( state == HttpStatus.SC_CREATED ) {
              changePassword(userUri, null, password, credentials);
              return userUri;
            }
            return null;
View Full Code Here

          URI roleUri = new URIValue(roles+rolename);
          MkcolMethod mkcolMethod = new MkcolMethod(domain+roleUri.toString());
          mkcolMethod.setDoAuthentication(true);
            HttpState httpState = new HttpState();
            httpState.setCredentials(null, host, credentials);
            int state = mkcolMethod.execute(httpState, new HttpConnection(host, port, protocol));
            if ( state == HttpStatus.SC_CREATED ) {
              return roleUri;
            }
            return null;
        }
View Full Code Here

        String url = domain+uri.toString();
        GetMethod getMethod = new GetMethod(url);
        getMethod.setDoAuthentication(true);
        HttpState httpState = new HttpState();
        httpState.setCredentials(null, host, credentials);
        int state = getMethod.execute(httpState, new HttpConnection(host, port, protocol));
        if ( state != HttpStatus.SC_OK ) {
            return null;
        }
        InputStream stream = getMethod.getResponseBodyAsStream();
        String contentType = getMethod.getResponseHeader("Content-type").getValue();
View Full Code Here

        PropPatchMethod proppatchMethod = new PropPatchMethod(domain+uri.toString());
        proppatchMethod.setDoAuthentication(true);
        HttpState httpState = new HttpState();
        httpState.setCredentials(null, host, credentials);
        proppatchMethod.addPropertyToSet(name, value, "S", namespace);
        int state = proppatchMethod.execute(httpState, new HttpConnection(host, port, protocol));
        if ( state != HttpStatus.SC_MULTI_STATUS ) {
          throw new IOException("Received status code "+state+" when doing PROPPATH on URI="+uri);
        }
    }
View Full Code Here

        props.add(new PropertyName(namespace, name));
        PropFindMethod propfindMethod = new PropFindMethod(url, 0, props.elements());
        propfindMethod.setDoAuthentication(true);
        HttpState httpState = new HttpState();
        httpState.setCredentials(null, host, credentials);
        int state = propfindMethod.execute(httpState, new HttpConnection(host, port, protocol));
        if ( state != HttpStatus.SC_MULTI_STATUS ) {
            throw new IOException("Received status code "+state+" when doing PROPFIND on URI="+url);
        }
        Enumeration propertyEnumeration = propfindMethod.getResponseProperties(url);
        if ( propertyEnumeration.hasMoreElements() ) {
View Full Code Here

        String url = domain+uri.toString();
        PropFindMethod propfindMethod = new PropFindMethod(url, 0);
        propfindMethod.setDoAuthentication(true);
        HttpState httpState = new HttpState();
        httpState.setCredentials(null, host, credentials);
        int state = propfindMethod.execute(httpState, new HttpConnection(host, port, protocol));
        if ( state != HttpStatus.SC_MULTI_STATUS ) {
            throw new IOException("Received status code "+state+" when doing PROPFIND on URI="+url);
        }
        List arrayList = new ArrayList();
        for ( Enumeration propertyEnumeration = propfindMethod.getResponseProperties(url); propertyEnumeration.hasMoreElements(); ) {
View Full Code Here

        HttpState httpState = new HttpState();
        httpState.setCredentials(null, host, credentials);
        putMethod.setRequestBody(resource.getInputStream());
        putMethod.setRequestHeader("Content-type", resource.getContentType());
        putMethod.setRequestHeader("Content-length", String.valueOf(resource.getContentLength()));
        putMethod.execute(httpState, new HttpConnection(host, port, protocol));
    }
View Full Code Here

        String url = domain+uri.toString();
        DeleteMethod deleteMethod = new DeleteMethod(url);
        deleteMethod.setDoAuthentication(true);
        HttpState httpState = new HttpState();
        httpState.setCredentials(null, host, credentials);
        deleteMethod.execute(httpState, new HttpConnection(host, port, protocol));
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.HttpConnection$WrappedInputStream

Copyright © 2018 www.massapicom. 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.