Hi,

The idea is to create MultipartWebRequest before trying to read
multi-part data from the servlet input stream.
So in your case you have to do this in your own FileUploadRequestHandler.

On Wed, Oct 31, 2012 at 6:14 PM, heapifyman <[email protected]> wrote:
> Ok, now I am kind of lost again. Sorry for the stupid question:
> Before I had
> - in WicketApplication: mount(new FileUploader("/fileupload"));
> - where FileUploader extends AbstractMapper and calls "return new
> FileUploadRequestHandler();" in mapRequest(Request request)
> - FileUploadRequestHandler implements IRequestHandler and handles both POST
> and GET requests for file up- and download respective
>
> Where does the IResource impl. fit int there? Is there an example somewhere
> or where would I find some documentation to read up on this topic?
> Thanks again.
>
>
> 2012/10/31 Martin Grigorov <[email protected]>
>
>> Hi,
>>
>> As Andrea explained (and the ticket you mentioned yourself) the change
>> in MyApp#newWebRequest caused several problems, so better do not do it
>> there.
>> Move the code that creates the MultipartWebRequest in your own IResource
>> impl.
>>
>> On Wed, Oct 31, 2012 at 1:55 PM, heapifyman <[email protected]> wrote:
>> > Hello,
>> > after a second closer look I figured I should override newWebRequest in
>> > my WicketApplication extends WebApplication, right?
>> > So now I have:
>> > @Override
>> > public WebRequest newWebRequest(HttpServletRequest servletRequest,
>> > String filterPath) {
>> > WebRequest webRequest = super.newWebRequest(servletRequest, filterPath);
>> >
>> > String contentType = servletRequest.getContentType();
>> > String method = servletRequest.getMethod();
>> > if (webRequest instanceof ServletWebRequest
>> > && Form.METHOD_POST.equalsIgnoreCase(method)
>> > && Strings.isEmpty(contentType) == false
>> > && contentType.toLowerCase().startsWith(
>> > Form.ENCTYPE_MULTIPART_FORM_DATA)) {
>> > try {
>> > return ((ServletWebRequest) webRequest).newMultipartWebRequest(
>> > getApplicationSettings().getDefaultMaximumUploadSize(),
>> > "externalForm");
>> > } catch (FileUploadException e) {
>> > throw new RuntimeException(e);
>> >
>> > }
>> > }
>> >
>> > return webRequest;
>> > }
>> >
>> > That seems to work. Am I still missing something?
>> > Thanks
>> >
>> >
>> > 2012/10/31 Andrea Del Bene <[email protected]>
>> >
>> >> Hi,
>> >>
>> >> the change introduced by WICKET-4752 caused some other problems so it
>> was
>> >> reverted in 6.2.0. If you want to obtain the old behavior you should
>> use in
>> >> our application class  the code that has been removed from
>> WebApplication
>> >> class (see the diff indicated by Martin)
>> >>
>> >>  Sorry, could you elaborate a bit on that? I don't see the
>> connection... :(
>> >>>
>> >>>
>> >>> 2012/10/31 Martin Grigorov <[email protected]>
>> >>>
>> >>>  https://git-wip-us.apache.org/**repos/asf/wicket/repo?p=**
>> >>>>
>> wicket.git;a=commitdiff;h=**3355b5af68a238855a602f5161980d**65024a1e92<
>> https://git-wip-us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=commitdiff;h=3355b5af68a238855a602f5161980d65024a1e92
>> >
>> >>>>
>> >>>> On Wed, Oct 31, 2012 at 12:49 PM, heapifyman <[email protected]>
>> >>>> wrote:
>> >>>>
>> >>>>> Hello,
>> >>>>>
>> >>>>> Just updated from 6.1.1 to 6.2.0 and now I'm having a problem with
>> file
>> >>>>> uploads.
>> >>>>> I have a
>> >>>>>    public class FileUploadRequestHandler implements IRequestHandler
>> >>>>> that handles jquery fileupload requests.
>> >>>>>
>> >>>>> In its respond() method I call
>> >>>>>    Request request = requestCycle.getRequest();
>> >>>>> which in wicket 6.1.1 would give me a MultipartServletWebRequestImpl
>> >>>>> with
>> >>>>> parameters and postparameters filled and, of course, the files to
>> >>>>> upload.
>> >>>>>
>> >>>>> In 6.2.0 I only get a ServletWebRequest and the postparameters are
>> >>>>> empty.
>> >>>>>
>> >>>>> I guess this is due to WICKET-4752 but I am at a complete loss how to
>> >>>>> get
>> >>>>> back the old behavior.
>> >>>>>
>> >>>>> Any hints would be appreciated.
>> >>>>> Thanks
>> >>>>>
>> >>>>
>> >>>>
>> >>>> --
>> >>>> Martin Grigorov
>> >>>> jWeekend
>> >>>> Training, Consulting, Development
>> >>>> http://jWeekend.com
>> >>>>
>> >>>> ------------------------------**------------------------------**
>> >>>> ---------
>> >>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<
>> [email protected]>
>> >>>> For additional commands, e-mail: [email protected]
>> >>>>
>> >>>>
>> >>>>
>> >>
>> >>
>> ------------------------------**------------------------------**---------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<
>> [email protected]>
>> >> For additional commands, e-mail: [email protected]
>> >>
>> >>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to