Created
July 2, 2019 08:28
-
-
Save monodot/126cea756fda9fd13f8a6c1f67cd44d0 to your computer and use it in GitHub Desktop.
Example Camel route for uploading some content with a filename
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test using: | |
// curl -v -X PUT -H "filename: myfile.txt" -H "Content-Type: text/plain" -d "hello12345" http://localhost:8080/services/upload | |
rest("/upload") | |
.description("File upload service") | |
.consumes("text/plain") | |
.put().description("Upload a file") | |
.outType(String.class) | |
.param().name("filename") | |
.type(RestParamType.header) | |
.description("The filename of the new file") | |
.dataType("string") | |
.endParam() | |
.responseMessage().code(200).message("Upload OK").endResponseMessage() | |
.route() | |
.to("log:mylogger?showAll=true") | |
.to("file:target/output?fileName=${header.filename}"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment