Package org.worldbank.api.services

Examples of org.worldbank.api.services.WorldBankException


          if (response.isJsonArray()) {
            PagedList<E> responseList = unmarshallList(response.getAsJsonArray());
//            notifyObservers(responseList);
          return responseList;
          }
          throw new WorldBankException("Unknown content found in response:" + response.toString());
        } catch (Exception e) {
            throw new WorldBankException(e);
        } finally {
          closeStream(jsonContent);
      }
  }
View Full Code Here


        try {
          JsonElement element = parser.parse(new InputStreamReader(jsonContent, UTF_8_CHAR_SET));
          if (element.isJsonObject()) {
            return element.getAsJsonObject();
          } else {
            throw new WorldBankException("Unknown content found in response." + element);
          }
        } catch (Exception e) {
            throw new WorldBankException(e);
        } finally {
          closeStream(jsonContent);
      }
  }
View Full Code Here

          }
         
          request.connect();
         
          if (request.getResponseCode() != expected) {
              throw new WorldBankException(convertStreamToString(getWrappedInputStream(request.getErrorStream(),
                        GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()))));
          } else {
              return getWrappedInputStream(request.getInputStream(),
                                           GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()));
          }
      } catch (IOException e) {
          throw new WorldBankException(e);
      }
  }
View Full Code Here

            out.close();

            request.connect();
           
            if (request.getResponseCode() != expected) {
              throw new WorldBankException(convertStreamToString(getWrappedInputStream(request.getErrorStream(),
                        GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()))));
            } else {
                return getWrappedInputStream(request.getInputStream(),
                        GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()));
            }
    } catch (IOException e) {
      throw new WorldBankException(e);
    } finally {
    }
  }
View Full Code Here

            request.setRequestMethod("DELETE");
           
          request.connect();
         
          if (request.getResponseCode() != expected) {
              throw new WorldBankException(convertStreamToString(getWrappedInputStream(request.getErrorStream(),
                        GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()))));
          } else {
              return getWrappedInputStream(request.getInputStream(),
                                           GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()));
          }
      } catch (IOException e) {
          throw new WorldBankException(e);
      }
  }
View Full Code Here

          }
 
          request.connect();
         
          if (request.getResponseCode() != expected) {
              throw new WorldBankException(convertStreamToString(getWrappedInputStream(request.getErrorStream(),
                        GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()))));
          } else {
              return getWrappedInputStream(request.getInputStream(),
                                           GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()));
          }
      } catch (IOException e) {
          throw new WorldBankException(e);
      }
  }
View Full Code Here

TOP

Related Classes of org.worldbank.api.services.WorldBankException

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.