Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpException


    {
      return getConnectionWithTimeout( hostConfiguration, timeout );
    }
    catch( ConnectionPoolTimeoutException e )
    {
      throw new HttpException( e.getMessage() );
    }
  }
View Full Code Here


                return resourcesToXml(resources);
            } else {
                BufferedInputStream bi = null;
                bi = new BufferedInputStream(this.resource.getMethodData());
                if (!this.resource.exists()) {
                    throw new HttpException(getSecureURI() + " does not exist");
                }
                return bi;
            }
        } catch (HttpException he) {
            throw new SourceException("Could not get WebDAV resource " + getSecureURI(), he);
View Full Code Here

   */
  protected void validateResponse(HttpInvokerClientConfiguration config, PostMethod postMethod)
      throws IOException {

    if (postMethod.getStatusCode() >= 300) {
      throw new HttpException(
          "Did not receive successful HTTP response: status code = " + postMethod.getStatusCode() +
          ", status message = [" + postMethod.getStatusText() + "]");
    }
  }
View Full Code Here

   */
  protected void validateResponse(HttpInvokerClientConfiguration config, PostMethod postMethod)
      throws IOException {

    if (postMethod.getStatusCode() >= 300) {
      throw new HttpException(
          "Did not receive successful HTTP response: status code = " + postMethod.getStatusCode() +
          ", status message = [" + postMethod.getStatusText() + "]");
    }
  }
View Full Code Here

                return resourcesToXml(resources);
            } else {
                BufferedInputStream bi = null;
                bi = new BufferedInputStream(this.resource.getMethodData());
                if (!this.resource.exists()) {
                    throw new HttpException(getSecureURI() + " does not exist");
                }
                return bi;
            }
        } catch (HttpException he) {
            throw new SourceException("Could not get WebDAV resource " + getSecureURI(), he);
View Full Code Here

                return resourcesToXml(resources);
            } else {
                BufferedInputStream bi = null;
                bi = new BufferedInputStream(this.resource.getMethodData());
                if (!this.resource.exists()) {
                    throw new HttpException(this.systemId + " does not exist");
                }
                return bi;
            }
        } catch (HttpException he) {
            throw new SourceException("Could not get WebDAV resource " + getSecureURI(), he);
View Full Code Here

   */
  protected void validateResponse(HttpInvokerClientConfiguration config, PostMethod postMethod)
      throws IOException {

    if (postMethod.getStatusCode() >= 300) {
      throw new HttpException(
          "Did not receive successful HTTP response: status code = " + postMethod.getStatusCode() +
          ", status message = [" + postMethod.getStatusText() + "]");
    }
  }
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

                LOG.debug("Check for non-compliant response body. Timeout in "
                 + this.bodyCheckTimeout + " ms");   
            }
            if (conn.isResponseAvailable(this.bodyCheckTimeout)) {
                if (isStrictMode()) {
                    throw new HttpException(
                        "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

    }
    String urls = url.toExternalForm();
        GetMethod get = new GetMethod(urls);
        client.executeMethod(get);     
        if (get.getStatusCode() == 401) {
          throw new HttpException("HTTP statuscode 401 - unauthorized");
        }
        if (get.getStatusCode() == 404) {
          throw new HttpException("HTTP statuscode 404 - not found");
        }
        if (get.getStatusCode() != 200) {
          throw new HttpException("HTTP statuscode "+get.getStatusCode());
        }

        return get.getResponseBodyAsString();       
  }
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.