org.norther.tammi.spray.media
Class DefaultMediaProvider

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.spray.media.DefaultMediaProvider
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, MediaProvider
Direct Known Subclasses:
DefaultCachedMediaProvider

public class DefaultMediaProvider
extends Adaptee
implements MediaProvider

A default implementation of MediaProvider.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultMediaProvider()
          Constructs a new provider.
 
Method Summary
 String getDefaultIndex()
          Gets the default index file.
protected  String getDefaultIndex(ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the default index with the terminal extension.
 String getMediaKey()
          Gets the path finder key for resolving media paths.
 Resource getResource(String path, boolean cached, ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the media content resource.
 boolean isLocalizedContent()
          Gets the localized content flag.
 void setDefaultIndex(String index)
          Sets the default index file.
 void setLocalizedContent(boolean flag)
          Sets the localized content flag.
 void setMediaKey(String key)
          Sets the path finder key for resolving media paths.
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMediaProvider

public DefaultMediaProvider()
Constructs a new provider.

Method Detail

getMediaKey

public String getMediaKey()
Description copied from interface: MediaProvider
Gets the path finder key for resolving media paths.

Specified by:
getMediaKey in interface MediaProvider
Returns:
the path finder key.

setMediaKey

public void setMediaKey(String key)
Description copied from interface: MediaProvider
Sets the path finder key for resolving media paths. The default key is PathFinder.MEDIA.

Specified by:
setMediaKey in interface MediaProvider
Parameters:
key - the path finder key.

getDefaultIndex

public String getDefaultIndex()
Description copied from interface: MediaProvider
Gets the default index file.

Specified by:
getDefaultIndex in interface MediaProvider
Returns:
the default index file.

setDefaultIndex

public void setDefaultIndex(String index)
Description copied from interface: MediaProvider
Sets the default index file.

Specified by:
setDefaultIndex in interface MediaProvider
Parameters:
index - a default index file.

isLocalizedContent

public boolean isLocalizedContent()
Description copied from interface: MediaProvider
Gets the localized content flag.

Specified by:
isLocalizedContent in interface MediaProvider
Returns:
the localized content flag.

setLocalizedContent

public void setLocalizedContent(boolean flag)
Description copied from interface: MediaProvider
Sets the localized content flag. Localized media content names are formed by inserting the locale string between the plain name and the extension.

Specified by:
setLocalizedContent in interface MediaProvider
Parameters:
flag - the localized content flag.

getResource

public Resource getResource(String path,
                            boolean cached,
                            ServletRequest request,
                            ServletResponse response,
                            FilterChain chain)
                     throws IOException,
                            ConstructionException,
                            AccessDeniedException
Description copied from interface: MediaProvider
Gets the media content resource.

Specified by:
getResource in interface MediaProvider
Parameters:
path - the content path.
cached - true if caching is enabled, false otherwise.
request - the servlet request.
response - the servlet response.
chain - the filter chain.
Returns:
the resource source.
Throws:
IOException - on I/O errors.
ConstructionException - on resource errors.
AccessDeniedException - for access restrictions.

getDefaultIndex

protected String getDefaultIndex(ServletRequest request,
                                 ServletResponse response,
                                 FilterChain chain)
Gets the default index with the terminal extension.

Parameters:
request - the request.
response - the response.
chain - the filter chain.
Returns:
the default index.


Copyright © 2004 The Norther Organization. All rights reserved.