Skip to content

Instantly share code, notes, and snippets.

@cjvirtucio87
Created March 22, 2017 02:44
Show Gist options
  • Save cjvirtucio87/62a01404fa01cac6c85df9f1679312b2 to your computer and use it in GitHub Desktop.
Save cjvirtucio87/62a01404fa01cac6c85df9f1679312b2 to your computer and use it in GitHub Desktop.
@Controller
public class Uploads {
// ...
@RequestMapping(value="/uploads", method={ RequestMethod.HEAD })
public ResponseEntity<?> headUploads(
@RequestHeader(value="Upload-Metadata") String meta,
@RequestHeader(value="Tus-Resumable") String ver
) {
// ...
}
@RequestMapping(value="/uploads", method={ RequestMethod.POST })
public ResponseEntity<?> postUploads(
@RequestHeader(value="Content-Length") Long conLen,
@RequestHeader(value="Upload-Length") Long upLen,
@RequestHeader(value="Upload-Metadata") String meta,
@RequestHeader(value="Tus-Resumable") String ver
) {
// ...
}
@RequestMapping(value="/uploads/{id}", method={ RequestMethod.PATCH })
public ResponseEntity<?> patchUpload(
@RequestHeader(value="Content-Length") Long conLen,
@RequestHeader(value="Upload-Length") Long upLen,
@RequestHeader(value="Upload-Offset") Long upOff,
@RequestHeader(value="Upload-Metadata") String meta,
@RequestHeader(value="Tus-Resumable") String ver,
HttpServletRequest req
) {
// You'll be streaming the data from the request into your file using one of Java's many I/O libraries.
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment