Savarese.Org

org.savarese.barehttp
Class HTTPSession

java.lang.Object
  extended by org.savarese.barehttp.HTTPSession

public class HTTPSession
extends java.lang.Object

An HTTPSession executes an HTTP conversation via an InputStream and OutputSream. It processes only one request and then terminates the session. Only HTTP/0.9, 1.0, and 1.1 GET requests and HTTP/1.0 and 1.1 HEAD requests are supported. The canonical pathname of served files is checked against the document root. If the file path does not fall under the document root, an HTTP "403 Forbidden Resource" error is returned.

Author:
Daniel F. Savarese

Constructor Summary
HTTPSession(java.lang.String documentRoot, java.io.InputStream in, java.io.OutputStream out)
          Creates an HTTPSession rooted at the specified document directory and communicating via the specified streams.
 
Method Summary
 void execute()
          Executes the HTTP conversation and closes the session after satisfying the first request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPSession

public HTTPSession(java.lang.String documentRoot,
                   java.io.InputStream in,
                   java.io.OutputStream out)
            throws java.io.IOException
Creates an HTTPSession rooted at the specified document directory and communicating via the specified streams.

Parameters:
documentRoot - The fully qualified directory pathname to serve as the document root.
in - The InputStream via which the client submits its request.
out - The OutputStram via which the HTTPSession sends its reply.
Throws:
java.io.IOException
Method Detail

execute

public void execute()
             throws java.io.IOException
Executes the HTTP conversation and closes the session after satisfying the first request.

Throws:
java.io.IOException

Savarese.Org

Copyright © 2001,2006,2010,2012 Daniel F. Savarese. All Rights Reserved.