org.licas.server

## Class HttpListener

- java.lang.Object
- - java.lang.Thread
  - - org.licas.module.LicasModule
    - - org.licas.module.FrameworkModule
      - - org.licas.module.ServiceModule
        - - org.licas.server.HttpListener

- All Implemented Interfaces:
    java.lang.Runnable, ServiceDef
  Direct Known Subclasses:
    BlockingListener, NonBlockingListener

      public abstract class HttpListener
      extends ServiceModule

  Base class for a listener thread for processing HTTP requests.
  Author:
    Kieran Greer

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `ipAddress` The IP Address to bond to
    `protected java.util.concurrent.ExecutorService` | `listenerPool` Thread pool
    `protected int` | `port` The port to listen on
    `protected long` | `timeOut` Timeout for receiving continuous message

    - ### Fields inherited from class org.licas.module.ServiceModule

      `shutDown`

    - ### Fields inherited from class org.licas.module.FrameworkModule

      `passwordHandler, service, serviceType`

    - ### Fields inherited from class org.licas.module.LicasModule

      `jarFile, syncOn, uuid`

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpListener(int thePort, java.lang.String theIpAddress, long theTimeOut, java.lang.String theServerPassword, java.lang.String theAdminKey)` Create a new instance of HttpListener.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `closeListener()` Close the listener down
    `abstract void` | `initRequestListener()` Initialise the request listener thread.
    `void` | `shutDownListenerThread()` Shut down the request listener thread.

    - ### Methods inherited from class org.licas.module.ServiceModule

      `getShutDown, interrupt, setShutDown, setShutDown`

    - ### Methods inherited from class org.licas.module.FrameworkModule

      `canAccess, canAccessTemp, getPasswordHandler, getPasswordHandler, getServerPassword, getServicePassword, getServiceType, isAdminKey, setServiceDetails, setServiceType`

    - ### Methods inherited from class org.licas.module.LicasModule

      `getJarFile, getUUID, loadObject, setJarFile, setUUID, threadAliveState`

    - ### Methods inherited from class java.lang.Thread

      `activeCount, checkAccess, clone, 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, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.licas.def.ServiceDef

      `getUUID, setJarFile, setUUID`

- - ### Field Detail

    - #### port

          protected int port

      The port to listen on

    - #### ipAddress

          protected java.lang.String ipAddress

      The IP Address to bond to

    - #### timeOut

          protected long timeOut

      Timeout for receiving continuous message

    - #### listenerPool

          protected java.util.concurrent.ExecutorService listenerPool

      Thread pool

  - ### Constructor Detail

    - #### HttpListener

          public HttpListener(int thePort,
                              java.lang.String theIpAddress,
                              long theTimeOut,
                              java.lang.String theServerPassword,
                              java.lang.String theAdminKey)
                       throws java.lang.Exception

      Create a new instance of HttpListener.
      Parameters:
        `thePort` - the port to listen on.
        `theIpAddress` - the ip address to bind to.
        `theTimeOut` - timeout for receiving continuous message.
        `theServerPassword` - the server password.
        `theAdminKey` - the server service key.
      Throws:
        `java.lang.Exception` - any other error.

  - ### Method Detail

    - #### initRequestListener

          public abstract void initRequestListener()
                                            throws java.io.IOException,
                                                   java.lang.Exception

      Initialise the request listener thread.
      Throws:
        `java.io.IOException` - for input/output error.
        `java.lang.Exception` - any other error.

    - #### closeListener

          protected abstract void closeListener()

      Close the listener down

    - #### shutDownListenerThread

          public void shutDownListenerThread()

      Shut down the request listener thread.