Examples of RestException


Examples of com.cloudesire.tisana4j.exceptions.RestException

        String charset = type.getCharset() != null ? type.getCharset().name() : "UTF-8";

        String errorStream = IOUtils.toString(stream, charset);

        ResponseMessage responseMessage = new ResponseMessage();
        RestException translatedException = exceptionTranslator.translateException(responseCode, response
          .getStatusLine().getReasonPhrase(), errorStream, responseMessage);

        if (translatedException != null) throw translatedException;

        throw getDefaultException(responseCode, response.getStatusLine().getReasonPhrase(), responseMessage.getResponse() );

      } catch (IllegalStateException | IOException e)
      {
        throw new RestException(responseCode, e.getMessage());
      }

    }
  }
View Full Code Here

Examples of com.cloudseal.rest.exception.RestException

    try {
      LOG.debug("Creating JAXB marshaller/unmarshaller");
      jaxbContext = JAXBContext.newInstance("com.cloudseal.rest.jaxb");
    } catch (JAXBException ex) {
      throw new RestException(ex);
    }
  }
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestException

                }
            }

        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }
                if(exception.getResponse().getStatus() == NOT_FOUND.getCode()) {
                    return false;
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestException

                    logger.debug("Did not get any response!");
                }
            }
        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }

            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestException

            RestResponse response = fetchGetResponse(rb, FETCH_SCHEMA_TIMEOUT_MS);
            return response.getEntity().asString("UTF-8");
        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
            }
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestException

                    logger.debug("Empty response !");
                }
            }
        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }

                int httpErrorStatus = exception.getResponse().getStatus();
                if(httpErrorStatus == BAD_REQUEST.getCode()) {
                    throw new VoldemortException("Bad request: " + e.getMessage(), e);
                } else if(httpErrorStatus == PRECONDITION_FAILED.getCode()) {
                    throw new ObsoleteVersionException(e.getMessage());
                } else if(httpErrorStatus == REQUEST_TIMEOUT.getCode()
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestException

                    }
                }
            }
        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
            }
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestException

                    logger.debug("Did not get any response!");
                }
            }
        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }

            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestException

    }

    private void handleRequestAndResponseException(Exception e) {
        if(e instanceof ExecutionException) {
            if(e.getCause() instanceof RestException) {
                RestException re = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST Exception Status: " + re.getResponse().getStatus());
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
            }
View Full Code Here

Examples of com.robustaweb.library.commons.exception.RestException

            callback.onSuccess(response);
        } else if (httpCode >= 300 && httpCode < 400) {
            //no success
        } else if (httpCode >= 400 && httpCode < 600) {
        } else if (httpCode < 600) {
            callback.onFailure(new RestException(httpCode, response));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.