Skip to content

Commit

Permalink
feat: 1.0.0-2.1-SNAPSHOT release
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdesair committed Jul 22, 2023
1 parent f125556 commit fb61e11
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# tus-java-server
This library can be used to enable resumable (and potentially asynchronous) file uploads in any Java web application. This allows the users of your application to upload large files over slow and unreliable internet connections. The ability to pause or resume a file upload (after a connection loss or reset) is achieved by implementing the open file upload protocol tus (https://tus.io/). This library implements the server-side of the tus v1.0.0 protocol with [all optional extensions](#tus-protocol-extensions).

The Javadoc of this library can be found at https://tus.desair.me/. The following Java versions are supported: 7, 8, 9, 10 and 11.
The Javadoc of this library can be found at https://tus.desair.me/. The following Java versions are supported: 8, 9, 10 and 11.

## Quick Start and Examples
The tus-java-server library only depends on Java Servlet API 3.1 and some Apache Commons utility libraries. This means that (in theory) you can use this library on any modern Java Web Application server like Tomcat, JBoss, Jetty... By default all uploaded data and information is stored on the file system of the application server (and currently this is the only option, see [configuration section](#usage-and-configuration)).
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>me.desair.tus</groupId>
<artifactId>tus-java-server</artifactId>
<version>1.0.0-2.1</version>
<version>1.0.0-2.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand All @@ -17,8 +17,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
Expand Down Expand Up @@ -448,7 +448,7 @@

<scm>
<connection>scm:git:https://github.com/tomdesair/tus-java-server.git</connection>
<developerConnection>scm:git:ssh://github.com:tomdesair/tus-java-server.git</developerConnection>
<developerConnection>scm:git:ssh://git@github.com/tomdesair/tus-java-server.git</developerConnection>
<url>https://github.com/tomdesair/tus-java-server/tree/master</url>
</scm>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* concatenation has been successfully finished. After successful concatenation, the Upload-Offset and
* Upload-Length MUST be set and their values MUST be equal. The value of the Upload-Offset header before
* concatenation is not defined for a upload.
* <p/>
* <br>
* The response to a HEAD request for a partial upload MUST contain the Upload-Offset header. Response to HEAD
* request against partial or upload MUST include the Upload-Concat header and its value as received in
* the upload creation request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import me.desair.tus.server.util.TusServletResponse;

/** A HEAD request is used to determine the offset at which the upload should be continued.
* <p/>
* <br>
* The Server MUST always include the Upload-Offset header in the response for a HEAD request,
* even if the offset is 0, or the upload is already considered completed. If the size of the upload is known,
* the Server MUST include the Upload-Length header in the response.
* <p/>
* <br>
* The Server MUST prevent the client and/or proxies from caching the response by adding
* the Cache-Control: no-store header to the response.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* The Server SHOULD accept PATCH requests against any upload URL and apply the bytes contained in the message at
* the given offset specified by the Upload-Offset header.
* <p/>
* <br>
* The Server MUST acknowledge successful PATCH requests with the 204 No Content status. It MUST include the
* Upload-Offset header containing the new offset. The new offset MUST be the sum of the offset before the PATCH
* request and the number of bytes received and processed or stored during the current PATCH request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
import org.apache.commons.lang3.StringUtils;

/** Class that will validate if the tus version in the request corresponds to our implementation version
* <p/>
* <br>
* The Tus-Resumable header MUST be included in every request and response except for OPTIONS requests.
* The value MUST be the version of the protocol used by the Client or the Server.
* If the the version specified by the Client is not supported by the Server, it MUST respond with the
* 412 Precondition Failed status and MUST include the Tus-Version header into the response.
* In addition, the Server MUST NOT process the request.
* <p/>
* <br>
* (https://tus.io/protocols/resumable-upload.html#tus-resumable)
*/
public class TusResumableValidator implements RequestValidator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import me.desair.tus.server.util.TusServletResponse;

/** A HEAD request can be used to retrieve the metadata that was supplied at creation.
* <p/>
* <br>
* If an upload contains additional metadata, responses to HEAD requests MUST include the Upload-Metadata
* header and its value as specified by the Client during the creation.
* <p/>
* <br>
* As long as the length of the upload is not known, the Server MUST set Upload-Defer-Length: 1 in
* all responses to HEAD requests.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* The Client and the Server SHOULD implement the upload creation extension.
* If the Server supports this extension, it MUST add creation to the Tus-Extension header.
* <p/>
* <br>
* If the Server supports deferring length, it MUST add creation-defer-length to the Tus-Extension header.
*/
public class CreationOptionsRequestHandler extends AbstractExtensionRequestHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import javax.servlet.http.HttpServletResponse;

/** Exception thrown when receiving a request with a tus protocol version we do not support
* <p/>
* <br>
* The Tus-Resumable header MUST be included in every request and response except for OPTIONS requests.
* The value MUST be the version of the protocol used by the Client or the Server.
* If the the version specified by the Client is not supported by the Server, it MUST respond with the
* 412 Precondition Failed status and MUST include the Tus-Version header into the response.
* In addition, the Server MUST NOT process the request.
* <p/>
* <br>
* (https://tus.io/protocols/resumable-upload.html#tus-resumable)
*/
public class InvalidTusResumableException extends TusException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.servlet.http.HttpServletResponse;

/** Exception thrown when the given upload ID was not found
* <p/>
* <br>
* If the resource is not found, the Server SHOULD return either the
* 404 Not Found, 410 Gone or 403 Forbidden status without the Upload-Offset header.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* This extension defines a way for the Client to terminate completed and unfinished
* uploads allowing the Server to free up used resources.
* <p/>
* <br>
* If this extension is supported by the Server, it MUST be announced by adding "termination"
* to the Tus-Extension header.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public String getUploadURI() {

/**
* Read the upload identifier from the given URL.
* <p/>
* <br>
* Clients will send requests to upload URLs or provided URLs of completed uploads. This method is able to
* parse those URLs and provide the user with the corresponding upload ID.
*
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/me/desair/tus/server/upload/UploadInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public String getEncodedMetadata() {
* Set the encoded Tus metadata string as it was provided by the Tus client at creation of the upload.
* The encoded metadata string consists of one or more comma-separated key-value pairs where the key is
* ASCII encoded and the value Base64 encoded. See https://tus.io/protocols/resumable-upload.html#upload-metadata
* @return The encoded metadata string as received from the client
*/
public void setEncodedMetadata(String encodedMetadata) {
this.encodedMetadata = encodedMetadata;
Expand Down Expand Up @@ -296,7 +295,7 @@ public String getUploadConcatHeaderValue() {
/**
* Try to guess the filename of the uploaded data. If we cannot guess the name
* we fall back to the ID.
* <p/>
* <br>
* NOTE: This is only a guess, there are no guarantees that the return value is correct
*
* @return A potential file name
Expand All @@ -314,7 +313,7 @@ public String getFileName() {

/**
* Try to guess the mime-type of the uploaded data.
* <p/>
* <br>
* NOTE: This is only a guess, there are no guarantees that the return value is correct
*
* @return A potential file name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface UploadLockingService {

/**
* Clean up any stale locks that are still present
* @throws TusException When cleaning a stale lock fails
* @throws IOException When cleaning a stale lock fails
*/
void cleanupStaleLocks() throws IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

/**
* {@link UploadLockingService} implementation that uses the file system for implementing locking
* <p/>
* <br>
* File locking can also apply to shared network drives. This way the framework supports clustering as long as
* the upload storage directory is mounted as a shared (network) drive.
* <p/>
* <br>
* File locks are also automatically released on application (JVM) shutdown. This means the file locking is not
* persistent and prevents cleanup and stale lock issues.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Upload locking implementation using the file system file locking mechanism.
* File locking can also apply to shared network drives. This way the framework supports clustering as long as
* the upload storage directory is mounted as a shared (network) drive.
* <p/>
* <br>
* File locks are also automatically released on application (JVM) shutdown. This means the file locking is not
* persistent and prevents cleanup and stale lock issues.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Transparently coalesces chunks of a HTTP stream that uses Transfer-Encoding chunked.
* This {@link InputStream} wrapper also supports collecting Trailer header values that are
* sent at the end of the stream.
* <p/>
* <br>
* Based on org.apache.commons.httpclient.ChunkedInputStream
*/
public class HttpChunkedEncodingInputStream extends InputStream {
Expand Down Expand Up @@ -48,7 +48,7 @@ public class HttpChunkedEncodingInputStream extends InputStream {
/**
* Wrap the given input stream and store any trailing headers in the provided map.
* @param in the raw input stream
* @param trailerHeaders Map to store any trailer header values. Can be <tt>null</tt>.
* @param trailerHeaders Map to store any trailer header values. Can be <b>null</b>.
*/
public HttpChunkedEncodingInputStream(
InputStream in, Map<String, List<String>> trailerHeaders) {
Expand Down

0 comments on commit fb61e11

Please sign in to comment.