Package com.cisco.oss.foundation.http

Examples of com.cisco.oss.foundation.http.ClientException


    public byte[] getResponse() {
        if (hasResponseBody()) {
            try {
                return EntityUtils.toByteArray(httpResponse.getEntity());
            } catch (IOException e) {
                throw new ClientException(e.toString(), e);
            }
        } else {
            return new byte[0];
        }
    }
View Full Code Here


    public String getResponseAsString() {
        if (hasResponseBody()) {
            try {
                return EntityUtils.toString(httpResponse.getEntity());
            } catch (IOException e) {
                throw new ClientException(e.toString(), e);
            }
        } else {
            return "";
        }
    }
View Full Code Here

    public InputStream getInputStream() {
        if (hasResponseBody()) {
            try {
                return httpResponse.getEntity().getContent();
            } catch (IOException e) {
                throw new ClientException(e.toString(), e);
            }
        } else {
            return null;
        }
    }
View Full Code Here

        try {
            if(httpResponse instanceof CloseableHttpResponse){
                ((CloseableHttpResponse)httpResponse).close();
            }
        } catch (IOException e) {
            throw new ClientException(e.toString(), e);
        }
    }
View Full Code Here

            }else{
                client = new ApacheHttpClient(apiName, highAvailabilityStrategyType, configuration, enableLoadBalancing);
            }
            return client;
        } catch (Exception e) {
            throw new ClientException(e.toString(),e);
        }

    }
View Full Code Here

    public byte[] getResponse() {
        if (hasResponseBody()) {
            try {
                return EntityUtils.toByteArray(httpResponse.getEntity());
            } catch (IOException e) {
                throw new ClientException(e.toString(), e);
            }
        } else {
            return new byte[0];
        }
    }
View Full Code Here

    public String getResponseAsString() {
        if (hasResponseBody()) {
            try {
                return EntityUtils.toString(httpResponse.getEntity());
            } catch (IOException e) {
                throw new ClientException(e.toString(), e);
            }
        } else {
            return "";
        }
    }
View Full Code Here

    public InputStream getInputStream() {
        if (hasResponseBody()) {
            try {
                return httpResponse.getEntity().getContent();
            } catch (IOException e) {
                throw new ClientException(e.toString(), e);
            }
        } else {
            return null;
        }
    }
View Full Code Here

    @Override
    public void close() {
        try {
            httpResponse.close();
        } catch (IOException e) {
            throw new ClientException(e.toString(), e);
        }
    }
View Full Code Here

      // if you caught NoActiveServersException but you are NOT
      // firstInChain - then throw back error and don't try to reconnect
      if (throwable instanceof NoActiveServersDeadEndException || throwable instanceof NoActiveServersIOException
          || (!(throwable instanceof RemoteAccessException) && !(throwable instanceof NoActiveServersException) && !(throwable instanceof IOException) && (throwable.getCause() != null && throwable.getCause().getCause() != null && !(throwable.getCause().getCause() instanceof IOException)) && (throwable.getCause() != null && !(throwable.getCause() instanceof IOException)) || (/*!firstInChain &&*/ throwable instanceof NoActiveServersException))) {
        LOGGER.error(errorMessage, throwable);
                throw new ClientException(throwable.toString(),throwable);
      }
    }

    if (LOGGER.isDebugEnabled()) {
      // LOGGER.warn(errorMessage + ". Exception is: " + throwable);
View Full Code Here

TOP

Related Classes of com.cisco.oss.foundation.http.ClientException

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.