Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.ProtocolException


        long contentLength = getRequestContentLength();

        if ((contentLength == CONTENT_LENGTH_CHUNKED)
         && getEffectiveVersion().lessEquals(HttpVersion.HTTP_1_0)) {
            throw new ProtocolException(
                "Chunked transfer encoding not allowed for " +
                getEffectiveVersion().toString());
        }
       
        this.requestEntity = generateRequestEntity();
        if (requestEntity == null) {
            LOG.debug("Request body is empty");
            return true;
        }

        if ((this.repeatCount > 0) && !requestEntity.isRepeatable()) {
            throw new ProtocolException(
                "Unbuffered entity enclosing request can not be repeated.");
        }

        this.repeatCount++;
View Full Code Here


        long contentLength = getRequestContentLength();

        if ((contentLength == CONTENT_LENGTH_CHUNKED)
         && getEffectiveVersion().lessEquals(HttpVersion.HTTP_1_0)) {
            throw new ProtocolException(
                "Chunked transfer encoding not allowed for " +
                getEffectiveVersion().toString());
        }
       
        this.requestEntity = generateRequestEntity();
        if (requestEntity == null) {
            LOG.debug("Request body is empty");
            return true;
        }

        if ((this.repeatCount > 0) && !requestEntity.isRepeatable()) {
            throw new ProtocolException(
                "Unbuffered entity enclosing request can not be repeated.");
        }

        this.repeatCount++;
View Full Code Here

                    e);
                responseAvailable = false;
            }
            if (responseAvailable) {
                if (getParams().isParameterTrue(HttpMethodParams.REJECT_HEAD_BODY)) {
                    throw new ProtocolException(
                        "Body content may not be sent in response to HTTP HEAD request");
                } else {
                    LOG.warn("Body content returned in response to HTTP HEAD");   
                }
                super.readResponseBody(state, conn);
View Full Code Here

            StringTokenizer st = new StringTokenizer(l, " ");
            method = st.nextToken();
            uri = st.nextToken();
            protocol = st.nextToken();
        } catch (NoSuchElementException e) {
            throw new ProtocolException("Invalid request line: " + l);
        }
        return new RequestLine(method, uri, protocol);
    }
View Full Code Here

        long contentLength = getRequestContentLength();

        if ((contentLength == CONTENT_LENGTH_CHUNKED)
         && getEffectiveVersion().lessEquals(HttpVersion.HTTP_1_0)) {
            throw new ProtocolException(
                "Chunked transfer encoding not allowed for " +
                getEffectiveVersion().toString());
        }
       
        this.requestEntity = generateRequestEntity();
        if (requestEntity == null) {
            LOG.debug("Request body is empty");
            return true;
        }

        if ((this.repeatCount > 0) && !requestEntity.isRepeatable()) {
            throw new ProtocolException(
                "Unbuffered entity enclosing request can not be repeated.");
        }

        this.repeatCount++;
View Full Code Here

                    e);
                responseAvailable = false;
            }
            if (responseAvailable) {
                if (getParams().isParameterTrue(HttpMethodParams.REJECT_HEAD_BODY)) {
                    throw new ProtocolException(
                        "Body content may not be sent in response to HTTP HEAD request");
                } else {
                    LOG.warn("Body content returned in response to HTTP HEAD");   
                }
                super.readResponseBody(state, conn);
View Full Code Here

            StringTokenizer st = new StringTokenizer(l, " ");
            method = st.nextToken();
            uri = st.nextToken();
            protocol = st.nextToken();
        } catch (NoSuchElementException e) {
            throw new ProtocolException("Invalid request line: " + l);
        }
        return new RequestLine(method, uri, protocol);
    }
View Full Code Here

        String protocol;
        try
        {
            if (l==null)
            {
                throw new ProtocolException(HttpMessages.requestLineIsMalformed(l).getMessage());
            }
            StringTokenizer st = new StringTokenizer(l, " ");
            method = st.nextToken();
            uri = st.nextToken();
            protocol = st.nextToken();
        }
        catch (NoSuchElementException e)
        {
            throw new ProtocolException(HttpMessages.requestLineIsMalformed(l).getMessage());
        }
        return new RequestLine(method, uri, protocol);
    }
View Full Code Here

            StringTokenizer st = new StringTokenizer(l, " ");
            method = st.nextToken();
            uri = st.nextToken();
            protocol = st.nextToken();
        } catch (NoSuchElementException e) {
            throw new ProtocolException("Invalid request line: " + l);
        }
        return new RequestLine(method, uri, protocol);
    }
View Full Code Here

            long len = getRequestContentLength();
            if (len < 0) {
                if (getEffectiveVersion().greaterEquals(HttpVersion.HTTP_1_1)) {
                    addRequestHeader("Transfer-Encoding", "chunked");
                } else {
                    throw new ProtocolException(getEffectiveVersion() +
                        " does not support chunk encoding");
                }
            } else {
                addRequestHeader("Content-Length", String.valueOf(len));
            }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.ProtocolException

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.