[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[McV #LQX-280027]: IOUtil.getInputStream request

> 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 
                URLConnection connection = url.openConnection();
                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?


Ticket Details
Ticket ID: LQX-280027
Department: Support McV
Priority: Normal
Status: Closed

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.