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.
|
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).
|
abort, commit, delete, describeVariants, doCatch, doConditionalHandle, doError, doHandle, doHandle, doNegotiatedHandle, get, getAttribute, getInfo, getInfo, getOnSent, getPreferredVariant, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, options, post, post, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDimensions, setExisting, setLocationRef, setLocationRef, 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, toObject, toRepresentation, toString
public Representation delete() throws ResourceException
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)
protected Representation get() throws ResourceException
ServerResource
ServerResource.isNegotiated()
, otherwise the ServerResource.get(Variant)
method is invoked.Status.CLIENT_ERROR_METHOD_NOT_ALLOWED
.get
in class ServerResource
ResourceException
public 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 ServerResource
protected List<Variant> getVariants(Method method)
getVariants
in class ServerResource
method
- The related method.public Representation handle()
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
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(String targetUri)
targetUri
- The context's target URI.Copyright © 2005–2015. All rights reserved.