org.apache.anteater.test
Class HttpClient

java.lang.Object
  |
  +--org.apache.anteater.test.HttpClient

public class HttpClient
extends Object

HTTP operations on raw sockets using HttpMessage. This class is used by HttpRequest to perform HTTP requests.

Since:
October 25, 2002
Version:
$Revision: 1.11 $ $Date: 2003/01/18 01:42:51 $
Author:
Jeff Turner

Field Summary
static int UNSET_TIMEOUT
           
 
Method Summary
static HttpMessage dispatch(HttpMessage request, org.apache.tools.ant.Project project, Session session, int timeout, Boolean useTidy, Boolean followRedirects, int maxRedirects, int debug)
          Send the request to the specified URL.
static Socket getSocket(HttpMessage request)
          Creates and returns a normal or SSL socket, depending on the HttpMessage.isSecure() flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNSET_TIMEOUT

public static final int UNSET_TIMEOUT
See Also:
Constant Field Values
Method Detail

dispatch

public static HttpMessage dispatch(HttpMessage request,
                                   org.apache.tools.ant.Project project,
                                   Session session,
                                   int timeout,
                                   Boolean useTidy,
                                   Boolean followRedirects,
                                   int maxRedirects,
                                   int debug)
                            throws Exception
Send the request to the specified URL. We use plain socket (instead of the more convenient URLConnection) because we want to check bad http, special strings, etc.

Parameters:
request - Request to send
project - Ant Project object used for variable interpolation
session - Session to update with returned cookies
timeout - How long to wait if the socket hangs
useTidy - Whether to use JTidy to make the body of the response well-formed.
followRedirects - whether or not to transparently follow 302 HTTP redirects.
maxRedirects - Max number of times to follow redirects
debug - debug level
Throws:
UnknownHostException - if offline
Exception - if the HTTP operation fails.

getSocket

public static Socket getSocket(HttpMessage request)
                        throws Exception
Creates and returns a normal or SSL socket, depending on the HttpMessage.isSecure() flag.

Exception


Ant Functional Tester -- see Project home page for details