예제 #1
0
  /**
   * @param url
   * @param username
   * @param password
   * @param args
   */
  public static void RpcExample(String url, String username, char[] password) throws Exception {

    // Establish a session with the remote server
    RemoteSession remoteSession = new RemoteSession(url, username, password);

    // OK: call the add(int a, int b) remote method that returns a + b:
    String result = remoteSession.call("org.kawanfw.examples.Calculator.add", 33, 44);
    System.out.println("Calculator Result: " + result);
  }
예제 #2
0
  /** @param args */
  public static void uploadExample() throws Exception {

    // Define URL of the path to the ServerFileManager servlet
    String url = "https://www.acme.org/ServerFileManager";

    // The login info for strong authentication on server side:
    String username = "******";
    char[] password = {'m', 'y', 'P', 'a', 's', 's', 'w', 'o', 'r', 'd'};

    // Establish a session with the remote server
    RemoteSession remoteSession = new RemoteSession(url, username, password);

    // OK: upload a file
    remoteSession.upload(new File("c:\\myFile.txt"), "/home/mylogin/myFile.txt");
  }
예제 #3
0
  /**
   * @throws MalformedURLException
   * @throws UnknownHostException
   * @throws ConnectException
   * @throws SocketException
   * @throws InvalidLoginException
   * @throws RemoteException
   * @throws IOException
   * @throws SecurityException
   * @throws IllegalArgumentException
   * @throws FileNotFoundException
   */
  public static void uploadFileVersion1()
      throws MalformedURLException, UnknownHostException, ConnectException, SocketException,
          InvalidLoginException, RemoteException, IOException, SecurityException,
          IllegalArgumentException, FileNotFoundException {

    // Define URL of the path to the ServerFileManager servlet
    String url = "https://www.acme.org/ServerFileManager";

    // The login info for strong authentication on server side:
    String username = "******";
    char[] password = {'m', 'y', 'P', 'a', 's', 's', 'w', 'o', 'r', 'd'};

    // Establish a session with the remote server
    RemoteSession remoteSession = new RemoteSession(url, username, password);

    // Upload a file using built-in RemoteSession.upload()
    File file = new File("C:\\Users\\Mike\\Koala.jpg");
    String remotePath = "/Koala.jpg";

    remoteSession.upload(file, remotePath);
  }