@RestResource(title="File System Explorer", messages="nls/DirectoryResource", allowedMethodParams="*") @HtmlDocConfig(navlinks={"up: request:/..","options: servlet:/?method=OPTIONS"}) @HtmlConfig(uriAnchorText="PROPERTY_NAME") public class DirectoryResource extends BasicRestServlet
The root directory is specified in one of two ways:
getRootDir()
method.
Read/write access control is handled through the following properties:
Modifier and Type | Class and Description |
---|---|
static class |
DirectoryResource.Action |
class |
DirectoryResource.FileResource |
Modifier and Type | Field and Description |
---|---|
static String |
DIRECTORY_RESOURCE_allowDeletes
Configuration property: Allow deletes on files.
|
static String |
DIRECTORY_RESOURCE_allowUploads
Configuration property: Allow uploads on files.
|
static String |
DIRECTORY_RESOURCE_allowViews
Configuration property: Allow view and downloads on files.
|
static String |
DIRECTORY_RESOURCE_rootDir
Configuration property: Root directory.
|
Constructor and Description |
---|
DirectoryResource() |
Modifier and Type | Method and Description |
---|---|
org.apache.juneau.microservice.resources.DirectoryResource.RedirectToRoot |
deleteFile(String path) |
org.apache.juneau.microservice.resources.DirectoryResource.FileContents |
downloadFile(RestResponse res,
String path) |
DirectoryResource.FileResource |
getFile(RestRequest req,
String path) |
protected File |
getRootDir()
Returns the root directory.
|
void |
init(RestContextBuilder b) |
org.apache.juneau.microservice.resources.DirectoryResource.RedirectToRoot |
updateFile(InputStream is,
String path) |
org.apache.juneau.microservice.resources.DirectoryResource.FileContents |
viewFile(RestResponse res,
String path) |
getOptions
destroy, getContext, getPath, getProperties, getRequest, getResponse, getServletConfig, init, log, log, log, log, logObjects, service, setContext, setRestResourceResolver
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
getInitParameter, getInitParameterNames, getServletContext, getServletInfo, getServletName, init
public static final String DIRECTORY_RESOURCE_rootDir
public static final String DIRECTORY_RESOURCE_allowViews
public static final String DIRECTORY_RESOURCE_allowDeletes
public static final String DIRECTORY_RESOURCE_allowUploads
public DirectoryResource()
@RestHook(value=INIT) public void init(RestContextBuilder b) throws Exception
Exception
@RestMethod(name="GET", path="/*", summary="View information on file or directory", description="Returns information about the specified file or directory.") @HtmlDocConfig(nav="<h5>Folder: $RA{fullPath}</h5>") public DirectoryResource.FileResource getFile(RestRequest req, @Path(value="/*") String path) throws NotFound, Exception
@RestMethod(name="VIEW", path="/*", summary="View contents of file", description="View the contents of a file.\nContent-Type is set to \'text/plain\'.") public org.apache.juneau.microservice.resources.DirectoryResource.FileContents viewFile(RestResponse res, @Path(value="/*") String path) throws NotFound, MethodNotAllowed
NotFound
MethodNotAllowed
@RestMethod(name="DOWNLOAD", path="/*", summary="Download file", description="Download the contents of a file.\nContent-Type is set to \'application/octet-stream\'.") public org.apache.juneau.microservice.resources.DirectoryResource.FileContents downloadFile(RestResponse res, @Path(value="/*") String path) throws NotFound, MethodNotAllowed
NotFound
MethodNotAllowed
@RestMethod(name="DELETE", path="/*", summary="Delete file", description="Delete a file on the file system.") public org.apache.juneau.microservice.resources.DirectoryResource.RedirectToRoot deleteFile(@Path(value="/*") String path) throws MethodNotAllowed
MethodNotAllowed
@RestMethod(name="PUT", path="/*", summary="Add or replace file", description="Add or overwrite a file on the file system.") public org.apache.juneau.microservice.resources.DirectoryResource.RedirectToRoot updateFile(@Body(schema=@Schema(type="string",format="binary")) InputStream is, @Path(value="/*") String path) throws InternalServerError
InternalServerError
protected File getRootDir()
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.