public class DirectoryServerResource extends ServerResource
Constructor and Description |
---|
DirectoryServerResource() |
Modifier and Type | Method and Description |
---|---|
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.
|
java.lang.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.
|
java.lang.String |
getDirectoryUri()
Returns the context's directory URI (file, clap URI).
|
protected Response |
getRepresentation(java.lang.String resourceUri,
MediaType acceptedMediaType)
Returns a representation of the resource at the target URI.
|
java.lang.String |
getTargetUri()
Returns the context's target URI (file, clap URI).
|
java.util.List<Variant> |
getVariants()
Returns a modifiable list of exposed variants for the current request
method.
|
protected java.util.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.
|
void |
preventUpperDirectoryAccess()
Prevent the client from accessing resources in upper directories
|
Representation |
put(Representation entity)
Creates or updates a resource with the given representation as new state
to be stored.
|
void |
setTargetUri(java.lang.String targetUri)
Sets the context's target URI (file, clap URI).
|
abort, commit, delete, describeVariants, doCatch, doConditionalHandle, doError, doHandle, doHandle, doNegotiatedHandle, get, getAttribute, getDescription, getInfo, getInfo, getName, getOnSent, getPreferredVariant, getRole, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, options, patch, patch, post, post, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDescription, setDimensions, setExisting, setLocationRef, setLocationRef, setName, setNegotiated, setOnSent, setProxyChallengeRequests, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensions
doError, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getContext, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toBoolean, toByte, toDouble, toFloat, toInteger, toLong, toObject, toRepresentation, toRepresentation, toRepresentation, toShort, toString
public Representation delete() throws ResourceException
org.restlet.resource.ServerResource
ServerResource.isNegotiated()
, otherwise the
ServerResource.delete(Variant)
method is
invoked.Status.CLIENT_ERROR_METHOD_NOT_ALLOWED
.delete
in class ServerResource
ResourceException
public void doInit() throws ResourceException
doInit
in class Resource
ResourceException
Resource.init(Context, Request, Response)
public void preventUpperDirectoryAccess()
protected Representation get() throws ResourceException
org.restlet.resource.ServerResource
ServerResource.isNegotiated()
, otherwise the ServerResource.get(Variant)
method is invoked.Status.CLIENT_ERROR_METHOD_NOT_ALLOWED
.get
in class ServerResource
ResourceException
public java.lang.String getBaseName()
protected Restlet getClientDispatcher()
public Directory getDirectory()
protected ReferenceList getDirectoryContent()
public java.lang.String getDirectoryUri()
protected Response getRepresentation(java.lang.String resourceUri, MediaType acceptedMediaType)
resourceUri
- The URI of the target resource.acceptedMediaType
- The accepted media type or null.public java.lang.String getTargetUri()
public java.util.List<Variant> getVariants()
org.restlet.resource.ServerResource
getVariants
in class ServerResource
protected java.util.List<Variant> getVariants(Method method)
getVariants
in class ServerResource
method
- The related method.public Representation handle()
org.restlet.resource.ServerResource
ServerResource.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 ServerResource
public boolean isDirectoryTarget()
public boolean isFileTarget()
public Representation put(Representation entity) throws ResourceException
org.restlet.resource.ServerResource
ServerResource.isNegotiated()
, otherwise the ServerResource.put(Representation, Variant)
method
is invoked.Status.CLIENT_ERROR_METHOD_NOT_ALLOWED
.put
in class ServerResource
entity
- The representation to store.ResourceException
public void setTargetUri(java.lang.String targetUri)
targetUri
- The context's target URI.Copyright © 2005-2020 Restlet.