org.xfp.filters
Class HTTPGet

java.lang.Object
  extended byorg.xfp.AttributeContainer
      extended byorg.xfp.Filter
          extended byorg.xfp.filters.HTTPGet

public class HTTPGet
extends Filter

Performs an HTTP request. Note that the output of this filter can be used only once, being it an InputStream.

Version:
$Id: HTTPGet.java,v 1.1 2004/03/19 15:56:47 flaviotordini Exp $
Author:
Flavio Tordini

Nested Class Summary
 
Nested classes inherited from class org.xfp.Filter
Filter.OnErrorEnum, Filter.OnLoopErrorEnum
 
Field Summary
 
Fields inherited from class org.xfp.AttributeContainer
name, parentContainer
 
Constructor Summary
HTTPGet()
           
 
Method Summary
 java.io.InputStream execute()
          Executes this filter.
 java.io.InputStream execute(java.lang.String url)
          Executes this filter.
 java.io.InputStream execute(java.net.URL source)
          Executes this filter.
 void reset()
          Resets filter status after execution.
 void setFollowRedirects(boolean followRedirects)
          Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed.
 void setIfModified(boolean ifModified)
          Sets the ifModified.
 void setMethod(java.lang.String method)
          Sets the request method.
 void setPassword(java.lang.String password)
          Sets the password for the basic authentication.
 void setUrl(java.lang.String url)
          Sets the URL to get.
 void setUseragent(java.lang.String useragent)
          Sets the User-Agent request header.
 void setUsername(java.lang.String user)
          Sets the username for the basic authentication.
 
Methods inherited from class org.xfp.Filter
getOnError, initialize, log, newInstance, perform, toString
 
Methods inherited from class org.xfp.AttributeContainer
configureAttributes, disposeAttributes, getAttributes, getFullName, getName, initializeAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HTTPGet

public HTTPGet()
Method Detail

setUrl

public void setUrl(java.lang.String url)
Sets the URL to get.


execute

public java.io.InputStream execute()
                            throws java.lang.Exception
Executes this filter.

Throws:
java.lang.Exception

execute

public java.io.InputStream execute(java.lang.String url)
                            throws java.lang.Exception
Executes this filter.

Throws:
java.lang.Exception

execute

public java.io.InputStream execute(java.net.URL source)
                            throws java.lang.Exception
Executes this filter.

Throws:
java.lang.Exception

reset

public void reset()
Description copied from class: Filter
Resets filter status after execution. This method is called after execute(), even in case of exceptions. Since a Filter instance may be reused (and actually is), you must use this method to reset all your class members to their default value.

Specified by:
reset in class Filter
See Also:
Filter.reset()

setIfModified

public void setIfModified(boolean ifModified)
Sets the ifModified. If the timestamp is same of the previous filter execution null is returned causing descendant filters to be skipped. Default is false.

Parameters:
ifModified - The ifModified to set

setMethod

public void setMethod(java.lang.String method)
Sets the request method. Can be GET or POST. Default is GET.

See Also:
HttpURLConnection.setRequestMethod(java.lang.String)

setFollowRedirects

public void setFollowRedirects(boolean followRedirects)
Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed. Defaults to true.

Parameters:
followRedirects - a boolean indicating whether or not to follow HTTP redirects.

setPassword

public void setPassword(java.lang.String password)
Sets the password for the basic authentication.

Parameters:
password - The password to set

setUsername

public void setUsername(java.lang.String user)
Sets the username for the basic authentication.

Parameters:
user - The username to set

setUseragent

public void setUseragent(java.lang.String useragent)
Sets the User-Agent request header. Use this header to simulate requests from different user agents (i.e. browsers).

Parameters:
useragent - The User-Agent value


Copyright © 2003-2004 XFP Team. All Rights Reserved.