Class ClientSessionUploadChannel
- All Implemented Interfaces:
IClientUploadAPI, UploadChannelProps.IHandler, IUploadClientChannel
IClientUploadAPI, obtained from IClientSessionGyro.getFileUploadAPI()): links the UploadChannelProps the client created under $env to the application session's AppGyroFileUploaderService (CC-UPLOAD-A step A1, FILE-UPLOAD-DESIGN.md section 1.2 amended 2026-09-25; the API and the gate by CC-UPLOAD-U1, UPLOAD-UI-DESIGN.md edition 2 section 2).Four roles in one object, each a translation and nothing more:
- the
IClientUploadAPI: a client'sUploadRequestis reserved with the service, or refused, and answered down the channel with ONERESERVEDcarrying the client's sequence number; - the channel's
UploadChannelProps.IHandler: the client's direct reservation request, cancel and pause notice. A direct request is refuseddeniedunless the App opened the direct route withsetDirectReserve(boolean)(ruling UD-6): nothing but the limits would otherwise stand between any script of the page and the server's disk; - the service's
IUploadClientChannel: the App's pause and resume of a file become remote events 8 and 9 (ruling row 12 of 2026-09-24); - per reservation, the one listener the service calls: completion, failure and cancellation become remote events 4, 5 and 6, so "done" to the client means "the App has it" (design section 1.3), and every event is passed on to the listener given with the reservation (a component) and to the listeners of this client session (UD-7).
A reservation belongs to the application session (design Q1.5) and outlives this client session: after dispose() its events are no longer sent anywhere from here - no client is listening, and the listeners of this client session are gone with it - while the transfer itself continues under whichever client holds the secrets, heard by the service's listeners.
A client session that cannot upload still has this object: without a channel (the VSViewer, a client from before the upload transport) or without a service (the upload module is not initialized), isEnabled() is false and every request is refused disabled.
Installed by ClientSessionGyro when the client session is created, through install(ClientSessionGyro), and disposed of with it.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorsConstructorDescriptionClientSessionUploadChannel(UploadChannelProps channel, AppGyroFileUploaderService service) Constructor: installs this object as the channel's handler and registers it with the service, which replays every file the App holds paused.Method Summary
Modifier and TypeMethodDescriptionbooleanaddListener(IFileUploadListener listener) Adds a listener for every reservation made through this client session from now on.voiddispose()Disposes of the link: the service stops pushing to it, the channel has no handler, the listeners of this client session are dropped, and no further event of this client's reservations is sent or passed on.Gets the channel.List<? extends IUploadReservation> Gets the live reservations made through this client session.static ClientSessionUploadChannelinstall(ClientSessionGyro gyro) Installs the server side of the upload channel of a client session.booleanChecks if the direct route is allowed.booleanChecks if disposed of.boolean--- IClientUploadAPI: allowing or refusing a client's request ---voidThe client cancels a file or a reservation.voidonFilePaused(String reservationID, int fileIndex, String reason) --- IUploadClientChannel: the App's pause and resume ---voidonFileResumed(String reservationID, int fileIndex) The App resumed a file: the client may send its chunks again, starting at the acknowledged offset it already knows or learns with a status query.voidonReserve(UploadChannelProps channel, UploadRequest request) The client's direct reservation request: refuseddisabledwhen this client session cannot upload, reserved when the App opened the direct route, refuseddeniedotherwise (UD-6).voidThe client's own pause or resume notice (rows 11 and 13).voidrefuse(UploadRequest request, String reason) Refuses a client's request: answers the client ONERESERVED, refused, carrying the request's sequence number and the reason.booleanremoveListener(IFileUploadListener listener) Removes a listener from this client session: as a listener added withIClientUploadAPI.addListener(IFileUploadListener), and as the listener of every reservation it was given to inIClientUploadAPI.reserve(UploadRequest, IFileUploadListener).reserve(UploadRequest request, IFileUploadListener listener) Reserves the files of a client's request: the declared sizes against the quotas, the declared types against$upload.typesand the request's own types, the count against the maximum; answers the client on the channel with ONERESERVEDcarrying the request's sequence number, accepted or refused; and returns the reservation.voidsetDirectReserve(boolean allowed) Allows or forbids the direct route: aRESERVEsent on the upload channel by the client's own script, with no component and no App code in between.
Constructor Details
ClientSessionUploadChannel
Constructor: installs this object as the channel's handler and registers it with the service, which replays every file the App holds paused.- Parameters:
channel- The channel the client created, or null when it created none.service- The application session's upload service, or null when the server has none.
Method Details
install
Installs the server side of the upload channel of a client session.- Parameters:
gyro- The client session gyro, its environment already received from the client.- Returns:
- The link, never null. It is not enabled when the client created no channel under
$envor the server has no upload service (the module is not initialized): every reservation is then refuseddisabled.
getChannel
Gets the channel.- Returns:
- The channel, or null when the client created none.
dispose
public void dispose()Disposes of the link: the service stops pushing to it, the channel has no handler, the listeners of this client session are dropped, and no further event of this client's reservations is sent or passed on.isDisposed
public boolean isDisposed()Checks if disposed of.- Returns:
- true if disposed.
isEnabled
public boolean isEnabled()--- IClientUploadAPI: allowing or refusing a client's request ---- Specified by:
isEnabledin interfaceIClientUploadAPI- Returns:
- true if
IClientUploadAPI.reserve(UploadRequest, IFileUploadListener)would consider a request; false answers every request refuseddisabled.
reserve
Description copied from interface:IClientUploadAPIReserves the files of a client's request: the declared sizes against the quotas, the declared types against$upload.typesand the request's own types, the count against the maximum; answers the client on the channel with ONERESERVEDcarrying the request's sequence number, accepted or refused; and returns the reservation.- Specified by:
reservein interfaceIClientUploadAPI- Parameters:
request- The client's request, not yet answered.listener- A listener for this reservation only, or null. It is called beside the listeners of this client session, on the application session's worker, and hears nothing more once this client session has ended or the listener has been removed withIClientUploadAPI.removeListener(IFileUploadListener).- Returns:
- The reservation, accepted or refused; never null. A reservation refused as a whole holds nothing and its files are all
UploadState.REFUSED.
refuse
Description copied from interface:IClientUploadAPIRefuses a client's request: answers the client ONERESERVED, refused, carrying the request's sequence number and the reason. Nothing is reserved.- Specified by:
refusein interfaceIClientUploadAPI- Parameters:
request- The client's request, not yet answered.reason- The reason the client is told, a short code such asdenied; null or empty fordenied.
addListener
Description copied from interface:IClientUploadAPIAdds a listener for every reservation made through this client session from now on.An object that is also the listener of a reservation, or a listener of the application session's service, hears each event once per level.
- Specified by:
addListenerin interfaceIClientUploadAPI- Parameters:
listener- The listener.- Returns:
- true if added, false if already present or this client session cannot upload.
removeListener
Description copied from interface:IClientUploadAPIRemoves a listener from this client session: as a listener added withIClientUploadAPI.addListener(IFileUploadListener), and as the listener of every reservation it was given to inIClientUploadAPI.reserve(UploadRequest, IFileUploadListener). A component that is disposed of removes itself this way; its transfers continue.- Specified by:
removeListenerin interfaceIClientUploadAPI- Parameters:
listener- The listener.- Returns:
- true if it was removed from at least one place, false if it was nowhere.
getReservations
Description copied from interface:IClientUploadAPIGets the live reservations made through this client session.- Specified by:
getReservationsin interfaceIClientUploadAPI- Returns:
- The reservations, never null; a snapshot.
setDirectReserve
public void setDirectReserve(boolean allowed) Description copied from interface:IClientUploadAPIAllows or forbids the direct route: aRESERVEsent on the upload channel by the client's own script, with no component and no App code in between. Forbidden by default (UD-6): such a request is then refuseddenied, since nothing has allowed it. An App whose own client code uploads through the session's uploader opts in here, and so accepts every request the limits permit.- Specified by:
setDirectReservein interfaceIClientUploadAPI- Parameters:
allowed- true to reserve direct requests, false to refuse them.
isDirectReserve
public boolean isDirectReserve()Description copied from interface:IClientUploadAPIChecks if the direct route is allowed.- Specified by:
isDirectReservein interfaceIClientUploadAPI- Returns:
- true if a direct
RESERVEis reserved, false (the default) if refused.
onReserve
The client's direct reservation request: refuseddisabledwhen this client session cannot upload, reserved when the App opened the direct route, refuseddeniedotherwise (UD-6).- Specified by:
onReservein interfaceUploadChannelProps.IHandler- Parameters:
channel- The channel the request came in on.request- The request, decoded and not yet answered; its source is null.
onCancel
Description copied from interface:UploadChannelProps.IHandlerThe client cancels a file or a reservation.- Specified by:
onCancelin interfaceUploadChannelProps.IHandler- Parameters:
reservationID- The reservation ID.fileIndex- The file index, or -1 for the whole reservation.reason- The reason, never null.
onState
Description copied from interface:UploadChannelProps.IHandlerThe client's own pause or resume notice (rows 11 and 13).- Specified by:
onStatein interfaceUploadChannelProps.IHandler- Parameters:
reservationID- The reservation ID.fileIndex- The file index, or -1 for every file.paused- true for a pause, false for a resume.reason- The reason of a pause, empty for a resume.
onFilePaused
--- IUploadClientChannel: the App's pause and resume ---- Specified by:
onFilePausedin interfaceIUploadClientChannel- Parameters:
reservationID- The reservation ID.fileIndex- The file index.reason- The reason the App gave, never null.
onFileResumed
Description copied from interface:IUploadClientChannelThe App resumed a file: the client may send its chunks again, starting at the acknowledged offset it already knows or learns with a status query.- Specified by:
onFileResumedin interfaceIUploadClientChannel- Parameters:
reservationID- The reservation ID.fileIndex- The file index.