Small Java web server demo based on Dropwizard that uses the tus-java-server library and the Uppy file uploader to support the tus file upload protocol. This allows you to support resumable and asynchronous file uploads in a Dropwizard web application for very large files over slow and unreliable internet connections.
To build and run this demo, execute the following commands:
$ git clone https://github.com/tomdesair/tus-java-server-dropwizard-demo.git
$ cd tus-java-server-dropwizard-demo
$ mvn clean package
$ java -jar target/dropwizard-tus-demo-0.0.1-SNAPSHOT.jar server
Then visit http://localhost:8080/ in your browser and try to upload a file using the Uppy file uploader.
This Dropwizard demo also supports the following CLI commands:
java -jar target/dropwizard-tus-demo-0.0.1-SNAPSHOT.jar clean-uploads
: Clean up any expired uploads from the storage backend.java -jar target/dropwizard-tus-demo-0.0.1-SNAPSHOT.jar upload -f "path-to-file"
: Upload the specified file to the server using thetus-java-client
library. This command is mainly for testing purposes.
To help you in understanding this code, this are the most important classes and files:
TusUploadResource
: This class makes the/api/upload
endpoint available and passes all requests to theTusFileUploadService
from the tus-java-server library.TusFileUploadApplication
: This class instantiates all endpoints and commands and builds theTusFileUploadService
based on the given configuration.assets\js\uppy-fileupload.js
: This file contains the configuration of the JavaScript tus client Uppy.IndexResource
: This class will load the main form and processes the submitted information and uploaded files.TusEndpointHealthCheck
: Dropwizard health check class that does a basic check to see if the tus upload endpoint is functioning properly.me.desair.dropwizard.cli
: Package that contains the classes that implement the above mentioned CLI commands.