Table below provides a quick summary for the configuration options:
DocumentsClientConfiguration
:
Property | Type | Default Value | Required | Description |
---|---|---|---|---|
server | String | http://localhost:2020 | Yes* | Server URL |
files | FilesConfiguration | Files Configuration | ||
local | Boolean | False | Enable App Local File System Access | |
localRoot | Boolean | /data | False | Virtual Root Folder for Local System |
FilesConfiguration
:
Property | Type | Default Value | Required | Description |
---|---|---|---|---|
root | String | /.upload/ | Yes* | Root folder for uploaded files |
tmp | String | /.tmp/ | Folder for uploaded temporary files | |
locations | Map<String, String> | No | Map for App defined keys to default file locations | |
folders | Map<String, String> | No | Map for App defined folders to default file locations | |
exts | Map<String, List<String>> | No | @Deprecated | |
useTmpFor | Map<String, Boolean> | No | @Deprecated |
documents:
server: http://documents.mydomain.com
root: "/.upload/myapp"
@Autowired
private DocumentsClient client;
private URI writeDocument(String path, String content) {
Document document = new Document()
.withPath(path)
.withInfo("My File...")
.withInputStream(new ByteArrayInputStream(content.getBytes()))
.withContentLength((long)content.length());
URI uri = client.write(document, null, null);
assertNotNull(uri);
return uri;
public Map<String, Object> readFavoritesFileForPrincipal(String path) {
final String FAVORITES_PATH = "/.myapp/favorites.json";
Document document = client.read(FAVORITES_PATH, DocumentOptions.CONTENT_AND_META, null);
return MappingUtils.fromJson(document2.getOrReadContent(), Map.class);
}
final String TMP_PATH = "/tmp/.myapp";
public Map<String, Object> deleteTmpFiles() {
client.delete(TMP_PATH, DocumentOptions.FORCE, null);
}
This section describes the REST endpoints automatically setup the the einnovator-documents-starter.
Table below provides a quick summary:
DocumentRestController
:
Method | Path | Query Parameters | Request Body | Response Body | Status | Log | Security | Description |
---|---|---|---|---|---|---|---|---|
GET | /api/__/** | DocumentFilter PageOptions | Document[] (JSON) | OK | list | List files in Folder | ||
GET | /api/_/** | DocumentOptions | OK NOT_FOUND | download | Download Document Content | |||
GET | /api/_meta/** | DocumentOptions | Document (JSON) | OK NOT_FOUND | meta | Get Document Meta data | ||
POST | /api/__/** | DocumentOptions | CREATED | mkdir | Make new Folder | |||
DELETE | /api/__/** | DocumentOptions | NO_CONTENT | delete | Delete Document (file or folder) |
FileUploadController
:
Method | Path | Query Parameters | Request Body | Response Body | Status | Log | Security | Description |
---|---|---|---|---|---|---|---|---|
POST | DocumentOptions | /upload /_upload /api/upload /api/_upload | Multipart{Document Meta, Content} | CREATED | upload | Upload Document with Content and Meta-Data |
Comments and Discussion