org.webbitserver.handler
Class AbstractResourceHandler.IOWorker

java.lang.Object
  extended by org.webbitserver.handler.AbstractResourceHandler.IOWorker
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
EmbeddedResourceHandler.ResourceWorker, StaticFileHandler.FileWorker
Enclosing class:
AbstractResourceHandler

protected abstract class AbstractResourceHandler.IOWorker
extends Object
implements Runnable

All IO is performed by this worker on a separate thread, so we never block the HttpHandler.


Field Summary
protected  HttpControl control
           
protected  String path
           
protected  HttpResponse response
           
 
Constructor Summary
protected AbstractResourceHandler.IOWorker(String path, HttpRequest request, HttpResponse response, HttpControl control)
           
 
Method Summary
protected abstract  byte[] directoryListingBytes()
           
protected  void error(IOException exception)
           
protected abstract  boolean exists()
           
protected  String extractQuery(String path)
           
protected abstract  byte[] fileBytes()
           
protected abstract  boolean isDirectory()
           
protected  void notFound()
           
protected  byte[] read(int length, InputStream in)
           
 void run()
           
protected abstract  byte[] welcomeBytes()
           
protected  String withoutQuery(String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path

protected String path

response

protected final HttpResponse response

control

protected final HttpControl control
Constructor Detail

AbstractResourceHandler.IOWorker

protected AbstractResourceHandler.IOWorker(String path,
                                           HttpRequest request,
                                           HttpResponse response,
                                           HttpControl control)
Method Detail

notFound

protected void notFound()

error

protected void error(IOException exception)

run

public void run()
Specified by:
run in interface Runnable

exists

protected abstract boolean exists()
                           throws IOException
Throws:
IOException

isDirectory

protected abstract boolean isDirectory()
                                throws IOException
Throws:
IOException

fileBytes

protected abstract byte[] fileBytes()
                             throws IOException
Throws:
IOException

welcomeBytes

protected abstract byte[] welcomeBytes()
                                throws IOException
Throws:
IOException

directoryListingBytes

protected abstract byte[] directoryListingBytes()
                                         throws IOException
Throws:
IOException

read

protected byte[] read(int length,
                      InputStream in)
               throws IOException
Throws:
IOException

withoutQuery

protected String withoutQuery(String path)

extractQuery

protected String extractQuery(String path)


Copyright © 2012. All Rights Reserved.