Class UploadRequest

java.lang.Object
com.iizix.prop.upload.UploadRequest

public final class UploadRequest extends Object
One request of a client to upload files: what the client declared - the files with their names, types and sizes, its sequence number, the automatic failure notice switch and the types the requester accepts - and where it came from (design UPLOAD-UI-DESIGN.md edition 2, section 2.2; built by CC-UPLOAD-U1).

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 Type
    Method
    Description
    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.
    int
    Gets the client's sequence number: the number the client's uploader allocated for this request and correlates the RESERVED answer by.
    Gets the property that asked: the component whose own remote event carried the request.
    Gets the types the requester accepts, in the syntax of the HTML accept attribute: comma-separated media types (image/png), families (image/*) and file name extensions (.pdf).
    boolean
    Checks if the request has been answered.
    boolean
    Checks whether the client wants the automatic failure notice for this request (row 20 of the rulings of 2026-09-24): on by default.
    boolean
    Claims the one answer of this request.
    Outputs to string, without the file names (they are client-supplied and may be hostile to logs).

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • getSequence

      public int getSequence()
      Gets the client's sequence number: the number the client's uploader allocated for this request and correlates the RESERVED answer by.
      Returns:
      The sequence number, -1 when the client sent none.
    • getFiles

      public List<UploadFileRequest> 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

      public String getTypes()
      Gets the types the requester accepts, in the syntax of the HTML accept attribute: comma-separated media types (image/png), families (image/*) and file name extensions (.pdf). They narrow the server's $upload.types for the reservation made from this request, at reservation and again on the verified type.
      Returns:
      The types, empty for any; never null.
    • getSource

      public GProp<?> getSource()
      Gets the property that asked: the component whose own remote event carried the request.
      Returns:
      The requesting property, or null for a direct RESERVE on 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

      public String toString()
      Outputs to string, without the file names (they are client-supplied and may be hostile to logs).
      Overrides:
      toString in class Object