You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Andrea Patricelli <an...@apache.org> on 2017/09/28 13:10:01 UTC
File upload "too large" error managing
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
Re: File upload "too large" error managing
Posted by Andrea Patricelli <an...@apache.org>.
Il 29/09/2017 17:35, Sven Meier ha scritto:
> Hi,
>
> please create a quickstart and attach it to a new issue. It would be
> nice to be able to run it with Jetty.
>
> You can check any differences between your code and the file upload
> example in wicket-examples: the error message works fine there for
> your case (i.e. container limit > file size > wicket limit)
>
> Thanks
> Sven
>
Thanks a lot Sven!
Since we are using an highly customized application very different from
the example in wicket 7 examples section it woul have been dfficult to
me to easily reproduce the issue. Moreover we are using wicket bootstrap
with fileInput.js that is managing file upload.
Only FYI we opened an issue on Apache Syncope Jira here [1] and we
managed to solve the problem managing manually size limits.
Best regards,
Andrea
[1] https://issues.apache.org/jira/browse/SYNCOPE-1213
>
> Am 29.09.2017 um 11:20 schrieb Andrea Patricelli:
>>
>>
>> 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
>>>>>> <sv...@meiers.net>
>>>>> 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
Re: File upload "too large" error managing
Posted by Sven Meier <sv...@meiers.net>.
Hi,
please create a quickstart and attach it to a new issue. It would be
nice to be able to run it with Jetty.
You can check any differences between your code and the file upload
example in wicket-examples: the error message works fine there for your
case (i.e. container limit > file size > wicket limit)
Thanks
Sven
Am 29.09.2017 um 11:20 schrieb Andrea Patricelli:
>
>
> 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
>>>>> <sv...@meiers.net>
>>>> 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
>>>>
>>>
>>
Re: File upload "too large" error managing
Posted by Andrea Patricelli <an...@apache.org>.
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
>>>> <sv...@meiers.net>
>>> 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
Re: File upload "too large" error managing
Posted by Sven Meier <sv...@meiers.net>.
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.
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
>>> <sv...@meiers.net>
>> 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
>>
>
Re: File upload "too large" error managing
Posted by Andrea Patricelli <an...@apache.org>.
Hi Martin,
Thanks for the tip. But my form's size seems to be controlled by
uploadForm.setMaxSize(...). And is correct.
How can I "control" and manage, "too large file" error? is there a way
to throw it as Java exception and not see it only in Javascript console?
Best regards,
Andrea
Il 29/09/2017 09:38, Martin Grigorov ha scritto:
> Hi,
>
> For Tomcat I'd recommend you to set maxSwallowSize to the connector:
> https://tomcat.apache.org/tomcat-8.5-doc/config/http.html
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Sep 29, 2017 at 10:22 AM, Andrea Patricelli <
> andrea.patricelli@tirasa.net> wrote:
>
>> 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 <
>>>> sven@meiers.net>
>>>>
>>> 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
>>
>>
--
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
Re: File upload "too large" error managing
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
For Tomcat I'd recommend you to set maxSwallowSize to the connector:
https://tomcat.apache.org/tomcat-8.5-doc/config/http.html
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Fri, Sep 29, 2017 at 10:22 AM, Andrea Patricelli <
andrea.patricelli@tirasa.net> wrote:
> 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 <
>>> sven@meiers.net>
>>>
>> 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
>
>
Re: File upload "too large" error managing
Posted by Andrea Patricelli <an...@tirasa.net>.
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 <sv...@meiers.net>
> 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
Re: File upload "too large" error managing
Posted by Emond Papegaaij <em...@topicus.nl>.
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 <sv...@meiers.net>
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
Re: File upload "too large" error managing
Posted by Andrea Patricelli <an...@tirasa.net>.
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 <sv...@meiers.net> 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
>>
Re: File upload "too large" error managing
Posted by Sven Meier <sv...@meiers.net>.
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
>