public class UploadInfo extends Object implements Serializable
| Constructor and Description |
|---|
UploadInfo()
Default constructor to use if an upload is created without HTTP request
|
UploadInfo(javax.servlet.http.HttpServletRequest servletRequest)
Constructor to use if the upload is created using an HTTP request (which is usually the case)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
List<String> |
getConcatenationPartIds()
Get the list of upload identifiers of which this upload is composed of.
|
Long |
getCreationTimestamp()
The timestamp this upload was created in number of milliseconds since January 1, 1970, 00:00:00 GMT
|
String |
getCreatorIpAddresses()
Get the ip-addresses that were involved when this upload was created.
|
protected long |
getCurrentTime()
Get the current time in the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
String |
getEncodedMetadata()
Get the encoded Tus metadata string as it was provided by the Tus client at creation of the upload.
|
Long |
getExpirationTimestamp()
Indicates the timestamp after which the upload expires in milliseconds since January 1, 1970, 00:00:00 GMT
|
String |
getFileMimeType()
Try to guess the mime-type of the uploaded data.
|
String |
getFileName()
Try to guess the filename of the uploaded data.
|
UploadId |
getId()
Get the unique identifier of this upload process
The unique identifier is represented by a
UploadId instance |
Long |
getLength()
Get the total length of the byte array that the client wants to upload.
|
Map<String,String> |
getMetadata()
Get the decoded metadata map provided by the client based on the encoded Tus metadata string received on
creation of the upload.
|
Long |
getOffset()
The current byte offset of the bytes that already have been stored for this upload on the server.
|
String |
getOwnerKey()
Get the owner key for this upload.
|
String |
getUploadConcatHeaderValue()
Get the original value of the "Upload-Concat" HTTP header that was provided by the client
|
UploadType |
getUploadType()
Return the type of this upload.
|
int |
hashCode() |
boolean |
hasLength()
Did the client already provide a total upload length?
|
boolean |
hasMetadata()
Did the client provide any metadata when creating this upload?
|
boolean |
isExpired()
Check if this upload is expired
|
boolean |
isUploadInProgress()
An upload is still in progress:
- as long as we did not receive information on the total length (see
getLength())
- the total length does not match the current offset |
void |
setConcatenationPartIds(List<String> concatenationPartIds)
Set the list of upload identifiers of which this upload is composed of.
|
void |
setEncodedMetadata(String encodedMetadata)
Set the encoded Tus metadata string as it was provided by the Tus client at creation of the upload.
|
void |
setId(UploadId id)
Set the unique identifier of this upload process
The unique identifier is represented by a
UploadId instance |
void |
setLength(Long length)
Set the total length of the byte array that the client wants to upload.
|
void |
setOffset(Long offset)
Set the position where the next newly received byte should be stored.
|
void |
setOwnerKey(String ownerKey)
Set the owner key for this upload.
|
void |
setUploadConcatHeaderValue(String uploadConcatHeaderValue)
Set the original value of the "Upload-Concat" HTTP header that was provided by the client
|
void |
setUploadType(UploadType uploadType)
Set the type of this upload.
|
void |
updateExpiration(long expirationPeriod)
Calculate the expiration timestamp based on the provided expiration period.
|
public UploadInfo()
public UploadInfo(javax.servlet.http.HttpServletRequest servletRequest)
servletRequest - The HTTP request that creates the new uploadpublic Long getOffset()
public void setOffset(Long offset)
offset - The offset where the next new byte should be writtenpublic String getEncodedMetadata()
public void setEncodedMetadata(String encodedMetadata)
public Map<String,String> getMetadata()
public boolean hasMetadata()
public Long getLength()
public void setLength(Long length)
length - The number of bytes that the client specified he will uploadpublic boolean hasLength()
public boolean isUploadInProgress()
getLength())
- the total length does not match the current offsetpublic void setId(UploadId id)
UploadId instanceid - The unique identifier to usepublic UploadId getId()
UploadId instancepublic void setOwnerKey(String ownerKey)
ownerKey - The owner key to assign to this uploadpublic String getOwnerKey()
public Long getExpirationTimestamp()
public void updateExpiration(long expirationPeriod)
expirationPeriod - The period the upload should remain validpublic Long getCreationTimestamp()
public String getCreatorIpAddresses()
public UploadType getUploadType()
UploadType.
The type of an upload depends on the Tus concatenation extension:
https://tus.io/protocols/resumable-upload.html#concatenationUploadTypepublic void setUploadType(UploadType uploadType)
UploadType.
The type of an upload depends on the Tus concatenation extension:
https://tus.io/protocols/resumable-upload.html#concatenationuploadType - The type to set on this uploadpublic void setConcatenationPartIds(List<String> concatenationPartIds)
concatenationPartIds - The list of child upload identifierspublic List<String> getConcatenationPartIds()
public void setUploadConcatHeaderValue(String uploadConcatHeaderValue)
uploadConcatHeaderValue - The original value of the "Upload-Concat" HTTP headerpublic String getUploadConcatHeaderValue()
public String getFileName()
public String getFileMimeType()
public boolean isExpired()
protected long getCurrentTime()
Copyright © 2019. All rights reserved.