90.8. 삽입(upload) 작업
Dropbox에 파일을 업로드합니다.
Camel 생산자로 작동합니다.
다음은 이 작업에 대한 옵션 목록입니다.
속성 | 필수 | 설명 |
---|---|---|
|
| add or force this option specifies how a file should be saved on dropbox: in case of "add" the new file will be renamed if a file with the same name already exists on dropbox. 같은 이름의 파일이 dropbox에 이미 존재하는 경우 이 파일을 덮어씁니다. |
|
| 로컬 파일 시스템에서 Dropbox에 업로드할 폴더 또는 파일입니다. 이 옵션을 구성한 경우 Camel 메시지 본문의 콘텐츠가 포함된 단일 파일로 업로드하는 것보다 우선합니다(메시지 본문이 바이트 배열로 변환됨). |
|
| Dropbox의 폴더 대상. 속성이 설정되지 않은 경우 구성 요소는 로컬 경로와 동일한 원격 경로에 파일을 업로드합니다. Windows 또는 절대 localPath가 없는 경우 다음과 같은 예외로 실행할 수 있습니다.
java.lang.IllegalArgumentException: 'path': bad path: "/": "C:/My/File" |
90.8.1. 샘플
from("direct:start").to("dropbox://put?accessToken=XXX&clientIdentifier=XXX&uploadMode=add&localPath=/root/folder1") .to("mock:result"); from("direct:start").to("dropbox://put?accessToken=XXX&clientIdentifier=XXX&uploadMode=add&localPath=/root/folder1&remotePath=/root/folder2") .to("mock:result");
및 메시지 본문의 콘텐츠가 포함된 단일 파일을 업로드
from("direct:start") .setHeader(DropboxConstants.HEADER_PUT_FILE_NAME, constant("myfile.txt")) .to("dropbox://put?accessToken=XXX&clientIdentifier=XXX&uploadMode=add&remotePath=/root/folder2") .to("mock:result");
파일 이름은 우선 순위에 따라 DropboxConstants.HEADER_PUT_PUT_FILE_NAME
또는 Exchange.FILE_NAME
헤더에 제공될 수 있습니다. 헤더가 제공되지 않으면 메시지 id(uuid)가 파일 이름으로 사용됩니다.