Hi Ernesto, I think additions such as this are great. I just completed a full review together with Claude. About your questions: 1 Either wicket-extensions, or depending on how stable you expect the first release to be, wicket-experimental. 2. Makes sense, but hard for me to judge. 3. I don't think there's a one size fits all for this. Users will have to tweak these settings depending on their setup. 4. master only. This is totally new functionality and should not be backported to maintenance only branches. Putting this in 10 would also make it very hard to change the API if needed.
Emond Op do 26 nov 2026 om 21:41 schreef Ernesto Reinaldo Barreiro <[email protected]>: > > Hi all, > > I'd like your feedback on a new component I've been working on: resumable > file uploads. > > - PR (master): apache/wicket#2010 > <https://github.com/apache/wicket/pull/2010> > - Backports: #2011 (11.x), #2016 (10.x) > > *The problem* > > FileUploadToResourceField sends all files in a single multipart request. If > the connection drops or the page is reloaded, the upload starts again from > byte 0. There is no way to pause, and some proxies refuse very large > requests. > > *What the PR adds* > > A new ResumableUploadToResourceField in wicket-extensions, which is a > subclass of FileUploadToResourceField. Each file is sent in chunks (8 MB by > default) to a mounted ResumableUploadResourceReference, using the tus 1.0 > protocol (https://tus.io). When a file is complete it is handed to the > application's IUploadsFileManager and onUploadSuccess() is called, as with > the parent field. Limits, the drop zone and the file list work as before. > > Client side (plain JS, built on the parent's prototype): > > - Each file gets a progress bar with Pause/Resume and Cancel buttons. On > the server side, pauseUpload() and resumeUpload() sit next to > startUpload() and cancelUpload(). > - A few files upload in parallel (2 by default) and the rest wait in a > queue. > - A failed chunk is retried with back-off. If the browser goes offline, > it waits for the connection and then asks whether to resume. > setAskingToResume(false) resumes without asking. > - After a reload or browser restart, the upload URLs and file metadata > are kept in localStorage (name, size and date, never content). The page > offers to continue or discard. To continue, the user picks the file again > and the upload goes on from the server's offset. > - A page can show these questions in its own dialog via > getClientSideResumeQuestionCallBack(). > > Server side: > > - Implements tus core plus the creation, termination and expiration > extensions. X-HTTP-Method-Override is supported for proxies that block > PATCH. > - The field id and limits are signed with the application's crypt, so > the browser cannot change them. > - Each upload has an owner: the HTTP session by default, or the > signed-in user if you want uploads to outlive the session. Other owners get > a 404. > - Quotas per owner and overall, a minimum free disk space check, and a > lock so two requests cannot write to the same upload at once. > - Clean-up removes uploads untouched for 30 minutes, the uploads of a > session when it ends, and everything when the application stops. > > Changes to wicket-core are small: getUploadCallbackUrl() becomes protected > final, the upload resource package is exported in module-info, and there > are some Javadoc fixes. > > Tests: 21 WicketTester tests, 21 QUnit tests (jQuery and vanilla engines), > and headless Chrome tests. > > I'd especially like your opinion on: > > 1. Is wicket-extensions the right home for this? > 2. Are you OK with following tus rather than a Wicket-specific chunk > protocol? A side benefit is that any tus client can talk to the resource. > 3. Are the defaults sensible? They are 8 MB chunks (16 MB max), 2 > parallel uploads, a 40 s retry timeout and 30-minute expiry. > 4. Should it be backported to 10.x and 11.x as a new feature, or go to > master only? > > Comments on the PR or replies here are both welcome. > -- > Regards - > Ernesto Reinaldo Barreiro > Apache Wicket Committer > Emerging artist > https://www.instagram.com/reinaldo.barreiro.art/
