ikrs.httpd.filehandler
Class IkarosExampleHandler

java.lang.Object
  extended by ikrs.httpd.AbstractFileHandler
      extended by ikrs.httpd.filehandler.IkarosExampleHandler
All Implemented Interfaces:
FileHandler

public class IkarosExampleHandler
extends AbstractFileHandler

A small example handler.


Constructor Summary
IkarosExampleHandler()
           
 
Method Summary
 Resource process(java.util.UUID sessionID, HTTPHeaders headers, PostDataWrapper postData, java.io.File file, java.net.URI requestURI)
          The 'process' method is very generic.
 boolean requiresExistingFile()
          Most file handlers operate on existing files that are located inside the local file system (such as the default handler does for simple file delivery).
 
Methods inherited from class ikrs.httpd.AbstractFileHandler
getHTTPHandler, getLogger, setHTTPHandler, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IkarosExampleHandler

public IkarosExampleHandler()
Method Detail

requiresExistingFile

public boolean requiresExistingFile()
Most file handlers operate on existing files that are located inside the local file system (such as the default handler does for simple file delivery). Some file handlers operate on virtual file systems, which means that the request URI does not necessarily address an existing file but a symbol only the handler may know. The global HTTP handler needs to know if to throw a MissingResourceException (resulting in a 404) if a requested file does not exists --- or if to ignore that fact and simply continue. This method tells how to proceed. If your implementation returns true this handler will not be called at all; the request processing will directly stop raising an HTTP status 404.

Specified by:
requiresExistingFile in interface FileHandler
Specified by:
requiresExistingFile in class AbstractFileHandler
Returns:
true if this file handler definitely requires existing files. The process(...) method will never be called if the requested file does not exist in that case.

process

public Resource process(java.util.UUID sessionID,
                        HTTPHeaders headers,
                        PostDataWrapper postData,
                        java.io.File file,
                        java.net.URI requestURI)
                 throws java.io.IOException,
                        HeaderFormatException,
                        DataFormatException,
                        UnsupportedFormatException
The 'process' method is very generic. It depends on the underlying implementation how the passed file should be processed.

Specified by:
process in interface FileHandler
Specified by:
process in class AbstractFileHandler
Parameters:
sessionID - The current session's ID.
headers - The HTTP request headers.
postData - The HTTP post data; if the method is not HTTP POST the 'postData' should be null (or empty).
file - The requested file itself (inside the local file system).
requestURI - The requested URI (relative to DOCUMENT_ROOT).
Throws:
java.io.IOException
HeaderFormatException
DataFormatException
UnsupportedFormatException