[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[McV #LQX-280027]: IOUtil.getInputStream request
- Subject: [McV #LQX-280027]: IOUtil.getInputStream request
- Date: Wed, 25 Nov 2009 11:25:01 -0700
> I'm using IOUtil.getInputStream(String) to get the contents of a URL hosted
> at SSEC. This call falls through to IOUtil.getInputStream(String, Class)
> which captures HTTP response code 401, but not others. In my case, on a
> wireless network that redirects to a gateway, the response code is 302.
> Could you please add a check for other HTTP redirects (at least 301, 302,
> 303) and throw an exception? In this case the input stream that is returned
> is valid, but the content is not the resource you are expecting.
>
>
Hi Dave,
The problem is the URLConnection handles the redirects automatically. In the
code:
URLConnection connection = url.openConnection();
connection.setAllowUserInteraction(true);
if (connection instanceof HttpURLConnection) {
HttpURLConnection huc = (HttpURLConnection) connection;
//We never see a 301 here. All we see is the 200
if (huc.getResponseCode() == 401) {
...
Do you know a different approach?
-jeff
Ticket Details
===================
Ticket ID: LQX-280027
Department: Support McV
Priority: Normal
Status: Closed