On Thu, 25 Oct 2001, Yoav Shapira wrote:

> Date: Thu, 25 Oct 2001 09:33:15 -0400
> From: Yoav Shapira <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: Can't open InputStream to manager??
>
> Hi there,
>
> I have a servlet that tries to do something like:
>
> URL url = new
> URL("http://manageruser:[EMAIL PROTECTED]:myport/manager/list";);
> URLConnection con = url.openConnection();

Try adding:

  con.setDoInput(true);
  con.connect();

here.

> BufferedReader bin = new BufferedReader(new
> InputStreamReader(con.getInputStream);
>
> The third line throws an exception.  The connection itself is fine,
> I can call stuff like con.getContentLength() and it works (correctly)
> without a problem.
>
> Is the manager app coded specifically to disallow opening stream to it?
> Has anyone else tried/encountered something like this?

There's nothing special in Manager that would do this (although you're
going to have to include an appropriate "Authorization" header in your
request to bypass the 401 response asking for BASIC authentication).  It's
more likely to be related to the order of calls on your URLConnection --
see the javadocs for java.net.URLConnection (and the Networking Trail in
the online tutorial at <http://java.sun.com/docs/books/tutorial>) for more
information on this.

>
> Thanks!
>
> Yoav Shapira
> Millennium Pharmaceuticals
>

Craig


Reply via email to