Class UploadRequest
An App can hold one and never make one (ruling UD-5): the constructor is package-private, and the only way to an instance is UploadChannelProps.decodeRequest(com.iizix.prop.PropCnr,GProp), which builds it from the parameters of a client's remote event. A reservation therefore only ever answers a request a client made, with the sequence number that client is waiting for.
A request is answered once: by IClientUploadAPI.reserve(UploadRequest,IFileUploadListener) or by IClientUploadAPI.refuse(UploadRequest,String), either of which sends the client ONE RESERVED carrying getSequence(). The API claims the answer through markAnswered(); a second answer is refused there.
Immutable apart from the answered flag, and safe to hand between threads.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptiongetFiles()Gets the files the client declares, in the client's order: the file index of a reservation made from this request is the position in this list.intGets the client's sequence number: the number the client's uploader allocated for this request and correlates theRESERVEDanswer by.GProp<?> Gets the property that asked: the component whose own remote event carried the request.getTypes()Gets the types the requester accepts, in the syntax of the HTMLacceptattribute: comma-separated media types (image/png), families (image/*) and file name extensions (.pdf).booleanChecks if the request has been answered.booleanChecks whether the client wants the automatic failure notice for this request (row 20 of the rulings of 2026-09-24): on by default.booleanClaims the one answer of this request.toString()Outputs to string, without the file names (they are client-supplied and may be hostile to logs).withDeclaredType(int index, String type) Gets this request with a media type declared for a file the client declared none for.
Method Details
withDeclaredType
Gets this request with a media type declared for a file the client declared none for. The requester - a component that takes a file by the end of its name (photo.PNGthat the Browser gave no type) - states the type it took the file as, so that the reservation is made for that type and the content is verified as that type. A type the client declared is never replaced.The returned request is the same request to the client: it carries the same sequence number and shares the one answer with this one, whichever of the two is answered.
- Parameters:
index- The index of the file ingetFiles().type- The media type, e.g.image/png.- Returns:
- The request with that file declared as the type.
- Throws:
IndexOutOfBoundsException- If there is no file of that index.IllegalArgumentException- If the type is null or blank, or the client declared a type for the file.
getSequence
public int getSequence()Gets the client's sequence number: the number the client's uploader allocated for this request and correlates theRESERVEDanswer by.- Returns:
- The sequence number, -1 when the client sent none.
getFiles
Gets the files the client declares, in the client's order: the file index of a reservation made from this request is the position in this list.- Returns:
- The files, at least one, unmodifiable.
isNoticeEnabled
public boolean isNoticeEnabled()Checks whether the client wants the automatic failure notice for this request (row 20 of the rulings of 2026-09-24): on by default.- Returns:
- true when failures are to be shown by IIZI, false when the App reports them itself.
getTypes
Gets the types the requester accepts, in the syntax of the HTMLacceptattribute: comma-separated media types (image/png), families (image/*) and file name extensions (.pdf). They narrow the server's$upload.typesfor the reservation made from this request, at reservation and again on the verified type.- Returns:
- The types, empty for any; never null.
getSource
Gets the property that asked: the component whose own remote event carried the request.- Returns:
- The requesting property, or null for a direct
RESERVEon the upload channel.
isAnswered
public boolean isAnswered()Checks if the request has been answered.- Returns:
- true once
markAnswered()has been called.
markAnswered
public boolean markAnswered()Claims the one answer of this request. Called by the upload API of the client session before it reserves or refuses; an App never needs to call it, and one that does can no longer have its request answered.- Returns:
- true for the first caller, false when the request was already answered.
toString