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:
Version:
1.0
Author:
Makoto Nagata, MicroNova

Variable Index

 o application
Application that provides a message queue.
 o DATA
command sent when a packet is received.
 o EXCEPTION
command sent when an exception occurs.
 o isRunning
set to false to abort listening.
 o parameter
Codable parameter to be sent to the URL before listening starts.
 o target
Target that receives messages.
 o url
URL to listen to.

Constructor Index

 o HTTPPacketListener(URL, Codable, Application, Target)

Constructs an HTTPPacketListener.

Method Index

 o abort()
Aborts listening.
 o run()

Variables

 o application
  protected Application application
Application that provides a message queue.
 o target
  protected Target target
Target that receives messages.
 o url
  protected URL url
URL to listen to.
 o parameter
  protected Codable parameter
Codable parameter to be sent to the URL before listening starts.
 o isRunning
  protected boolean isRunning
set to false to abort listening.
 o DATA
  public final static String DATA
command sent when a packet is received.
 o EXCEPTION
  public final static String EXCEPTION
command sent when an exception occurs.

Constructors

 o 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

Methods

 o run
  public void run()
 o abort
  public void abort()
Aborts listening. The thread will exit.

All Packages  Class Hierarchy  This Package  Previous  Next  Index