You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dominic Parry <do...@rucus.ru.ac.za> on 2003/06/04 14:29:41 UTC
using manager functions from within servlets - SOLVED
Hi I managed to get this working:
try {
URL url = new URL("http://localhost/manager/reload?path=/HamiltonBank");
HttpURLConnection con = (HttpURLConnection)url.openConnection();
// Add the necessary Auth Header information
String input = "username" + ":" + "password";
String output = new String(Base64.encodeBytes(input.getBytes()));
con.setRequestProperty("Authorization", "Basic " + output);
// Get the page i.e. Execute the manager function
Object tempObj = con.getContent();
con.disconnect();
} catch (Exception e) {
out.write(e.toString()+"<br>");
}
basically it can be used to execute any manager function from a servlet. the Base64 class is attached.
Thank you for everyone who gave advice!
Dom