com.atlassian.plugin.servlet
Class AbstractDownloadableResource

java.lang.Object
  extended by com.atlassian.plugin.servlet.AbstractDownloadableResource
All Implemented Interfaces:
DownloadableResource
Direct Known Subclasses:
DownloadableClasspathResource, DownloadableWebResource

public abstract class AbstractDownloadableResource
extends java.lang.Object
implements DownloadableResource


Field Summary
protected  java.lang.String extraPath
           
protected  Plugin plugin
           
protected  ResourceLocation resourceLocation
           
protected  BaseFileServerServlet servlet
           
 
Constructor Summary
AbstractDownloadableResource(BaseFileServerServlet servlet, Plugin plugin, ResourceLocation resourceLocation, java.lang.String extraPath)
           
 
Method Summary
protected  boolean checkResourceNotModified(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
          Checks any "If-Modified-Since" header from the request against the plugin's loading time, since plugins can't be modified after they've been loaded this is a good way to determine if a plugin resource has been modified or not.
protected  java.lang.String getContentType()
           
protected  java.lang.String getLocation()
           
abstract  void serveResource(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

resourceLocation

protected ResourceLocation resourceLocation

extraPath

protected java.lang.String extraPath

plugin

protected Plugin plugin

servlet

protected BaseFileServerServlet servlet
Constructor Detail

AbstractDownloadableResource

public AbstractDownloadableResource(BaseFileServerServlet servlet,
                                    Plugin plugin,
                                    ResourceLocation resourceLocation,
                                    java.lang.String extraPath)
Method Detail

getContentType

protected java.lang.String getContentType()

getLocation

protected java.lang.String getLocation()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

serveResource

public abstract void serveResource(javax.servlet.http.HttpServletRequest httpServletRequest,
                                   javax.servlet.http.HttpServletResponse httpServletResponse)
                            throws java.io.IOException
Specified by:
serveResource in interface DownloadableResource
Throws:
java.io.IOException

checkResourceNotModified

protected boolean checkResourceNotModified(javax.servlet.http.HttpServletRequest httpServletRequest,
                                           javax.servlet.http.HttpServletResponse httpServletResponse)
Checks any "If-Modified-Since" header from the request against the plugin's loading time, since plugins can't be modified after they've been loaded this is a good way to determine if a plugin resource has been modified or not. If this method returns true, don't do any more processing on the request -- the response code has already been set to "304 Not Modified" for you, and you don't need to serve the file.



Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.