Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

using manager functions from within servlets - SOLVED

Dominic Parry

2003-06-04


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

Attachment: Base64.java
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.