Package org.apache.http.client

Examples of org.apache.http.client.HttpResponseException


      int status = response.getStatusCode();

      responseStream = response.getContentAsStream();

      if (status != HttpStatus.SC_OK) {
        throw new HttpResponseException(status, "fetching host-meta from " +
            host + " return status " + status);
      }

      return HostMeta.parseFromStream(responseStream);
View Full Code Here


    public Content handleResponse(
            final HttpResponse response) throws ClientProtocolException, IOException {
        final StatusLine statusLine = response.getStatusLine();
        final HttpEntity entity = response.getEntity();
        if (statusLine.getStatusCode() >= 300) {
            throw new HttpResponseException(statusLine.getStatusCode(),
                    statusLine.getReasonPhrase());
        }
        if (entity != null) {
            return new Content(
                    EntityUtils.toByteArray(entity),
View Full Code Here

            String bodyString = super.handleResponse(response);
            JSONObject jsonObject = null;
            try {
                jsonObject = JSONObject.fromObject( bodyString );
            } catch(JSONException e) {
                throw new HttpResponseException(0, e.getMessage());
            }
            Set<Map.Entry<String, String>> paramSet = this.parentRemoteRequest.outMap.entrySet();
            Iterator<Map.Entry<String, String>> paramIter = paramSet.iterator();
            Map<String, Object> parentDataMap = this.parentRemoteRequest.parent.getMap();
            while (paramIter.hasNext()) {
View Full Code Here

                    reason = sb.toString();
                } else {
                    reason = statusLine.getReasonPhrase();
                }
                EntityUtils.consume(entity);
                throw new HttpResponseException(statusLine.getStatusCode(), reason);
            }
            //parse the results
            InputStream in = null;
            try {
                in = entity.getContent();
View Full Code Here

        logger.info("HttpContent: " + ret);

        StatusLine statusLine = response.getStatusLine();
        if (statusLine.getStatusCode() >= 300) {
            logger.warn("Http Response Body: \n" + ret);
            throw new HttpResponseException(statusLine.getStatusCode(),
                    statusLine.getReasonPhrase());
        }

        logger.debug("Response: " + ret);
View Full Code Here

    public void saveContent(final File file) throws IOException {
        assertNotConsumed();
        StatusLine statusLine = response.getStatusLine();
        if (statusLine.getStatusCode() >= 300) {
            throw new HttpResponseException(statusLine.getStatusCode(),
                    statusLine.getReasonPhrase());
        }
        FileOutputStream out = new FileOutputStream(file);
        try {
            HttpEntity entity = this.response.getEntity();
View Full Code Here

    public void saveContent(final File file) throws IOException {
        assertNotConsumed();
        final StatusLine statusLine = response.getStatusLine();
        if (statusLine.getStatusCode() >= 300) {
            throw new HttpResponseException(statusLine.getStatusCode(),
                    statusLine.getReasonPhrase());
        }
        final FileOutputStream out = new FileOutputStream(file);
        try {
            final HttpEntity entity = this.response.getEntity();
View Full Code Here

    public Content handleResponse(
            final HttpResponse response) throws ClientProtocolException, IOException {
        final StatusLine statusLine = response.getStatusLine();
        final HttpEntity entity = response.getEntity();
        if (statusLine.getStatusCode() >= 300) {
            throw new HttpResponseException(statusLine.getStatusCode(),
                    statusLine.getReasonPhrase());
        }
        if (entity != null) {
            return new Content(
                    EntityUtils.toByteArray(entity),
View Full Code Here

    public void saveContent(final File file) throws IOException {
        assertNotConsumed();
        final StatusLine statusLine = response.getStatusLine();
        if (statusLine.getStatusCode() >= 300) {
            throw new HttpResponseException(statusLine.getStatusCode(),
                    statusLine.getReasonPhrase());
        }
        final FileOutputStream out = new FileOutputStream(file);
        try {
            final HttpEntity entity = this.response.getEntity();
View Full Code Here

    public Content handleResponse(
            final HttpResponse response) throws ClientProtocolException, IOException {
        final StatusLine statusLine = response.getStatusLine();
        final HttpEntity entity = response.getEntity();
        if (statusLine.getStatusCode() >= 300) {
            throw new HttpResponseException(statusLine.getStatusCode(),
                    statusLine.getReasonPhrase());
        }
        if (entity != null) {
            return new Content(
                    EntityUtils.toByteArray(entity),
View Full Code Here

TOP

Related Classes of org.apache.http.client.HttpResponseException

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.