/[classpath]/inetlib/source/gnu/inet/gopher/GopherContentHandler.java
ViewVC logotype

Diff of /inetlib/source/gnu/inet/gopher/GopherContentHandler.java

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

revision 1.1 by dog, Sun Oct 19 15:40:03 2003 UTC revision 1.2 by dog, Sun Oct 19 16:16:50 2003 UTC
# Line 28  Line 28 
28  package gnu.inet.gopher;  package gnu.inet.gopher;
29    
30  import java.io.IOException;  import java.io.IOException;
31    import java.net.ContentHandler;
32  import java.net.UnknownServiceException;  import java.net.UnknownServiceException;
33  import java.net.URL;  import java.net.URL;
34  import java.net.URLConnection;  import java.net.URLConnection;
# Line 39  import java.net.URLConnection; Line 40  import java.net.URLConnection;
40   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
41   * @version $Revision$ $Date$   * @version $Revision$ $Date$
42   */   */
43  public class GopherURLStreamHandler extends URLStreamHandler  public class GopherContentHandler extends ContentHandler
44  {  {
45    
46          public Object getContent(URLConnection urlc)    public Object getContent(URLConnection urlc) throws IOException
47                  throws IOException    {
48          {      if (urlc instanceof GopherURLConnection)
49                  if (urlc instanceof GopherURLConnection)      {
50                  {        GopherURLConnection gurlc = (GopherURLConnection) urlc;
51                          GopherURLConnection gurlc = (GopherURLConnection)urlc;        GopherConnection connection = gurlc.connection;
52                          GopherConnection connection = gurlc.connection;        URL url = gurlc.getURL();
53                          URL url = gurlc.getURL();        String dir = url.getPath();
54                          String dir = url.getPath();        String filename = url.getPath();
55                          String filename = url.getPath();        if (dir == null && filename == null)
56                          if (dir==null && filename==null)          return connection.list();
57                                  return connection.list();        else
58                          else            return gurlc.getInputStream();
59                                  return gurlc.getInputStream();      }
60                  }      else
61                  else          throw new UnknownServiceException();
62                          throw new UnknownServiceException();    }
         }  
63    
64  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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