net.xoetrope.optional.http
Class XHttpSession

java.lang.Object
  extended by net.xoetrope.optional.http.XHttpSession
All Implemented Interfaces:
java.lang.Runnable

public class XHttpSession
extends java.lang.Object
implements java.lang.Runnable

Handle a HTTP session

Copyright (c) Xoetrope Ltd., 2001-2006, see license.txt for details


Constructor Summary
XHttpSession(java.net.Socket s, XHttpResponseHandler handler)
          Create a new session
 
Method Summary
 void run()
          The runnable method
protected  void sendError(java.lang.String code, java.lang.String message)
          Send an error message as a response
protected  void sendResponse(java.lang.String status, java.lang.String mimeType, java.util.Properties headers, java.io.InputStream data)
          Send the response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XHttpSession

public XHttpSession(java.net.Socket s,
                    XHttpResponseHandler handler)
Create a new session

Parameters:
s - the incoming socket
handler - the response hanlder
Method Detail

run

public void run()
The runnable method

Specified by:
run in interface java.lang.Runnable

sendError

protected void sendError(java.lang.String code,
                         java.lang.String message)
                  throws java.lang.InterruptedException
Send an error message as a response

Parameters:
code - the http reponse
message - the error message throws InterruptedException to stop furhter request processing.
Throws:
java.lang.InterruptedException

sendResponse

protected void sendResponse(java.lang.String status,
                            java.lang.String mimeType,
                            java.util.Properties headers,
                            java.io.InputStream data)
Send the response. As a minimal server this class does not return any files and instead only returns a response code.

Parameters:
status -
mimeType -
props -
data -