Package org.apache.thrift.transport

Examples of org.apache.thrift.transport.THttpClient$Factory


      }

      TTransport transport;

      if (url != null) {
        transport = new THttpClient(url);
      } else {
        TSocket socket = new TSocket(host, port);
        socket.setTimeout(socketTimeout);
        transport = socket;
        if (framed) {
View Full Code Here


        "://" + host + ":" + port + httpPath;
    httpClient.addRequestInterceptor(
        new HttpBasicAuthInterceptor(getUserName(), getPasswd())
        );
    try {
      transport = new THttpClient(httpUrl, httpClient);
    }
    catch (TTransportException e) {
      String msg =  "Could not create http connection to " +
          jdbcURI + ". " + e.getMessage();
      throw new SQLException(msg, " 08S01", e);
View Full Code Here

      }

      TTransport transport;

      if (url != null) {
        transport = new THttpClient(url);
      } else {
        TSocket socket = new TSocket(host, port);
        socket.setTimeout(socketTimeout);
        transport = socket;
        if (framed) {
View Full Code Here

 
 
     // Connect to Evernote
    public boolean enConnect()  {
      try {
      userStoreTrans = new THttpClient(userStoreUrl);
      userStoreTrans.setCustomHeader("User-Agent", userAgent);
    } catch (TTransportException e) {
      QMessageBox mb = new QMessageBox(QMessageBox.Icon.Critical, "Transport Excepton", e.getLocalizedMessage());
      mb.exec();
      e.printStackTrace();
    }
    userStoreProt = new TBinaryProtocol(userStoreTrans);
      userStore = new UserStore.Client(userStoreProt, userStoreProt);
      syncSignal.saveUserStore.emit(userStore);
      try {
      //authResult = userStore.authenticate(username, password, consumerKey, consumerSecret);
        user = userStore.getUser(authToken);
    } catch (EDAMUserException e) {
      QMessageBox mb = new QMessageBox(QMessageBox.Icon.Critical, "Error", "Invalid Authorization");
      mb.exec();
      isConnected = false;
      return false;
    } catch (EDAMSystemException e) {
      QMessageBox mb = new QMessageBox(QMessageBox.Icon.Critical, "EDAM System Excepton", e.getLocalizedMessage());
      mb.exec();
      e.printStackTrace();
      isConnected = false;
    } catch (TException e) {
      QMessageBox mb = new QMessageBox(QMessageBox.Icon.Critical, "Transport Excepton", e.getLocalizedMessage());
      mb.exec();
      e.printStackTrace();
      isConnected = false;
    }
   
      boolean versionOk = false;
    try {
      versionOk = userStore.checkVersion("NixNote",
              com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR,
                com.evernote.edam.userstore.Constants.EDAM_VERSION_MINOR);
    } catch (TException e) {
      e.printStackTrace();
      isConnected = false;
    }
      if (!versionOk) {
          System.err.println("Incomatible EDAM client protocol version");
          isConnected = false;
      }
      //if (authResult != null) {
        //user = authResult.getUser();
        //authToken = authResult.getAuthenticationToken();
      if (user == null || noteStoreUrlBase == null) {
        logger.log(logger.LOW, "Error retrieving user information.  Aborting.");
        System.err.println("Error retrieving user information.");
        isConnected = false
      QMessageBox mb = new QMessageBox(QMessageBox.Icon.Critical, tr("Connection Error"), tr("Error retrieving user information.  Synchronization not complete"));
      mb.exec();
      return false;
       
      }
        noteStoreUrl = noteStoreUrlBase + user.getShardId();
        syncSignal.saveAuthToken.emit(authToken);
        syncSignal.saveNoteStore.emit(localNoteStore);
       
  
        try {
          noteStoreTrans = new THttpClient(noteStoreUrl);
          noteStoreTrans.setCustomHeader("User-Agent", userAgent);
        } catch (TTransportException e) {
          QMessageBox mb = new QMessageBox(QMessageBox.Icon.Critical, "Transport Excepton", e.getLocalizedMessage());
          mb.exec();
          e.printStackTrace();
View Full Code Here

           logger.log(logger.EXTREME, "Last Sequence Number on file: " +lastSequenceNumber);
          
           // Authenticate to the owner's shard
           String linkedNoteStoreUrl   = noteStoreUrlBase + books.get(i).getShardId();
           logger.log(logger.EXTREME, "linkedNoteStoreURL: " +linkedNoteStoreUrl);
           THttpClient linkedNoteStoreTrans   = new THttpClient(linkedNoteStoreUrl);
           TBinaryProtocol linkedNoteStoreProt   = new TBinaryProtocol(linkedNoteStoreTrans);
           Client linkedNoteStore = new NoteStore.Client(linkedNoteStoreProt, linkedNoteStoreProt);    

           linkedAuthResult = null;
           if (books.get(i).getShareKey() != null) {
View Full Code Here

      currentCollectorInfo = CollectorRegistry.getInstance().getCollector();
      if (currentCollectorInfo == null) {
        throw new CommunicationException("collector is null");
      }
      httpClient = new THttpClient(currentCollectorInfo.getHost() + ":" + currentCollectorInfo.getPort());
     
      httpClient.setConnectTimeout(SENDER_TIMEOUT);
      protocol = new TBinaryProtocol(httpClient);
      collector = new HonuCollector.Client(protocol);
      int status = collector.getStatus();
View Full Code Here

    DefaultHttpClient httpClient = new DefaultHttpClient();
    String httpUrl = transportMode + "://" + host + ":" + port +
        "/" + thriftHttpPath + "/";
    httpClient.addRequestInterceptor(
        new HttpBasicAuthInterceptor(USERNAME, PASSWORD));
    return new THttpClient(httpUrl, httpClient);
  }
View Full Code Here

    DefaultHttpClient httpClient;
    boolean useSsl = isSslConnection();
    // Create an http client from the configs
    httpClient = getHttpClient(useSsl);
    try {
      transport = new THttpClient(getServerHttpUrl(useSsl), httpClient);
      // We'll call an open/close here to send a test HTTP message to the server. Any
      // TTransportException caused by trying to connect to a non-available peer are thrown here.
      // Bubbling them up the call hierarchy so that a retry can happen in openTransport,
      // if dynamic service discovery is configured.
      TCLIService.Iface client = new TCLIService.Client(new TBinaryProtocol(transport));
View Full Code Here

          jdbcURI + ". " + e.getMessage();
      throw new SQLException(msg, " 08S01", e);
    }

    try {
      transport = new THttpClient(getServerHttpUrl(useSsl), httpClient);
    }
    catch (TTransportException e) {
      String msg =  "Could not create http connection to " +
          jdbcURI + ". " + e.getMessage();
      throw new SQLException(msg, " 08S01", e);
View Full Code Here

    TTransport transport = null;

    try {
      if (transport_type.equals("http")) {
        String url = "http://" + host + ":" + port + "/service";
        transport = new THttpClient(url);
      } else {
        TSocket socket = null;
        if (ssl == true) {
          socket = TSSLTransportFactory.getClientSocket(host, port, 0);
        } else {
View Full Code Here

TOP

Related Classes of org.apache.thrift.transport.THttpClient$Factory

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.