com.macromedia.net
Class HttpAgent

java.lang.Object
  extended bycom.macromedia.net.HttpAgent

public class HttpAgent
extends java.lang.Object

An HttpAgent is an object which knows how to collect up a bunch of requests and then make them all at once in a threaded nature.

In general you add requests to the agent, and then call processRequests() to get back the results


Constructor Summary
HttpAgent()
          Construct an HttpAgent object with some defaults: 5 threads and no requests
 
Method Summary
 void addRequest(HttpAgentRequest req)
          Add a request to the list to process
 ResponseHandler getResponseHandler()
          Get the current request handler that is attached to this agent.
 int getTimeout()
           
 java.util.Map processRequests()
          Process the list of requests in a threaded nature.
 void setResponseHandler(ResponseHandler handler)
          Set a request handler that will get invoked whenever we are done processing a request.
 void setThreadCount(int threadCount)
          Set the new thread count.
 void setTimeout(int timeout)
          Number of seconds this connection can be in progress before it is killed
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpAgent

public HttpAgent()
Construct an HttpAgent object with some defaults: 5 threads and no requests

Method Detail

addRequest

public void addRequest(HttpAgentRequest req)
Add a request to the list to process

Parameters:
req - is the request to add

setThreadCount

public void setThreadCount(int threadCount)
Set the new thread count.

Parameters:
threadCount - is the number of threads that will process our result

getResponseHandler

public ResponseHandler getResponseHandler()
Get the current request handler that is attached to this agent.

Returns:
our request handler or null if none is attached

setResponseHandler

public void setResponseHandler(ResponseHandler handler)
Set a request handler that will get invoked whenever we are done processing a request.

Parameters:
handler - is the handler to set. or null if we want to not have a handler

processRequests

public java.util.Map processRequests()
                              throws java.lang.Exception
Process the list of requests in a threaded nature. You'll get back the list responses that correspond to your requests.

Returns:
a map of: key/Response objects, where key is the key defined in the request.
Throws:
java.lang.Exception

setTimeout

public void setTimeout(int timeout)
Number of seconds this connection can be in progress before it is killed

Parameters:
timeout - is the new timeout in seconds, or -1 for no timeout

getTimeout

public int getTimeout()