org.fcrepo.server.rest
Class DatastreamFilenameHelper

java.lang.Object
  extended by org.fcrepo.server.rest.DatastreamFilenameHelper

public class DatastreamFilenameHelper
extends Object

Helper class to manage getting filenames for datastreams and adding content disposition headers to force downloading of datastream disseminations

Version:
$Id$
Author:
Stephen Bayliss

Field Summary
protected static String FILENAME_REL
           
protected static Pattern ILLEGAL_FILENAME_REGEX
           
protected  Access m_apiAService
           
protected  Management m_apiMService
           
protected static String m_datastreamContentDispositionInlineEnabled
           
protected static String m_datastreamDefaultExtension
           
protected static String m_datastreamDefaultFilename
           
protected static String m_datastreamExtensionMappingDefault
           
protected static String m_datastreamExtensionMappingId
           
protected static String m_datastreamExtensionMappingLabel
           
protected static String m_datastreamExtensionMappingRels
           
protected static String m_datastreamFilenameSource
           
protected static HashMap<String,String> m_extensionMappings
           
 
Constructor Summary
DatastreamFilenameHelper(Server fedoraServer, Management management, Access access)
          Read configuration information from fedora.fcfg
 
Method Summary
 void addContentDispositionHeader(Context context, String pid, String dsID, String download, Date asOfDateTime, MIMETypedStream stream)
          Add a content disposition header to a MIMETypedStream based on configuration preferences.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_datastreamContentDispositionInlineEnabled

protected static String m_datastreamContentDispositionInlineEnabled

m_datastreamFilenameSource

protected static String m_datastreamFilenameSource

m_datastreamExtensionMappingLabel

protected static String m_datastreamExtensionMappingLabel

m_datastreamExtensionMappingId

protected static String m_datastreamExtensionMappingId

m_datastreamExtensionMappingRels

protected static String m_datastreamExtensionMappingRels

m_datastreamExtensionMappingDefault

protected static String m_datastreamExtensionMappingDefault

m_datastreamDefaultFilename

protected static String m_datastreamDefaultFilename

m_datastreamDefaultExtension

protected static String m_datastreamDefaultExtension

FILENAME_REL

protected static String FILENAME_REL

ILLEGAL_FILENAME_REGEX

protected static Pattern ILLEGAL_FILENAME_REGEX

m_apiMService

protected Management m_apiMService

m_apiAService

protected Access m_apiAService

m_extensionMappings

protected static HashMap<String,String> m_extensionMappings
Constructor Detail

DatastreamFilenameHelper

public DatastreamFilenameHelper(Server fedoraServer,
                                Management management,
                                Access access)
Read configuration information from fedora.fcfg

Parameters:
fedoraServer -
management -
access -
Method Detail

addContentDispositionHeader

public final void addContentDispositionHeader(Context context,
                                              String pid,
                                              String dsID,
                                              String download,
                                              Date asOfDateTime,
                                              MIMETypedStream stream)
                                       throws Exception
Add a content disposition header to a MIMETypedStream based on configuration preferences. Header by default specifies "inline"; if download=true then "attachment" is specified.

Parameters:
context -
pid -
dsID -
download - true if file is to be downloaded
asOfDateTime -
stream -
Throws:
Exception


Copyright © 2011 DuraSpace. All Rights Reserved.