org.ka2ddo.yaac.webserver
Class FileCopierPage

java.lang.Object
  extended by org.ka2ddo.yaac.webserver.PathHandler
      extended by org.ka2ddo.yaac.webserver.FileCopierPage
All Implemented Interfaces:
AttributedPage

public class FileCopierPage
extends PathHandler
implements AttributedPage

This class defines a HTTP page for copying a file from this YAAC installation to another. The constructor argument specifies the relative path (within the YAAC distribution install) of the file to export; the URL under which the instance of this class is registered specifies the download path for web clients.


Nested Class Summary
static class FileCopierPage.PathType
          Enumeration specifying the base directory for the relative path of the exported file.
 
Field Summary
 
Fields inherited from class org.ka2ddo.yaac.webserver.PathHandler
httpServer, TEXT_HTML_CHARSET_UTF_8
 
Constructor Summary
FileCopierPage(FileCopierPage.PathType pathType, java.lang.String relativePath, java.lang.String contentType)
          Create an instance of FileCopierPage to export the specified disk file over HTTP, using the specified contentType.
 
Method Summary
 java.lang.String processPage(HttpConnectionThread hct, java.util.LinkedHashMap<java.lang.String,java.lang.String> requestHeaders, java.io.DataInputStream in, java.io.OutputStream out, java.lang.String path)
          Given an inbound HTTP request, generate a page using its parameters.
 
Methods inherited from class org.ka2ddo.yaac.webserver.PathHandler
escPrint, getHttpServer, setHttpServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileCopierPage

public FileCopierPage(FileCopierPage.PathType pathType,
                      java.lang.String relativePath,
                      java.lang.String contentType)
Create an instance of FileCopierPage to export the specified disk file over HTTP, using the specified contentType.

Parameters:
pathType - base directory to specify for this file's path, as defined by the PathType enum
relativePath - String of relative path of file within
contentType - HTTP-standard Content-Type MIME string
Method Detail

processPage

public java.lang.String processPage(HttpConnectionThread hct,
                                    java.util.LinkedHashMap<java.lang.String,java.lang.String> requestHeaders,
                                    java.io.DataInputStream in,
                                    java.io.OutputStream out,
                                    java.lang.String path)
                             throws java.io.IOException
Given an inbound HTTP request, generate a page using its parameters.

Specified by:
processPage in class PathHandler
Parameters:
hct - HttpConnectionThread issuing the call
requestHeaders - the HTTP request headers the browser sent
in - DataInputStream for reading the body of the HTTP request
out - OutputStream to write the generated page to
path - the remainder of the URL following the prefix identifying this particular page, in case the user is providing parameters to the page
Returns:
the Content-Type header value to return to tell the remote browser how to interpret the page
Throws:
java.io.IOException - if the page could not be generated for some reason