Il 29/09/2017 10:42, Sven Meier ha scritto:
Hi,

> In fact I'm using tomcat as container with default max file size set to 52 MB,
> while my form max size is only 4 MB.
> And I get that error uploading a 16 MB file (for example).

in that case Wicket should handle the max size and all should go well - if not it would be a Wicket bug.


Wicket handles the file size correctly, but gives no error message about "exceed file size", only hard-to-understand errors in Javascript console. I think that this is the bug, or at least an improvement is needed.
I'm going to open an issue about this ok?

Best regards,
Andrea

In my experience the problematic case is when the container detects a limit overrun, e.g.
- Jetty has a max size of 4 MB
- form max size is 52 MB
- uploading 16 MB fails without any feedback to the user

Regards
Sven


Am 29.09.2017 um 09:22 schrieb Andrea Patricelli:
Yes Emond,

I guess that my error is the same, and your explanation is very convincing :)

Is there a solution, i.e. to better control such error? Or, better, is it a bug?

Best regards,
Andrea


Il 29/09/2017 08:44, Emond Papegaaij ha scritto:
Hi,

I've seen the error you describe before. It happened to me when a file-
submitting ajax call fails when using a Content-Security-Policy. The problem is that an error is returned to the browser (in my case Chrome), which renders an error page inside the iframe used to submit files via ajax. This error page is not from the same origin as your application (localhost:9080), therefore access is blocked for wicket-ajax. It took me a while to figure this out and I
suspect something similar is happening to you.

Best regards,
Emond

On vrijdag 29 september 2017 07:48:44 CEST Andrea Patricelli wrote:
Hi Sven,

Yes I confirm that the size taken into consideration is the form's one. In fact I'm using tomcat as container with default max file size set to 52
MB, ⁣while my form max size is only 4 MB.
And I get that error uploading a 16 MB file (for example).

Best regards,
Andrea

Il giorno 28 set 2017, 23:42, alle ore 23:42, Sven Meier <[email protected]>
ha scritto:
Hi,

I can reproduce your finding with Chrome and Jetty:

Jetty has a default form submit limit of 200000 bytes which is hit
before your limit is even taken into consideration. wicket-ajax seems
not to be able to get hold on the response.

If I use Firefox instead of Chrome, wicket-ajax's
handleMultipartComplete() is never called at all :/.

What's your container's upload limit? Can you confirm that you get a
correct error message, when you upload a file bigger than your form's
max size, but smaller than your containers limit?

Regards
Sven

Am 28.09.2017 um 15:10 schrieb Andrea Patricelli:
Hi all,

I've a Multipart form defined in this way:

Form<T> uploadForm = new StatelessForm<>("uploadForm");
uploadForm.setMultiPart(true);
uploadForm.setMaxSize(Bytes.megabytes(4));

Like you can see I defined a maximum file size to avoid upload of too

large files.

My problem is:

When I upload a *too large* file nothing happens, there are no Java
exceptions and all seems ok, while, instead on JavaScript console I
get:
Wicket.Ajax:  Cannot read Ajax response for multipart form submit:
SecurityError: Blocked a frame with origin "http://localhost:9080";
from accessing a cross-origin frame.

...

wicket-ajax-jquery-debug-ver-1506594798000.js:1 Wicket.Ajax:
Wicket.Ajax.Call.failure: Error while parsing response: No XML
response in the IFrame document

Is there a way to have the evidence of this failure in Java code? In
order to show a feedback panel when file is too large?

Best regards,
Andrea



--
Dott. Andrea Patricelli
Tel. +39 3204524292

Developer @ Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173
http://www.tirasa.net

Apache Syncope PMC Member

Reply via email to