Class com.micronova.util.HTTPPacketListener
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class com.micronova.util.HTTPPacketListener
java.lang.Object
   |
   +----com.micronova.util.HTTPPacketListener
  -  public class HTTPPacketListener
  
-  extends Object
  
-  implements Runnable
   
HTTPPacketListener is a thread Runnable for listening to an HTTP
   connection for incoming stream of Codables.  When run, it first
   makes a connection to the given url, and sends the given parameter.
   Then whenever a Codable is received or an exception occurs, it
   asynchronously posts a message addressed to the given target
   in the application's queue.
   
   
   The target's performCommand(command, object) is called as follows:
   
   - 
   for a received data, command = HTTPPacketListener.DATA, object = the received Codable;
   
 - 
   for an exception, command = HTTPPacketListener.EXCEPTION, object = the Exception object.
   
 
  -  Version:
  
 -  1.0
  
 -  Author:
  
 -  Makoto Nagata, MicroNova
 
  
  -  
	application
   -  Application that provides a message queue.
  
 -  
	DATA
   -  command sent when a packet is received.
  
 -  
	EXCEPTION
   -  command sent when an exception occurs.
  
 -  
	isRunning
   -  set to false to abort listening.
  
 -  
	parameter
   -  Codable parameter to be sent to the URL before listening starts.
  
 -  
	target
   -  Target that receives messages.
  
 -  
	url
   -  URL to listen to.
 
  
  -  
	HTTPPacketListener(URL, Codable, Application, Target)
   -  
       
Constructs an HTTPPacketListener.
 
  
  -  
	abort()
   -  
       Aborts listening.
  
 -  
	run()
   -  
 
  
application
  protected Application application
  -  Application that provides a message queue.
 
target
  protected Target target
  -  Target that receives messages.
 
url
  protected URL url
  -  URL to listen to.
 
parameter
  protected Codable parameter
  -  Codable parameter to be sent to the URL before listening starts.
 
isRunning
  protected boolean isRunning
  -  set to false to abort listening.
 
DATA
  public final static String DATA
  -  command sent when a packet is received.
 
EXCEPTION
  public final static String EXCEPTION
  -  command sent when an exception occurs.
 
  
HTTPPacketListener
  public HTTPPacketListener(URL url,
                            Codable parameter,
                            Application application,
                            Target target)
  -  
Constructs an HTTPPacketListener.
       
       
  
    -  Parameters:
    
 -  url - a URL to listen to
    
-  parameter - a Codable that is sent to the URL before listening starts (can be null)
    
-  application - an Application that supplies a message queue
    
-  target - a Target that receives messages
  
    
 
  
run
  public void run()
abort
  public void abort()
  -  Aborts listening.  The thread will exit.
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index