org.abstracthorizon.danube.http.util
Class ReadWriteFileConnectionHandler

java.lang.Object
  extended by org.abstracthorizon.danube.http.BaseReflectionHTTPConnectionHandler
      extended by org.abstracthorizon.danube.http.util.ReadOnlyFileConnectionHandler
          extended by org.abstracthorizon.danube.http.util.ReadWriteFileConnectionHandler
All Implemented Interfaces:
ConnectionHandler

public class ReadWriteFileConnectionHandler
extends ReadOnlyFileConnectionHandler

Connection handler that handles static files (and directories)

Author:
Daniel Sendula

Field Summary
 
Fields inherited from class org.abstracthorizon.danube.http.util.ReadOnlyFileConnectionHandler
bufferSize, dateFormat, DEFAULT_BUFFER_SIZE, filePath, fileTypeMap, GIGABYTE, KILOBYTE, MEGABYTE, TERABYTE
 
Fields inherited from class org.abstracthorizon.danube.http.BaseReflectionHTTPConnectionHandler
cachedMethods, errorResponse, noDefaultHead, noDefaultTrace
 
Constructor Summary
ReadWriteFileConnectionHandler()
          Constructor
 
Method Summary
 void methodDELETE(HTTPConnection httpConnection)
           
 void methodPUT(HTTPConnection httpConnection)
          This method retruns list of files from give directory or returns a file, using FileTypeMap to convert file extension to mime type
protected  void transferToFileChannel(FileChannel fileChannel, ReadableByteChannel inputChannel, long length)
          Transfer given channel to the file channel
protected  void uploadFile(File file, HTTPConnection httpConnection)
          Uploads the file
 
Methods inherited from class org.abstracthorizon.danube.http.util.ReadOnlyFileConnectionHandler
encode, getBufferSize, getFileHandle, getFilePath, getFileTypeMap, getLengthAsString, handleDirectory, handleFile, methodGET, methodHEAD, obtainBuffer, releaseBuffer, setBufferSize, setFilePath, setFileTypeMap, transferFromFileChannel, transferStreams, updateHeadersForFile
 
Methods inherited from class org.abstracthorizon.danube.http.BaseReflectionHTTPConnectionHandler
cacheMethods, getErrorResponse, getNoDefaultHead, getNoDefaultTrace, handleConnection, invokeMethod, methodOPTIONS, methodTRACE, returnError, returnSimpleContent, setErrorResponse, setNoDefaultHead, setNoDefaultTrace, updateDefaultHeadMethod, updateDefaultTraceMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadWriteFileConnectionHandler

public ReadWriteFileConnectionHandler()
Constructor

Method Detail

methodDELETE

public void methodDELETE(HTTPConnection httpConnection)

methodPUT

public void methodPUT(HTTPConnection httpConnection)
This method retruns list of files from give directory or returns a file, using FileTypeMap to convert file extension to mime type

Parameters:
httpConnection - http connection

uploadFile

protected void uploadFile(File file,
                          HTTPConnection httpConnection)
Uploads the file

Parameters:
file - file
httpConnection - http connection

transferToFileChannel

protected void transferToFileChannel(FileChannel fileChannel,
                                     ReadableByteChannel inputChannel,
                                     long length)
                              throws IOException
Transfer given channel to the file channel

Parameters:
inputChannel - file channel
fileChannel - output channel
length - length
Throws:
IOException - IO exception


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.