Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.HeadMethod


        update(uri, relPath, new String[] {vUri}, UpdateInfo.UPDATE_BY_VERSION, removeExisting, sessionInfo);
    }

    private boolean exists(SessionInfo sInfo, String uri) {
        HeadMethod method = new HeadMethod(uri);
        try {
            int statusCode = getClient(sInfo).executeMethod(method);
            if (statusCode == DavServletResponse.SC_OK) {
                return true;
            }
        } catch (IOException e) {
            log.error("Unexpected error while testing existence of item.",e);
        } catch (RepositoryException e) {
            log.error(e.getMessage());
        } finally {
            method.releaseConnection();
        }
        return false;
    }
View Full Code Here


            if (method.equals(POST)) {
                httpMethod = new PostMethod(urlStr);
            } else if (method.equals(PUT)){
                httpMethod = new PutMethod(urlStr);
            } else if (method.equals(HEAD)){
                httpMethod = new HeadMethod(urlStr);
            } else if (method.equals(TRACE)){
                httpMethod = new TraceMethod(urlStr);
            } else if (method.equals(OPTIONS)){
                httpMethod = new OptionsMethod(urlStr);
            } else if (method.equals(DELETE)){
View Full Code Here

        LOG.trace("HTTP GET consumer thread starting: " + this);
        HttpClient httpClient = getReceiveHttpClient();
        URI remoteUrl = getRemoteUrl();

        HeadMethod httpMethod = new HeadMethod(remoteUrl.toString());
        configureMethod(httpMethod);

        int answer = httpClient.executeMethod(httpMethod);
        if (answer != HttpStatus.SC_OK) {
            throw new IOException("Failed to perform GET on: " + remoteUrl + " as response was: " + answer);
View Full Code Here

            meta = new RequestMeta();
        }
        if (meta.getQueryParam(Constants.QP_R) == null) {
            meta.setQueryParam(Constants.QP_R, Constants.DEFAULT_R.toString());
        }
        HeadMethod head = new HeadMethod(ClientUtils.makeURI(config, bucket, key));
        return executeMethod(bucket, key, head, meta);
    }
View Full Code Here

            if (method.equals(POST)) {
                httpMethod = new PostMethod(urlStr);
            } else if (method.equals(PUT)){
                httpMethod = new PutMethod(urlStr);
            } else if (method.equals(HEAD)){
                httpMethod = new HeadMethod(urlStr);
            } else if (method.equals(TRACE)){
                httpMethod = new TraceMethod(urlStr);
            } else if (method.equals(OPTIONS)){
                httpMethod = new OptionsMethod(urlStr);
            } else if (method.equals(DELETE)){
View Full Code Here

            if (file.length() > 100000) {
                httppost.setContentChunked(true);
            }
            method = httppost;
        } else if (cmd.hasOption('i')) {
            HeadMethod httphead = new HeadMethod(url.getPath());
            method = httphead;
        } else {
            GetMethod httpget = new GetMethod(url.getPath());
            method = httpget;
        }
View Full Code Here

            if (file.length() > 100000) {
                httppost.setContentChunked(true);
            }
            method = httppost;
        } else if (cmd.hasOption('i')) {
            HeadMethod httphead = new HeadMethod(url.getPath());
            method = httphead;
        } else {
            GetMethod httpget = new GetMethod(url.getPath());
            method = httpget;
        }
View Full Code Here

        }
        else if(methodName.equalsIgnoreCase("GET")){
            result = new GetMethod();
        }
        else if(methodName.equalsIgnoreCase("HEAD")){
            result = new HeadMethod();
        }
        else if(methodName.equalsIgnoreCase("LOCK")){
            result = new LockMethod();
        }
        else if(methodName.equalsIgnoreCase("MKCOL")){
View Full Code Here

        state.setCredentials(authscope, creds);
        this.client.setState(state);

        this.server.setRequestHandler(handlerchain);

        HeadMethod head = new HeadMethod("/test/");
        try {
            this.client.executeMethod(head);
        } finally {
            head.releaseConnection();
        }
        assertNotNull(head.getStatusLine());
        assertEquals(HttpStatus.SC_OK, head.getStatusLine().getStatusCode());
        Header auth = head.getRequestHeader("Authorization");
        assertNotNull(auth);
        String expected = "Basic " + EncodingUtil.getAsciiString(
            Base64.encodeBase64(EncodingUtil.getAsciiBytes("testuser:testpass")));
        assertEquals(expected, auth.getValue());
        AuthState authstate = head.getHostAuthState();
        assertNotNull(authstate.getAuthScheme());
        assertTrue(authstate.getAuthScheme() instanceof BasicScheme);
        assertEquals("test", authstate.getRealm());
    }
View Full Code Here

            if (method.equals(POST)) {
                httpMethod = new PostMethod(urlStr);
            } else if (method.equals(PUT)){
                httpMethod = new PutMethod(urlStr);
            } else if (method.equals(HEAD)){
                httpMethod = new HeadMethod(urlStr);
            } else if (method.equals(TRACE)){
                httpMethod = new TraceMethod(urlStr);
            } else if (method.equals(OPTIONS)){
                httpMethod = new OptionsMethod(urlStr);
            } else if (method.equals(DELETE)){
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.methods.HeadMethod

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.