Class DirectoryResource
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.juneau.rest.servlet.RestServlet
org.apache.juneau.rest.servlet.BasicRestServlet
org.apache.juneau.microservice.resources.DirectoryResource
- All Implemented Interfaces:
- jakarta.servlet.Servlet,- jakarta.servlet.ServletConfig,- Serializable,- BasicUniversalConfig,- DefaultConfig,- DefaultHtmlConfig,- BasicRestOperations
REST resource that allows access to a file system directory.
 
The root directory is specified in one of two ways:
- 
      Specifying the location via a DirectoryResource.rootDir property.
- 
      Overriding the getRootDir()method.
Read/write access control is handled through the following properties:
- 
      DirectoryResource.allowViews - Iftrue , allows view and download access to files.
- 
      DirectoryResource.allowUploads - Iftrue , allows files to be created or overwritten.
- 
      DirectoryResource.allowDeletes - Iftrue , allows files to be deleted.
See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classclass
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringAllow deletes on files.static final StringAllow uploads on files.static final StringAllow view and downloads on files.static final StringRoot directory.Fields inherited from class jakarta.servlet.http.HttpServletLEGACY_DO_HEAD
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionorg.apache.juneau.microservice.resources.DirectoryResource.RedirectToRootdeleteFile(String path) org.apache.juneau.microservice.resources.DirectoryResource.FileContentsdownloadFile(RestResponse res, String path) getFile(RestRequest req, String path) protected FileReturns the root directory.org.apache.juneau.microservice.resources.DirectoryResource.RedirectToRootupdateFile(InputStream is, String path) org.apache.juneau.microservice.resources.DirectoryResource.FileContentsviewFile(RestResponse res, String path) Methods inherited from class org.apache.juneau.rest.servlet.BasicRestServleterror, getFavIcon, getHtdoc, getStats, getSwaggerMethods inherited from class org.apache.juneau.rest.servlet.RestServletdestroy, doLog, getContext, getPath, getRequest, getResponse, init, log, log, service, setContextMethods inherited from class jakarta.servlet.http.HttpServletdoDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, isSensitiveHeader, serviceMethods inherited from class jakarta.servlet.GenericServletgetInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
- 
Field Details- 
DIRECTORY_RESOURCE_rootDirRoot directory.- See Also:
 
- 
DIRECTORY_RESOURCE_allowViewsAllow view and downloads on files.- See Also:
 
- 
DIRECTORY_RESOURCE_allowDeletesAllow deletes on files.- See Also:
 
- 
DIRECTORY_RESOURCE_allowUploadsAllow uploads on files.- See Also:
 
 
- 
- 
Constructor Details- 
DirectoryResource- Throws:
- Exception
 
 
- 
- 
Method Details- 
getFilepublic DirectoryResource.FileResource getFile(RestRequest req, @Path("/*") String path) throws NotFound, Exception 
- 
viewFilepublic org.apache.juneau.microservice.resources.DirectoryResource.FileContents viewFile(RestResponse res, @Path("/*") String path) throws NotFound, MethodNotAllowed - Throws:
- NotFound
- MethodNotAllowed
 
- 
downloadFilepublic org.apache.juneau.microservice.resources.DirectoryResource.FileContents downloadFile(RestResponse res, @Path("/*") String path) throws NotFound, MethodNotAllowed - Throws:
- NotFound
- MethodNotAllowed
 
- 
deleteFilepublic org.apache.juneau.microservice.resources.DirectoryResource.RedirectToRoot deleteFile(@Path("/*") String path) throws MethodNotAllowed - Throws:
- MethodNotAllowed
 
- 
updateFilepublic org.apache.juneau.microservice.resources.DirectoryResource.RedirectToRoot updateFile(@Content @Schema(type="string",format="binary") InputStream is, @Path("/*") String path) throws InternalServerError - Throws:
- InternalServerError
 
- 
getRootDirReturns the root directory.- Returns:
- The root directory.
 
 
-