Package org.apache.http.client

Examples of org.apache.http.client.HttpResponseException


            public Document handleResponse(final HttpResponse response) throws IOException {
                StatusLine statusLine = response.getStatusLine();
                HttpEntity entity = response.getEntity();
                if (statusLine.getStatusCode() >= 300) {
                    throw new HttpResponseException(
                            statusLine.getStatusCode(),
                            statusLine.getReasonPhrase());
                }
                if (entity == null) {
                    throw new ClientProtocolException("Response contains no content");
View Full Code Here


            public Document handleResponse(final HttpResponse response) throws IOException {
                StatusLine statusLine = response.getStatusLine();
                HttpEntity entity = response.getEntity();
                if (statusLine.getStatusCode() >= 300) {
                    throw new HttpResponseException(
                            statusLine.getStatusCode(),
                            statusLine.getReasonPhrase());
                }
                if (entity == null) {
                    throw new ClientProtocolException("Response contains no content");
View Full Code Here

  public Browsable handleResponse(HttpResponse response) throws ClientProtocolException, IOException {

    StatusLine statusLine = response.getStatusLine();
    if (statusLine.getStatusCode() >= 300) {
      throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase());
    }
    HttpEntity entity = response.getEntity();
    InputStream inputStream = entity.getContent();
    // BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
    // String line = null;
View Full Code Here

            }
        }

        // Examine the response status
        if (response == null) {
            throw new HttpResponseException(403, ResourceManager.getLanguageDependentString("InvalidSSLMessage"));
        }
        StatusLine status = response.getStatusLine();
        if (status  == null || status.getStatusCode() == 302 || status.getStatusCode() == 401 || status.getStatusCode() == 500) {
            if (failOnError) {
                throw new AuthenticationException(ResourceManager.getLanguageDependentString("AuthenticationFailed"));
View Full Code Here

            System.err.println("There may be an error in your parameter settings.");
            break;
          default:
            break;
          }
          throw new HttpResponseException(res.getStatusLine().getStatusCode(), e.getMessage());
         
        } catch (ClientProtocolException e) {
      e.printStackTrace();
      return Collections.emptyMap();
    } catch (IOException e) {
View Full Code Here

      FetchResponse response = fetcher.fetch(request);

      int status = response.getStatusCode();

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

      return HostMeta.parseFromStream(response.getContentAsStream());
View Full Code Here

    if(s.getStatusCode() == 200)
    {
      return (String)processResponse(response);
    } else {
      System.out.println("ERROR: " + s.getReasonPhrase());
      throw new HttpResponseException(s.getStatusCode(), s.toString());
    }
  }
View Full Code Here

      @Override
      public Void handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
        StatusLine statusLine = response.getStatusLine();
        int code = statusLine.getStatusCode();
        if(code != HttpStatus.SC_OK)
          throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase());

        HttpEntity entity = response.getEntity();
        entity.writeTo(output);
        return null;
      }
View Full Code Here

    String message;
    if(status != null && status.length() > 0)
      message = status;
    else
      message = "Unknown error occurred";
    return new HttpResponseException(code, message);
  }
View Full Code Here

      }
      catch(Exception e) {
        // Just skip
        msg = statusLine.getReasonPhrase();
      }
      throw new HttpResponseException(statusLine.getStatusCode(), msg);
    }

    HttpEntity entity = response.getEntity();
    if(isOk(code)) {
      if(type == null)
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.