/[classpath]/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
ViewVC logotype

Diff of /classpath/gnu/java/net/protocol/http/HTTPURLConnection.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5.2.2 by gnu_andrew, Sun Mar 13 14:38:31 2005 UTC revision 1.5.2.3 by gnu_andrew, Thu Apr 28 23:00:11 2005 UTC
# Line 40  package gnu.java.net.protocol.http; Line 40  package gnu.java.net.protocol.http;
40    
41  import java.io.ByteArrayInputStream;  import java.io.ByteArrayInputStream;
42  import java.io.ByteArrayOutputStream;  import java.io.ByteArrayOutputStream;
43    import java.io.FileNotFoundException;
44  import java.io.IOException;  import java.io.IOException;
45  import java.io.InputStream;  import java.io.InputStream;
46  import java.io.OutputStream;  import java.io.OutputStream;
# Line 94  public class HTTPURLConnection Line 95  public class HTTPURLConnection
95    
96    private Response response;    private Response response;
97    private ByteArrayInputStream responseSink;    private ByteArrayInputStream responseSink;
98      private ByteArrayInputStream errorSink;
99    
100    private HandshakeCompletedEvent handshakeEvent;    private HandshakeCompletedEvent handshakeEvent;
101    
# Line 281  public class HTTPURLConnection Line 283  public class HTTPURLConnection
283                  file = location.substring(end);                  file = location.substring(end);
284                  retry = true;                  retry = true;
285                }                }
286              // Otherwise this is not an HTTP redirect, can't follow              else if (location.length() > 0)
287                  {
288                    // Malformed absolute URI, treat as file part of URI
289                    if (location.charAt(0) == '/')
290                      {
291                        // Absolute path
292                        file = location;
293                      }
294                    else
295                      {
296                        // Relative path
297                        int lsi = file.lastIndexOf('/');
298                        file = (lsi == -1) ? "/" : file.substring(0, lsi + 1);
299                        file += location;
300                      }
301                    retry = true;
302                  }
303            }            }
304          else          else
305            {            {
306              responseSink = new ByteArrayInputStream(reader.toByteArray ());              responseSink = new ByteArrayInputStream(reader.toByteArray ());
307                if (response.getCode() == 404)
308                  {
309                    errorSink = responseSink;
310                    throw new FileNotFoundException(url.toString());
311                  }
312            }            }
313        }        }
314      while (retry);      while (retry);
# Line 455  public class HTTPURLConnection Line 478  public class HTTPURLConnection
478      return responseSink;      return responseSink;
479    }    }
480    
481      public InputStream getErrorStream()
482      {
483        return errorSink;
484      }
485    
486    public Map getHeaderFields()    public Map getHeaderFields()
487    {    {
488      if (!connected)      if (!connected)

Legend:
Removed from v.1.5.2.2  
changed lines
  Added in v.1.5.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26