com.atlassian.plugin.webresource
Class SuperBatchPluginResource

java.lang.Object
  extended by com.atlassian.plugin.webresource.SuperBatchPluginResource
All Implemented Interfaces:
DownloadableResource, BatchResource, PluginResource
Direct Known Subclasses:
SuperBatchSubResource

public class SuperBatchPluginResource
extends Object
implements DownloadableResource, BatchResource, PluginResource

Creates a batch of all like-typed resources that are declared as "super-batch="true"" in their plugin definitions. The URL for batch resources is /download/superbatch/<type>/batch.<type. The additional type part in the path is simply there to make the number of path-parts identical with other resources, so relative URLs will still work in CSS files.


Constructor Summary
  SuperBatchPluginResource(String type, Map<String,String> params)
           
protected SuperBatchPluginResource(String resourceName, String type, Map<String,String> params)
           
 
Method Summary
 void add(DownloadableResource downloadableResource)
           
static SuperBatchPluginResource createBatchFor(PluginResource pluginResource)
           
 String getContentType()
          Returns the content type for the resource.
 String getModuleCompleteKey()
           
 Map<String,String> getParams()
           
 String getResourceName()
           
 String getType()
           
protected static String getType(String path)
           
 String getUrl()
           
 String getVersion(WebResourceIntegration integration)
           
 boolean isCacheSupported()
           
 boolean isEmpty()
           
 boolean isResourceModified(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Returns true if the plugin resource has been modified.
static boolean matches(String path)
           
static SuperBatchPluginResource parse(String path, Map<String,String> params)
           
 void serveResource(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Writes the resource content out into the response.
 void streamResource(OutputStream out)
          Write the resource to the supplied OutputStream.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SuperBatchPluginResource

public SuperBatchPluginResource(String type,
                                Map<String,String> params)

SuperBatchPluginResource

protected SuperBatchPluginResource(String resourceName,
                                   String type,
                                   Map<String,String> params)
Method Detail

matches

public static boolean matches(String path)

createBatchFor

public static SuperBatchPluginResource createBatchFor(PluginResource pluginResource)

parse

public static SuperBatchPluginResource parse(String path,
                                             Map<String,String> params)

getType

protected static String getType(String path)

isResourceModified

public boolean isResourceModified(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)
Description copied from interface: DownloadableResource
Returns true if the plugin resource has been modified. The implementing class is responsible for setting any appropriate response codes or headers on the response. If the resource has been modified, the resource shouldn't be served.

Specified by:
isResourceModified in interface DownloadableResource

serveResource

public void serveResource(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)
                   throws DownloadException
Description copied from interface: DownloadableResource
Writes the resource content out into the response.

Specified by:
serveResource in interface DownloadableResource
Throws:
DownloadException - if there were errors writing to the response.

streamResource

public void streamResource(OutputStream out)
                    throws DownloadException
Description copied from interface: DownloadableResource
Write the resource to the supplied OutputStream. Note that the OutputStream will not be closed by this method.

Specified by:
streamResource in interface DownloadableResource
Parameters:
out - the stream to write to
Throws:
DownloadException - if there were errors writing to the response. Since 2.3.

getContentType

public String getContentType()
Description copied from interface: DownloadableResource
Returns the content type for the resource. May return null if it cannot resolve its own content type.

Specified by:
getContentType in interface DownloadableResource

add

public void add(DownloadableResource downloadableResource)

isEmpty

public boolean isEmpty()

getUrl

public String getUrl()
Specified by:
getUrl in interface PluginResource
Returns:
the url for this plugin resource.

getParams

public Map<String,String> getParams()
Specified by:
getParams in interface BatchResource
Specified by:
getParams in interface PluginResource
Returns:
a map of parameter key and value pairs for this resource.

getVersion

public String getVersion(WebResourceIntegration integration)
Specified by:
getVersion in interface PluginResource
Returns:
the version prefix string for a cached resource

getType

public String getType()
Specified by:
getType in interface BatchResource

isCacheSupported

public boolean isCacheSupported()
Specified by:
isCacheSupported in interface PluginResource
Returns:
true if caching for this resource is supported. Use this check to append a static caching url prefix to this resource's url.

getResourceName

public String getResourceName()
Specified by:
getResourceName in interface PluginResource
Returns:
the resource name for the plugin resource.

getModuleCompleteKey

public String getModuleCompleteKey()
Specified by:
getModuleCompleteKey in interface PluginResource
Returns:
the plugin module's complete key for which this resource belongs to.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Atlassian. All Rights Reserved.