Package org.syncany.config.to

Examples of org.syncany.config.to.PortTO


   
    UserTO cliUser = new UserTO();
    cliUser.setUsername("CLI");
    cliUser.setPassword(accessToken);
   
    PortTO portTO = new PortTO();
    portTO.setPort(port);
    portTO.setUser(cliUser);
    return portTO;
  }
View Full Code Here


       
        UserTO cliUser = new UserTO();
        cliUser.setUsername(UserConfig.USER_CLI);
        cliUser.setPassword(accessToken);
       
        portTO = new PortTO();
       
        portTO.setPort(daemonConfig.getWebServer().getBindPort());
        portTO.setUser(cliUser);
       
        daemonConfig.setPortTO(portTO);
View Full Code Here

  }

  private int sendToRest(Command command, String commandName, String[] commandArgs, File portFile) {
    try {
      // Read port config (for daemon) from port file
      PortTO portConfig = readPortConfig(portFile);

      // Create authentication details
      CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
      credentialsProvider.setCredentials(
          new AuthScope(SERVER_HOSTNAME, portConfig.getPort()),
          new UsernamePasswordCredentials(portConfig.getUser().getUsername(), portConfig.getUser().getPassword()));

      // Allow all hostnames in CN; this is okay as long as hostname is localhost/127.0.0.1!
      // See: https://github.com/syncany/syncany/pull/196#issuecomment-52197017
      X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();

      // Fetch the SSL context (using the user key/trust store)
      SSLContext sslContext = UserConfig.createUserSSLContext();

      // Create client with authentication details
      CloseableHttpClient client = HttpClients
          .custom()
          .setSslcontext(sslContext)
          .setHostnameVerifier(hostnameVerifier)
          .setDefaultCredentialsProvider(credentialsProvider)
          .build();

      // Build and send request, print response
      Request request = buildFolderRequestFromCommand(command, commandName, commandArgs, config.getLocalDir().getAbsolutePath());
      String serverUri = SERVER_SCHEMA + SERVER_HOSTNAME + ":" + portConfig.getPort() + SERVER_REST_API;

      String xmlMessageString = MessageFactory.toXml(request);
      StringEntity xmlMessageEntity = new StringEntity(xmlMessageString);

      HttpPost httpPost = new HttpPost(serverUri);
View Full Code Here

TOP

Related Classes of org.syncany.config.to.PortTO

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.