Java Mailing List Archive

http://www.junlu.com/

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

Manager app and HttpURLConnection

Dominic Parry

2003-06-02

Replies:

Hi

I'm trying to do this:

try {
     URL url = new URL("http://localhost/manager/reload?path=/DynaServlet");
 HttpURLConnection con = (HttpURLConnection)url.openConnection();
 BufferedReader in = new BufferedReader(
                    new InputStreamReader(
                    con.getInputStream()));
     String inputLine;
       while ((inputLine = in.readLine()) != null)
        out.write(inputLine + "<br>");
     in.close();
} catch (Exception e) {
 out.write(e.toString()+"<br>");
}

from an HttpServlet. I'm getting:

java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost/manager/reload?path=/DynaServlet

even when I change the URL to something like http://user:pass@(protected).

Any ideas why?

Thanks

Dom
©2008 junlu.com - Jax Systems, LLC, U.S.A.