Using the HttpSsh class

Top  Previous  Next

The HttpSsh class is a subclass of the com.jscape.inet.http.Http class.  It provides access to all the same features as the Http class with the exception that all data is securely tunneled thru an SSH server.  To use the HttpSsh class create a new HttpSsh instance providing a com.jscape.inet.ssh.util.SshParameters instance as an argument to the constructor.  See the JavaDoc reference for details on using the SshParameters class.

 

Example

 

// create SSH connection parameters

SshParameters sshParams = new SshParameters(sshHostname,sshUsername,sshPassword);

 

// create new HttpSsh instance

HttpSsh http = new HttpSsh(sshParams);

 

// build HTTP request

HttpRequest request = new HttpRequest("http://www.myserver.com");

 

// get HTTP response

try

{

 HttpResponse response = http.getResponse(request);

 System.out.println(new String(response.getBody()));

}

catch(Exception e)

{

 System.out.println(e);

}

 

See also

 

Http class overview

 

 

 





Home | Company | Products | Solutions | Purchase | Support | Services | Blog

© 2021 JSCAPE LLC