Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpException


        int status = client.executeMethod(method);

        // Also accept OK sent by buggy servers.
        if (status != HttpStatus.SC_MULTI_STATUS
            && status != HttpStatus.SC_OK) {
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            throw ex;
        }

        // It contains the results.
        Vector results = new Vector();
View Full Code Here


        }

        //slide/tamino delivers status code OK.
        //can be removed when the server sends MULTI_STATUS
        if (status != HttpStatus.SC_MULTI_STATUS && status != HttpStatus.SC_OK) {
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            throw ex;
        }
        thisResource = false;

        return method.getResponses();
View Full Code Here

               }
            }
            break;
           
         default:
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            throw ex;
      }
   }
View Full Code Here

         case WebdavStatus.SC_NOT_FOUND:
            // ok
            this.count++;
            break;
         default:
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            throw ex;
      }
   }
View Full Code Here

                DocumentBuilderFactory factory =
                    DocumentBuilderFactory.newInstance();
                factory.setNamespaceAware(true);
                builder = factory.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new HttpException
                    ("XML Parser Configuration error: " + e.getMessage());
            }
        }

        try {
View Full Code Here

      String contentLengthString = headers.get(Response.CONTENT_LENGTH);
      if (contentLengthString != null) {
        try {
          contentLength = Integer.parseInt(contentLengthString.trim());
        } catch (NumberFormatException ex) {
          throw new HttpException("bad content length: " +
              contentLengthString);
        }
      }
      if (http.getMaxContent() >= 0 &&
          contentLength > http.getMaxContent()) {
View Full Code Here

      String contentLengthString = headers.get(Response.CONTENT_LENGTH);
      if (contentLengthString != null) {
        try {
          contentLength = Integer.parseInt(contentLengthString.trim());
        } catch (NumberFormatException ex) {
          throw new HttpException("bad content length: " +
              contentLengthString);
        }
      }
      if (http.getMaxContent() >= 0 &&
          contentLength > http.getMaxContent()) {
View Full Code Here

        }

        int contentLength = getRequestContentLength();

        if ((contentLength == CONTENT_LENGTH_CHUNKED) && !isHttp11()) {
            throw new HttpException(
                "Chunked transfer encoding not allowed for HTTP/1.0");
        }
       
        InputStream instream = null;
        if (this.requestStream != null) {
            LOG.debug("Using unbuffered request body");
            instream = this.requestStream;
        } else {
            if (this.contentCache == null) {
                this.contentCache = generateRequestBody();
            }
            if (this.contentCache != null) {
                LOG.debug("Using buffered request body");
                instream = new ByteArrayInputStream(this.contentCache);
            }
        }

        if (instream == null) {
            LOG.debug("Request body is empty");
            return true;
        }

        if ((this.repeatCount > 0) && (this.contentCache == null)) {
            throw new HttpException(
                "Unbuffered entity enclosing request can not be repeated.");
        }

        this.repeatCount++;
View Full Code Here

        if (null == requestBody) {
            requestBody = generateRequestBody(parameters);
        }

        if ((repeatCount > 0) && (buffer == null)) {
            throw new HttpException(
                "Sorry, unbuffered POST request can not be repeated.");
        }

        repeatCount++;
View Full Code Here

            setStatusCode(status);
        }
        // Also accept OK sent by buggy servers.
        if (status != HttpStatus.SC_MULTI_STATUS
            && status != HttpStatus.SC_OK) {
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            throw ex;
        }
        thisResource = false;

        return method.getResponses();
View Full Code Here

TOP

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

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.