| java.lang.Object org.restlet.Uniform org.restlet.Restlet org.restlet.Finder org.restlet.Directory
Directory | public class Directory extends Finder (Code) | | Finder mapping a directory of local resources. Those resources have
representations accessed by the file system or the class loaders.
An automatic content negotiation mechanism (similar to the one in Apache HTTP
server) is used to select the best representation of a resource based on the
available variants and on the client capabilities and preferences.
The directory can be used in read-only or modifiable mode. In the latter
case, you just need to set the "modifiable" property to true. The currently
supported methods are PUT and DELETE.
See Also: Tutorial: Serving
* static files author: Jerome Louvel (contact@noelios.com) |
Method Summary | |
public Resource | findTarget(Request request, Response response) Finds the target Resource if available.
Parameters: request - The request to filter. Parameters: response - The response to filter. | public String | getIndexName() Returns the index name, without extensions. | public Representation | getIndexRepresentation(Variant variant, ReferenceList indexContent) Returns an actual index representation for a given variant.
Parameters: variant - The selected variant. Parameters: indexContent - The directory index to represent. | public List<Variant> | getIndexVariants(ReferenceList indexContent) Returns the variant representations of a directory index. | public Reference | getRootRef() Returns the root URI. | public boolean | isDeeplyAccessible() Indicates if the subdirectories are deeply accessible (true by default). | public boolean | isListingAllowed() Indicates if the display of directory listings is allowed when no index
file is found. | public boolean | isModifiable() Indicates if modifications to local resources (most likely files) are
allowed. | public boolean | isNegotiateContent() Indicates if the best content is automatically negotiated. | public void | setDeeplyAccessible(boolean deeplyAccessible) Indicates if the subdirectories are deeply accessible (true by default). | public void | setIndexName(String indexName) Sets the index name, without extensions. | public void | setListingAllowed(boolean listingAllowed) Indicates if the display of directory listings is allowed when no index
file is found. | public void | setModifiable(boolean modifiable) Indicates if modifications to local resources are allowed. | public void | setNegotiateContent(boolean negotiateContent) Indicates if the best content is automatically negotiated. |
Directory | public Directory(Context context, LocalReference rootLocalReference)(Code) | | Constructor.
Parameters: context - The context. Parameters: rootLocalReference - The root URI. |
Directory | public Directory(Context context, String rootUri)(Code) | | Constructor.
Parameters: context - The context. Parameters: rootUri - The absolute root URI.
If you serve files from the file system, use file:// URIs andmake sure that you register a FILE connector with your parentComponent. On Windows, make sure that you add enough slashcharacters at the beginning, for example: file:///c:/dir/file
If you serve files from a class loader, use clap:// URIs andmake sure that you register a CLAP connector with your parentComponent.
|
findTarget | public Resource findTarget(Request request, Response response)(Code) | | Finds the target Resource if available.
Parameters: request - The request to filter. Parameters: response - The response to filter. The target resource if available or null. |
getIndexName | public String getIndexName()(Code) | | Returns the index name, without extensions. Returns "index" by default.
The index name. |
getIndexRepresentation | public Representation getIndexRepresentation(Variant variant, ReferenceList indexContent)(Code) | | Returns an actual index representation for a given variant.
Parameters: variant - The selected variant. Parameters: indexContent - The directory index to represent. The actual index representation. |
getIndexVariants | public List<Variant> getIndexVariants(ReferenceList indexContent)(Code) | | Returns the variant representations of a directory index. This method can
be subclassed in order to provide alternative representations. By default
it returns a simple HTML document and a textual URI list as variants.
Parameters: indexContent - The list of references contained in the directory index. The variant representations of a directory. |
getRootRef | public Reference getRootRef()(Code) | | Returns the root URI.
The root URI. |
isDeeplyAccessible | public boolean isDeeplyAccessible()(Code) | | Indicates if the subdirectories are deeply accessible (true by default).
True if the subdirectories are deeply accessible. |
isListingAllowed | public boolean isListingAllowed()(Code) | | Indicates if the display of directory listings is allowed when no index
file is found.
True if the display of directory listings is allowed when noindex file is found. |
isModifiable | public boolean isModifiable()(Code) | | Indicates if modifications to local resources (most likely files) are
allowed. Returns false by default.
True if modifications to local resources are allowed. |
isNegotiateContent | public boolean isNegotiateContent()(Code) | | Indicates if the best content is automatically negotiated. Default value
is true.
True if the best content is automatically negotiated. |
setDeeplyAccessible | public void setDeeplyAccessible(boolean deeplyAccessible)(Code) | | Indicates if the subdirectories are deeply accessible (true by default).
Parameters: deeplyAccessible - True if the subdirectories are deeply accessible. |
setIndexName | public void setIndexName(String indexName)(Code) | | Sets the index name, without extensions.
Parameters: indexName - The index name. |
setListingAllowed | public void setListingAllowed(boolean listingAllowed)(Code) | | Indicates if the display of directory listings is allowed when no index
file is found.
Parameters: listingAllowed - True if the display of directory listings is allowed when noindex file is found. |
setModifiable | public void setModifiable(boolean modifiable)(Code) | | Indicates if modifications to local resources are allowed.
Parameters: modifiable - True if modifications to local resources are allowed. |
setNegotiateContent | public void setNegotiateContent(boolean negotiateContent)(Code) | | Indicates if the best content is automatically negotiated. Default value
is true.
Parameters: negotiateContent - True if the best content is automatically negotiated. |
|
|