org.eclipse.jetty.util.resource
类 ResourceCollection

java.lang.Object
  继承者 org.eclipse.jetty.util.resource.Resource
      继承者 org.eclipse.jetty.util.resource.ResourceCollection
所有已实现的接口:
ResourceFactory

public class ResourceCollection
extends Resource

A collection of resources (dirs). Allows webapps to have multiple (static) sources. The first resource in the collection is the main resource. If a resource is not found in the main resource, it looks it up in the order the resources were constructed.


字段摘要
 
从类 org.eclipse.jetty.util.resource.Resource 继承的字段
__defaultUseCaches
 
构造方法摘要
ResourceCollection()
          Instantiates an empty resource collection.
ResourceCollection(Resource... resources)
          Instantiates a new resource collection.
ResourceCollection(String csvResources)
          Instantiates a new resource collection.
ResourceCollection(String[] resources)
          Instantiates a new resource collection.
 
方法摘要
 Resource addPath(String path)
          Returns the resource contained inside the current resource with the given name.
 void copyTo(File destination)
           
 boolean delete()
          Deletes the given resource
 boolean exists()
          Returns true if the respresened resource exists.
protected  Object findResource(String path)
           
 File getFile()
          Returns an File representing the given resource or NULL if this is not possible.
 InputStream getInputStream()
          Returns an input stream to the resource
 String getName()
          Returns the name of the resource
 OutputStream getOutputStream()
          Returns an output stream to the resource
 Resource[] getResources()
          Retrieves the resource collection's resources.
 URL getURL()
          Returns an URL representing the given resource
 boolean isContainedIn(Resource r)
           
 boolean isDirectory()
          Returns true if the respresenetd resource is a container/directory.
 long lastModified()
          Returns the last modified time
 long length()
          Return the length of the resource
 String[] list()
          Returns a list of resource names contained in the given resource The resource names are not URL encoded.
 void release()
          Release any temporary resources held by the resource.
 boolean renameTo(Resource dest)
          Rename the given resource
 void setResources(Resource[] resources)
          Sets the resource collection's resources.
 void setResourcesAsCSV(String csvResources)
          Sets the resources as string of comma-separated values.
 String toString()
           
 
从类 org.eclipse.jetty.util.resource.Resource 继承的方法
encode, finalize, getAlias, getAssociate, getDefaultUseCaches, getListHTML, getResource, getURI, getWeakETag, isContainedIn, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, setAssociate, setDefaultUseCaches, toURL, writeTo
 
从类 java.lang.Object 继承的方法
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

ResourceCollection

public ResourceCollection()
Instantiates an empty resource collection. This constructor is used when configuring jetty-maven-plugin.


ResourceCollection

public ResourceCollection(Resource... resources)
Instantiates a new resource collection.

参数:
resources - the resources to be added to collection

ResourceCollection

public ResourceCollection(String[] resources)
Instantiates a new resource collection.

参数:
resources - the resource strings to be added to collection

ResourceCollection

public ResourceCollection(String csvResources)
Instantiates a new resource collection.

参数:
csvResources - the string containing comma-separated resource strings
方法详细信息

getResources

public Resource[] getResources()
Retrieves the resource collection's resources.

返回:
the resource array

setResources

public void setResources(Resource[] resources)
Sets the resource collection's resources.

参数:
resources - the new resource array

setResourcesAsCSV

public void setResourcesAsCSV(String csvResources)
Sets the resources as string of comma-separated values. This method should be used when configuring jetty-maven-plugin.

参数:
csvResources - the comma-separated string containing one or more resource strings.

addPath

public Resource addPath(String path)
                 throws IOException,
                        MalformedURLException
从类 Resource 复制的描述
Returns the resource contained inside the current resource with the given name.

指定者:
Resource 中的 addPath
参数:
path - The path segment to add
返回:
The contained resource (found first) in the collection of resources
抛出:
IOException
MalformedURLException

findResource

protected Object findResource(String path)
                       throws IOException,
                              MalformedURLException
参数:
path -
返回:
the resource(file) if found, returns a list of resource dirs if its a dir, else null.
抛出:
IOException
MalformedURLException

delete

public boolean delete()
               throws SecurityException
从类 Resource 复制的描述
Deletes the given resource

指定者:
Resource 中的 delete
抛出:
SecurityException

exists

public boolean exists()
从类 Resource 复制的描述
Returns true if the respresened resource exists.

指定者:
Resource 中的 exists

getFile

public File getFile()
             throws IOException
从类 Resource 复制的描述
Returns an File representing the given resource or NULL if this is not possible.

指定者:
Resource 中的 getFile
抛出:
IOException

getInputStream

public InputStream getInputStream()
                           throws IOException
从类 Resource 复制的描述
Returns an input stream to the resource

指定者:
Resource 中的 getInputStream
抛出:
IOException

getName

public String getName()
从类 Resource 复制的描述
Returns the name of the resource

指定者:
Resource 中的 getName

getOutputStream

public OutputStream getOutputStream()
                             throws IOException,
                                    SecurityException
从类 Resource 复制的描述
Returns an output stream to the resource

指定者:
Resource 中的 getOutputStream
抛出:
IOException
SecurityException

getURL

public URL getURL()
从类 Resource 复制的描述
Returns an URL representing the given resource

指定者:
Resource 中的 getURL

isDirectory

public boolean isDirectory()
从类 Resource 复制的描述
Returns true if the respresenetd resource is a container/directory. If the resource is not a file, resources ending with "/" are considered directories.

指定者:
Resource 中的 isDirectory

lastModified

public long lastModified()
从类 Resource 复制的描述
Returns the last modified time

指定者:
Resource 中的 lastModified

length

public long length()
从类 Resource 复制的描述
Return the length of the resource

指定者:
Resource 中的 length

list

public String[] list()
从类 Resource 复制的描述
Returns a list of resource names contained in the given resource The resource names are not URL encoded.

指定者:
Resource 中的 list
返回:
The list of resource names(merged) contained in the collection of resources.

release

public void release()
从类 Resource 复制的描述
Release any temporary resources held by the resource.

指定者:
Resource 中的 release

renameTo

public boolean renameTo(Resource dest)
                 throws SecurityException
从类 Resource 复制的描述
Rename the given resource

指定者:
Resource 中的 renameTo
抛出:
SecurityException

copyTo

public void copyTo(File destination)
            throws IOException
覆盖:
Resource 中的 copyTo
抛出:
IOException

toString

public String toString()
覆盖:
Object 中的 toString
返回:
the list of resources separated by a path separator

isContainedIn

public boolean isContainedIn(Resource r)
                      throws MalformedURLException
指定者:
Resource 中的 isContainedIn
抛出:
MalformedURLException


Copyright © 2013. All Rights Reserved.