Package com.apitrary.api.exception

Examples of com.apitrary.api.exception.ApiTransportException


   * @return a {@link com.apitrary.api.transport.Transport} object.
   */
  public Transport newTransport(ApitraryApi apitraryApi) {
    List<Class<Transport>> knownTransports = getAvailableTransports();
    if (knownTransports.isEmpty()) {
      throw new ApiTransportException("No transport provider available. Is there one on the classpath?");
    }
    return newTransport(apitraryApi, knownTransports.get(knownTransports.size() - 1));
  }
View Full Code Here


    try {
      Transport transport = transportClazz.newInstance();
      transport.setApitraryApi(apitraryApi);
      return transport;
    } catch (IllegalAccessException e) {
      throw new ApiTransportException(e);
    } catch (InstantiationException e) {
      throw new ApiTransportException(e);
    }
  }
View Full Code Here

    try {
      registerTransport((Class<Transport>)Class.forName(transportClazz));
    } catch (ClassNotFoundException e) {
      return;
    } catch(ClassCastException cce){
      throw new ApiTransportException(cce);
    }
  }
View Full Code Here

      this.statusCode = cxfResponse.getStatus();
     
      content = IOUtils.toString((InputStream)cxfResponse.getEntity());
      this.result = content;
    } catch (IOException e) {
      throw new ApiTransportException(e);
    }
    log.debug(this);
  }
View Full Code Here

          wr.close();
        }

        return new JavaNetClientTransportResult(httpConnection);
      } else {
        throw new ApiTransportException("Connection is not an HTTPConnection");
      }
    } catch (IOException ioe) {
      throw new ApiTransportException(ioe);
    }
  }
View Full Code Here

    } catch (IOException e) {
      if(statusCode == 500){
        try {
          content = IOUtils.toString(httpConnection.getErrorStream());
        } catch (IOException e1) {
          throw new ApiTransportException(e1);
        }
        this.result = content;
      }else{
        throw new ApiTransportException(e);
      }
    } finally {
      httpConnection.disconnect();
    }
    log.debug(this);
View Full Code Here

    try {
      HttpResponse response = client.execute(request);
      return new HttpClientTransportResult(response);
    } catch (Throwable t) {
      throw new ApiTransportException(t);
    }
  }
View Full Code Here

    try {
      request.setEntity(new StringEntity(payload));
      HttpResponse response = client.execute(request);
      return new HttpClientTransportResult(response);
    } catch (Throwable t) {
      throw new ApiTransportException(t);
    }
  }
View Full Code Here

      request.setEntity(new StringEntity(payload));

      HttpResponse response = client.execute(request);
      return new HttpClientTransportResult(response);
    } catch (Throwable t) {
      throw new ApiTransportException(t);
    }
  }
View Full Code Here

    try {
      HttpResponse response = client.execute(request);

      return new HttpClientTransportResult(response);
    } catch (Throwable t) {
      throw new ApiTransportException(t);
    }
  }
View Full Code Here

TOP

Related Classes of com.apitrary.api.exception.ApiTransportException

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.