Skip to content

Instantly share code, notes, and snippets.

@monodot
Created July 2, 2019 08:28
Show Gist options
  • Save monodot/126cea756fda9fd13f8a6c1f67cd44d0 to your computer and use it in GitHub Desktop.
Save monodot/126cea756fda9fd13f8a6c1f67cd44d0 to your computer and use it in GitHub Desktop.
Example Camel route for uploading some content with a filename
// 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