com.raritantechnologies.quickstart.userInterface
Class FileDocumentContentHandler

java.lang.Object
  extended bycom.raritantechnologies.quickstart.userInterface.FileDocumentContentHandler
All Implemented Interfaces:
IConfigurable, IDocumentContentHandler

public class FileDocumentContentHandler
extends java.lang.Object
implements IDocumentContentHandler

ContentHandler implementation for Documents stored in a File system.

XML Configuration Template:
    <ContentHandler 
           contentType="[contentType http parameter]"
           downloadFile="[ true|false( default ) - if true will open a File Download dialog instead of streaming back to browser ]" 
           class="com.raritantechnologies.quickstart.userInterface.FileDocumentContentHandler"
           basePath="[ base file path where files are located ]"
           errorMessage="[ put error message for file not found ]"
           errorPage="[ url of Error page ]" 
           fileNameParam="[ optional name of fileName request param ('file' and 'href' are checked by default) ]"
           folderNameParam="[ optional name of file folder request param ]" >

       <!-- Additional file paths -->      
       <BasePath>[A base file path]</BasePath>
       <BasePath>[Another base file path]</BasePath>

       <!-- Optional file name filter -->
       <FileNameFilter class="[ class of com.raritantechnologies.utils.filter.IStringFilter ]" >

       </FileNameFilter>

       <ErrorMessage>

       </ErrorMessage>

    </ContentHandler>
 

Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Constructor Summary
FileDocumentContentHandler()
           
 
Method Summary
 java.lang.String getErrorPage(HttpServletRequest pReq)
           
 java.lang.String getHandlerName()
          Returns the name of document handler
 java.lang.String getLastContentType()
           
 java.lang.String getLastDocumentName()
           
 java.util.Map getLastDocumentParamMap()
          Returns a delimited string of document param=value using the delimiters provided.
 java.util.List getRequestParameters()
          returns the list of parameters needed in the HTTP request.
 void initialize(org.w3c.dom.Element initElem)
          Initializes the object from an XML tag or element.
 void sendDocumentContent(ILoginInfo userInfo, HttpServletRequest pReq, HttpServletResponse pRes)
          Sends the document content to the HttpServletResponse using parameters in the HttpServletRequest.
 byte[] sendDocumentContent(java.util.Map handlerInfo)
          Sends the document content to the whatever class calls it using parameters defined in a Map.
static boolean sendFile(java.lang.String aFile, HttpServletResponse pRes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDocumentContentHandler

public FileDocumentContentHandler()
Method Detail

sendDocumentContent

public void sendDocumentContent(ILoginInfo userInfo,
                                HttpServletRequest pReq,
                                HttpServletResponse pRes)
                         throws ServletException
Description copied from interface: IDocumentContentHandler
Sends the document content to the HttpServletResponse using parameters in the HttpServletRequest.

Specified by:
sendDocumentContent in interface IDocumentContentHandler
Parameters:
userInfo - User information for this session user. May be used to restrict access to content.
pReq - The HttpServletRequest for the requested content.
pRes - The HttpServletResponse. The content handler will obtain a ServletOutputStream from this object and write the content to this stream.
Throws:
ServletException

sendFile

public static boolean sendFile(java.lang.String aFile,
                               HttpServletResponse pRes)

initialize

public void initialize(org.w3c.dom.Element initElem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IDocumentContentHandler

getErrorPage

public java.lang.String getErrorPage(HttpServletRequest pReq)
Specified by:
getErrorPage in interface IDocumentContentHandler

getLastDocumentName

public java.lang.String getLastDocumentName()
Specified by:
getLastDocumentName in interface IDocumentContentHandler

getHandlerName

public java.lang.String getHandlerName()
Returns the name of document handler

Specified by:
getHandlerName in interface IDocumentContentHandler

getLastDocumentParamMap

public java.util.Map getLastDocumentParamMap()
Returns a delimited string of document param=value using the delimiters provided.

Specified by:
getLastDocumentParamMap in interface IDocumentContentHandler

getLastContentType

public java.lang.String getLastContentType()
Specified by:
getLastContentType in interface IDocumentContentHandler

getRequestParameters

public java.util.List getRequestParameters()
Description copied from interface: IDocumentContentHandler
returns the list of parameters needed in the HTTP request.

Specified by:
getRequestParameters in interface IDocumentContentHandler

sendDocumentContent

public byte[] sendDocumentContent(java.util.Map handlerInfo)
Description copied from interface: IDocumentContentHandler
Sends the document content to the whatever class calls it using parameters defined in a Map.

Specified by:
sendDocumentContent in interface IDocumentContentHandler
Parameters:
handlerInfo - Information needed by the implementing class to retrieve and send content.