Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.mpilone:html5-upload-vaadin:v1.4.6'
}
dependencies {
implementation("com.github.mpilone:html5-upload-vaadin:v1.4.6")
}
<dependency>
<groupId>com.github.mpilone</groupId>
<artifactId>html5-upload-vaadin</artifactId>
<version>v1.4.6</version>
</dependency>
libraryDependencies += "com.github.mpilone" % "html5-upload-vaadin" % "v1.4.6"
:dependencies [[com.github.mpilone/html5-upload-vaadin "v1.4.6"]]
Vaadin components for multiple HTML5 upload libraries including the Plupload HTML5/Flash/Silverlight/HTML4 and the FineUploader HTML5/HTML4 JavaScript libraries. The components attempt to implement an API that is extremely similar to the standard Vaadin Upload component so it should require relatively few changes to swap between the implementations.
The component implementations make use of a core support library which can be reused for other implementations of HTML5 uploders. The primary class in the library is a custom file request handler that makes use of Apache Commons FileUpload for fast, reliable multi-part upload handling.
The choice of which HTML5 upload component to use will come down to feature set, licensing concerns, and browser support. Currently the features exposed from each of the libraries is roughly equivalent; however licensing costs, communities, and support options vary greatly between the components.
NOTE: While this Vaadin component is free to use (see LICENSE.txt), you are responsible for properly licensing the underlying JavaScript libraries based on the license requirements for the specific component used. This Java component in no way grants or implies a license from the original JavaScript library authors.
Plupload upload = new Plupload();
upload.setMaxFileSize(500 * 1024 * 1024);
upload.setButtonCaption("Upload File");
upload.setReceiver(new MyReceiverImpl());
// New features supported by HTML5 uploader.
upload.setChunkSize(256 * 1024);
upload.setMaxRetries(2);
upload.addStartedListener(new Plupload.StartedListener() {
@Override
public void uploadStarted(Plupload.StartedEvent evt) {
// ...
}
});
upload.addSucceededListener(new Plupload.SucceededListener() {
@Override
public void uploadSucceeded(Plupload.SucceededEvent evt) {
// ...
}
});
upload.addFailedListener(new Plupload.FailedListener() {
@Override
public void uploadFailed(Plupload.FailedEvent evt) {
// ...
}
});
FineUploader upload = new FineUploader();
upload.setMaxFileSize(500 * 1024 * 1024);
upload.setButtonCaption("Upload File");
upload.setReceiver(new MyReceiverImpl());
// New features supported by HTML5 uploader.
upload.setChunkSize(256 * 1024);
upload.setMaxRetries(2);
upload.addStartedListener(new FineUploader.StartedListener() {
@Override
public void uploadStarted(FineUploader.StartedEvent evt) {
// ...
}
});
upload.addSucceededListener(new FineUploader.SucceededListener() {
@Override
public void uploadSucceeded(FineUploader.SucceededEvent evt) {
// ...
}
});
upload.addFailedListener(new FineUploader.FailedListener() {
@Override
public void uploadFailed(FineUploader.FailedEvent evt) {
// ...
}
});