edu.ucsb.cs.jicos.services.external.services
Class CollectorHttp

java.lang.Object
  extended by java.lang.Thread
      extended by edu.ucsb.cs.jicos.services.external.services.Collector
          extended by edu.ucsb.cs.jicos.services.external.services.CollectorHttp
All Implemented Interfaces:
java.lang.Runnable

public class CollectorHttp
extends Collector


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int DEFAULT_PORT
          Default port for the CollectorHttp.
static int DELAY
          Number of seconds to delay until the answer HTML page will refresh.
static java.lang.String PROPERTY_PortNumber
          System property that specifies the port number.
 
Fields inherited from class edu.ucsb.cs.jicos.services.external.services.Collector
host, hsp, port
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CollectorHttp()
          Default, no argument, constructor.
CollectorHttp(edu.ucsb.cs.jicos.services.ClientToHsp hsp)
          Construct a CollectorHttp associated with a particular HSP.
CollectorHttp(edu.ucsb.cs.jicos.services.ClientToHsp hsp, int port)
          Construct a CollectorHttp associated with a particular HSP on a particular port.
 
Method Summary
static java.lang.String createResponseSelect(java.lang.String[] respondOptions)
          Create HTML for the "respond by" box.
static java.lang.String htmlUnMangle(java.lang.String mangled)
          Unmangle a value from HTTP (translating all the %xx --> characters).
static java.lang.String jicosHtmlFooter()
          Create the traditional Jicos footer for a web page.
static java.lang.String jicosHtmlHeader()
          Create the traditional Jicos header for a dynamically created web page.
 void run()
          Start up this thread.
 java.lang.String toHtml(ExternalRequestId externalRequestId)
          Convert an external result identifier to HTML page that will allow the client browser to request the answer.
 java.lang.String unknownRequestId()
          Create a "requestid unknown" HTML page.
 
Methods inherited from class edu.ucsb.cs.jicos.services.external.services.Collector
getHost, getHostPort, getHsp, getPort, setHost, setHsp, setPort
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
Default port for the CollectorHttp.

See Also:
Constant Field Values

PROPERTY_PortNumber

public static final java.lang.String PROPERTY_PortNumber
System property that specifies the port number.

See Also:
Constant Field Values

DELAY

public static final int DELAY
Number of seconds to delay until the answer HTML page will refresh.

See Also:
Constant Field Values
Constructor Detail

CollectorHttp

public CollectorHttp()
Default, no argument, constructor.


CollectorHttp

public CollectorHttp(edu.ucsb.cs.jicos.services.ClientToHsp hsp)
Construct a CollectorHttp associated with a particular HSP.

Parameters:
hsp - The HSP

CollectorHttp

public CollectorHttp(edu.ucsb.cs.jicos.services.ClientToHsp hsp,
                     int port)
Construct a CollectorHttp associated with a particular HSP on a particular port.

Parameters:
hsp - The HSP
port - The port to bind to.
Method Detail

run

public void run()
Start up this thread.

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class Collector

toHtml

public java.lang.String toHtml(ExternalRequestId externalRequestId)
Convert an external result identifier to HTML page that will allow the client browser to request the answer.

Parameters:
externalRequestId - The external request id.
Returns:
The HTML encoded text.
Throws:
java.lang.NullPointerException - If argument is null.

unknownRequestId

public java.lang.String unknownRequestId()
Create a "requestid unknown" HTML page.

Returns:
HTML text.

htmlUnMangle

public static java.lang.String htmlUnMangle(java.lang.String mangled)
Unmangle a value from HTTP (translating all the %xx --> characters).

Parameters:
mangled - The Mangled string.
Returns:
The "unmangled" string.

createResponseSelect

public static java.lang.String createResponseSelect(java.lang.String[] respondOptions)
Create HTML for the "respond by" box.

Parameters:
respondOptions - An array of possible options.
Returns:
HTML text

jicosHtmlHeader

public static java.lang.String jicosHtmlHeader()
Create the traditional Jicos header for a dynamically created web page.

Returns:
HTML text.

jicosHtmlFooter

public static java.lang.String jicosHtmlFooter()
Create the traditional Jicos footer for a web page.

Returns:
HTML text.


Jicos: http://cs.ucsb.edu/projects/jicos