Package me.desair.tus.server.upload
Class UploadIdFactory
java.lang.Object
me.desair.tus.server.upload.UploadIdFactory
- Direct Known Subclasses:
- TimeBasedUploadIdFactory,- UuidUploadIdFactory
Interface for a factory that can create unique upload IDs. This factory can also parse the upload
 identifier from a given upload URL.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract UploadIdcreateId()Create a new unique upload ID.protected abstract SerializablegetIdValueIfValid(String extractedUrlId) Transform the extracted path ID value to a value to use for the upload ID object.Return the URI of the main tus upload endpoint.protected PatternBuild and retrieve the Upload URI regex pattern.readUploadId(String url) Read the upload identifier from the given URL.voidsetUploadUri(String uploadUri) Set the URI under which the main tus upload endpoint is hosted.
- 
Constructor Details- 
UploadIdFactorypublic UploadIdFactory()
 
- 
- 
Method Details- 
setUploadUriSet the URI under which the main tus upload endpoint is hosted. Optionally, this URI may contain regex parameters in order to support endpoints that contain URL parameters, for example /users/[0-9]+/files/upload- Parameters:
- uploadUri- The URI of the main tus upload endpoint
 
- 
getUploadUriReturn the URI of the main tus upload endpoint. Note that this value possibly contains regex parameters.- Returns:
- The URI of the main tus upload endpoint.
 
- 
readUploadIdRead the upload identifier from the given URL.
 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.- Parameters:
- url- The URL provided by the client
- Returns:
- The corresponding Upload identifier
 
- 
createIdCreate a new unique upload ID.- Returns:
- A new unique upload ID
 
- 
getIdValueIfValidTransform the extracted path ID value to a value to use for the upload ID object. If the extracted value is not valid, null is returned- Parameters:
- extractedUrlId- The ID extracted from the URL
- Returns:
- Value to use in the UploadId object, null if the extracted URL value was not valid
 
- 
getUploadUriPatternBuild and retrieve the Upload URI regex pattern.- Returns:
- A (cached) Pattern to match upload URI's
 
 
-