## org.opencyc.webserver
Class WebServer.Task

    java.lang.Object
      |
      +--java.lang.Thread
            |
            +--org.opencyc.webserver.WebServer.Task

All Implemented Interfaces:
  java.lang.Runnable

Enclosing class:
  WebServer

protected class WebServer.Task
extends java.lang.Thread

Class Task processes a single HTTP request.

Field Summary
`protected java.lang.String` `bodyLine` Contains the body of a POST method.
`protected java.net.Socket` `cycHtmlSocket` Client socket to the Cyc KB HTML server.
`protected java.lang.String` `methodLine` Contains the first line of a request message.
`protected java.lang.String` `notFoundPath` Contains the file request path for a not-found error message.
`protected java.io.DataOutputStream` `out` Output tcp stream.
`protected java.net.Socket` `sock` Socket for the incoming request.

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`WebServer.Task(java.net.Socket sock)` Constructs a Task object.

Method Summary
`void` `run()` Processes the HTTP request.
`void` `writeDataBytes(byte[] bytes)` Responds to the HTTP client with data content from the requested URL.
`void` `writeTextBytes(byte[] bytes)` Respond to the HTTP client with text content from the requested URL.

Methods inherited from class java.lang.Thread
`activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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

### sock

    protected java.net.Socket sock

  Socket for the incoming request.

### cycHtmlSocket

    protected java.net.Socket cycHtmlSocket

  Client socket to the Cyc KB HTML server.

### out

    protected java.io.DataOutputStream out

  Output tcp stream.

### notFoundPath

    protected java.lang.String notFoundPath

  Contains the file request path for a not-found error message.

### methodLine

    protected java.lang.String methodLine

  Contains the first line of a request message.

### bodyLine

    protected java.lang.String bodyLine

  Contains the body of a POST method.

Constructor Detail

### WebServer.Task

    public WebServer.Task(java.net.Socket sock)

  Constructs a Task object.
  Parameters:
    `sock` - the socket assigned for this request.

Method Detail

### run

    public void run()

  Processes the HTTP request.
  Overrides:
    `run` in class `java.lang.Thread`

### writeDataBytes

    public void writeDataBytes(byte[] bytes)
                        throws java.io.IOException

  Responds to the HTTP client with data content from the requested URL.
  Parameters:
    `bytes` - the array of bytes from the URL.
  Throws:
    `java.io.IOException` - if there is an error writing to the HTTP client.

### writeTextBytes

    public void writeTextBytes(byte[] bytes)
                        throws java.io.IOException

  Respond to the HTTP client with text content from the requested URL.
  Parameters:
    `bytes` - the array of bytes from the URL.
  Throws:
    `java.io.IOException` - if there is an error writing to the HTTP client.