net.spy.net
Class HTTPFetch

java.lang.Object
  extended by net.spy.net.HTTPFetch

public class HTTPFetch
extends java.lang.Object

Oversimplified HTTP document fetcher.


Constructor Summary
HTTPFetch(java.net.URL u)
          Get an HTTPFetch instance for the given URL.
HTTPFetch(java.net.URL u, java.util.Map head)
          Get an HTTPFetch instance for the given URL and headers.
 
Method Summary
 java.lang.String getData()
          Return the contents of the URL as a whole string.
 long getLastModified()
          Get the last modified date of this response.
 java.util.List getLines()
          Get a vector containing the individual lines of the document returned from the URL.
 java.util.Map getResponseHeaders()
          Get the response headers from the request (will force a content fetch).
 int getStatus()
          Get the HTTP status from this request.
 java.lang.String getStrippedData()
          Return the contents of the URL with the HTML tags stripped out.
 void setIfModifiedSince(long to)
          Set the ifModifiedSince value for the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPFetch

public HTTPFetch(java.net.URL u)
Get an HTTPFetch instance for the given URL.

Parameters:
u - the URL to fetch

HTTPFetch

public HTTPFetch(java.net.URL u,
                 java.util.Map head)
Get an HTTPFetch instance for the given URL and headers.

Parameters:
u - URL to fetch
head - Map containing the headers to fetch
Method Detail

getResponseHeaders

public java.util.Map getResponseHeaders()
                                 throws java.io.IOException
Get the response headers from the request (will force a content fetch).

Throws:
java.io.IOException

setIfModifiedSince

public void setIfModifiedSince(long to)
Set the ifModifiedSince value for the request.


getStatus

public int getStatus()
              throws java.io.IOException
Get the HTTP status from this request.

Throws:
java.io.IOException

getLastModified

public long getLastModified()
                     throws java.io.IOException
Get the last modified date of this response.

Throws:
java.io.IOException

getLines

public java.util.List getLines()
                        throws java.io.IOException
Get a vector containing the individual lines of the document returned from the URL.

Throws:
java.lang.Exception - thrown when something fails.
java.io.IOException

getData

public java.lang.String getData()
                         throws java.io.IOException
Return the contents of the URL as a whole string.

Returns:
the contents from the URL as a String
Throws:
java.io.IOException - if there is a problem accessing the URL

getStrippedData

public java.lang.String getStrippedData()
                                 throws java.lang.Exception
Return the contents of the URL with the HTML tags stripped out.

Throws:
java.lang.Exception - thrown when something fails.


Copyright © 1995-2005 SPY Internetworking. All Rights Reserved.