|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.resource.Resource
org.restlet.resource.ServerResource
org.restlet.engine.local.DirectoryServerResource
public class DirectoryServerResource
Resource supported by a set of context representations (from file system, class loaders and webapp context). A content negotiation mechanism (similar to Apache HTTP server) is available. It is based on path extensions to detect variants (languages, media types or character sets).
| Constructor Summary | |
|---|---|
DirectoryServerResource()
|
|
| Method Summary | |
|---|---|
Representation |
delete()
Deletes the resource and all its representations. |
void |
doInit()
This initialization method aims at answering the following questions: does this request target a directory? does this request target a directory, with an index file? should this request be redirected (target is a directory with no trailing "/")? does this request target a file? The following constraints must be taken into account: the underlying helper may not support content negotiation and be able to return the list of possible variants of the target file (e.g. |
protected Representation |
get()
Returns a full representation. |
String |
getBaseName()
Returns the local base name of the file. |
protected Restlet |
getClientDispatcher()
Returns a client dispatcher. |
Directory |
getDirectory()
Returns the parent directory handler. |
protected ReferenceList |
getDirectoryContent()
If the resource is a directory, this returns its content. |
String |
getDirectoryUri()
Returns the context's directory URI (file, clap URI). |
protected Response |
getRepresentation(String resourceUri,
MediaType acceptedMediaType)
Returns a representation of the resource at the target URI. |
String |
getTargetUri()
Returns the context's target URI (file, clap URI). |
List<Variant> |
getVariants()
Returns a modifiable list of exposed variants for the current request method. |
protected List<Variant> |
getVariants(Method method)
Returns the list of variants for the given method. |
Representation |
handle()
Handles any call to this resource. |
boolean |
isDirectoryTarget()
Indicates if the target resource is a directory. |
boolean |
isFileTarget()
Indicates if the target resource is a file. |
Representation |
put(Representation entity)
Creates or updates a resource with the given representation as new state to be stored. |
void |
setTargetUri(String targetUri)
Sets the context's target URI (file, clap URI). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DirectoryServerResource()
| Method Detail |
|---|
public Representation delete()
throws ResourceException
ServerResourceServerResource.isNegotiated(), otherwise the ServerResource.delete(Variant) method is
invoked.Status.CLIENT_ERROR_METHOD_NOT_ALLOWED.
delete in class ServerResourceResourceException
public void doInit()
throws ResourceException
doInit in class ResourceResourceExceptionResource.init(Context, Request, Response)
protected Representation get()
throws ResourceException
ServerResourceServerResource.isNegotiated()
, otherwise the ServerResource.get(Variant) method is invoked.Status.CLIENT_ERROR_METHOD_NOT_ALLOWED.
get in class ServerResourceResourceExceptionpublic String getBaseName()
protected Restlet getClientDispatcher()
public Directory getDirectory()
protected ReferenceList getDirectoryContent()
public String getDirectoryUri()
protected Response getRepresentation(String resourceUri,
MediaType acceptedMediaType)
resourceUri - The URI of the target resource.acceptedMediaType - The accepted media type or null.
public String getTargetUri()
public List<Variant> getVariants()
ServerResource
getVariants in class ServerResourceprotected List<Variant> getVariants(Method method)
getVariants in class ServerResourcemethod - The related method.
public Representation handle()
ServerResourceServerResource.isConditional() and ServerResource.isNegotiated() method to determine
which one of the ServerResource.doConditionalHandle(),
ServerResource.doNegotiatedHandle() and ServerResource.doHandle() methods should be
invoked. It also catches any ResourceException thrown and updates
the response status using the
ServerResource.setStatus(Status, Throwable, String) method.Status.CLIENT_ERROR_METHOD_NOT_ALLOWED, then
ServerResource.updateAllowedMethods() is invoked to give the resource a chance
to inform the client about the allowed methods.
handle in class ServerResourcepublic boolean isDirectoryTarget()
public boolean isFileTarget()
public Representation put(Representation entity)
throws ResourceException
ServerResourceServerResource.isNegotiated(), otherwise the
ServerResource.put(Representation, Variant) method is invoked.Status.CLIENT_ERROR_METHOD_NOT_ALLOWED.
put in class ServerResourceentity - The representation to store.
ResourceExceptionpublic void setTargetUri(String targetUri)
targetUri - The context's target URI.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||