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  void error(IOException exception)
           
protected abstract  boolean exists()
           
protected abstract  ByteBuffer fileBytes()
           
protected  void notFound()
           
protected  ByteBuffer read(int length, InputStream in)
           
 void run()
           
protected abstract  ByteBuffer welcomeBytes()
           
protected  String withoutTrailingSlashOrQuery(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

fileBytes

protected abstract ByteBuffer fileBytes()
                                 throws IOException
Throws:
IOException

welcomeBytes

protected abstract ByteBuffer welcomeBytes()
                                    throws IOException
Throws:
IOException

read

protected ByteBuffer read(int length,
                          InputStream in)
                   throws IOException
Throws:
IOException

withoutTrailingSlashOrQuery

protected String withoutTrailingSlashOrQuery(String path)


Copyright © 2012. All Rights Reserved.