Re: What replaces Wicket 1.4 AbortException in Wicket 6.x?

2012-11-19 Thread Kees van Dieren
Found the solution for it.

Basically it comes to this:

On the place where binary content needs to be returned, use something like
this:
@Override
protected void onSubmit() {
throw new ReplaceHandlerException(new IRequestHandler() {

@Override
public void respond(IRequestCycle requestCycle) {
sendBinaryContents((WebResponse)
requestCycle.getResponse());
}

@Override
public void detach(IRequestCycle requestCycle) {
// nothing to detach.
}
}, false);

}

private void sendBinaryContents(WebResponse response) {
response.reset();
response.setAttachmentHeader("somefilename.zip");
response.setContentType("application/zip");

response.write(getZipData());
}


Best regards,

Kees



2012/11/19 Kees van Dieren 

> Found something that might help:
> org.apache.wicket.markup.html.link.DownloadLink.onClick()
>
> Will look at this, some tips still welcome :)
>
>
>
> 2012/11/19 Kees van Dieren 
>
>> Hi,
>>
>> We have some code that returns zip output (e.g. downloads a file) in an
>> onsubmit of a wicket form.
>>
>> We used to do this (with Wicket 1.4):
>>
>> Get the WebResponse
>> Fill it with the ZIP contents
>>
>> throw new AbortException();
>>
>> The ZIP contents to be returned depends on the contents filled in by the
>> user in a wicket form.
>>
>> However, AbortException does not exists any more.
>>
>> What is the best way to do it on Wicket 6?
>>
>>
>> Thanks in advance!
>>
>> --
>> Best regards / Met vriendelijke groet,
>>
>> Kees van Dieren
>> Squins | IT, Honestly
>> Oranjestraat 23
>> 2983 HL Ridderkerk
>> The Netherlands
>> Mobile: +31 (0)6 30413841
>> www.squins.com
>> http://twitter.com/keesvandieren
>> Chamber of commerce Rotterdam: 24435130
>> Boeken voor school en werk bestel je op studieboekencenter.nl
>>
>>
>
>
> --
> Best regards / Met vriendelijke groet,
>
> Kees van Dieren
> Squins | IT, Honestly
> Oranjestraat 23
> 2983 HL Ridderkerk
> The Netherlands
> Mobile: +31 (0)6 30413841
> www.squins.com
> http://twitter.com/keesvandieren
> Chamber of commerce Rotterdam: 24435130
> Boeken voor school en werk bestel je op studieboekencenter.nl
>
>


-- 
Best regards / Met vriendelijke groet,

Kees van Dieren
Squins | IT, Honestly
Oranjestraat 23
2983 HL Ridderkerk
The Netherlands
Mobile: +31 (0)6 30413841
www.squins.com
http://twitter.com/keesvandieren
Chamber of commerce Rotterdam: 24435130
Boeken voor school en werk bestel je op studieboekencenter.nl


Re: What replaces Wicket 1.4 AbortException in Wicket 6.x?

2012-11-19 Thread Kees van Dieren
Found something that might help:
org.apache.wicket.markup.html.link.DownloadLink.onClick()

Will look at this, some tips still welcome :)


2012/11/19 Kees van Dieren 

> Hi,
>
> We have some code that returns zip output (e.g. downloads a file) in an
> onsubmit of a wicket form.
>
> We used to do this (with Wicket 1.4):
>
> Get the WebResponse
> Fill it with the ZIP contents
>
> throw new AbortException();
>
> The ZIP contents to be returned depends on the contents filled in by the
> user in a wicket form.
>
> However, AbortException does not exists any more.
>
> What is the best way to do it on Wicket 6?
>
>
> Thanks in advance!
>
> --
> Best regards / Met vriendelijke groet,
>
> Kees van Dieren
> Squins | IT, Honestly
> Oranjestraat 23
> 2983 HL Ridderkerk
> The Netherlands
> Mobile: +31 (0)6 30413841
> www.squins.com
> http://twitter.com/keesvandieren
> Chamber of commerce Rotterdam: 24435130
> Boeken voor school en werk bestel je op studieboekencenter.nl
>
>


-- 
Best regards / Met vriendelijke groet,

Kees van Dieren
Squins | IT, Honestly
Oranjestraat 23
2983 HL Ridderkerk
The Netherlands
Mobile: +31 (0)6 30413841
www.squins.com
http://twitter.com/keesvandieren
Chamber of commerce Rotterdam: 24435130
Boeken voor school en werk bestel je op studieboekencenter.nl


What replaces Wicket 1.4 AbortException in Wicket 6.x?

2012-11-19 Thread Kees van Dieren
Hi,

We have some code that returns zip output (e.g. downloads a file) in an
onsubmit of a wicket form.

We used to do this (with Wicket 1.4):

Get the WebResponse
Fill it with the ZIP contents

throw new AbortException();

The ZIP contents to be returned depends on the contents filled in by the
user in a wicket form.

However, AbortException does not exists any more.

What is the best way to do it on Wicket 6?


Thanks in advance!

-- 
Best regards / Met vriendelijke groet,

Kees van Dieren
Squins | IT, Honestly
Oranjestraat 23
2983 HL Ridderkerk
The Netherlands
Mobile: +31 (0)6 30413841
www.squins.com
http://twitter.com/keesvandieren
Chamber of commerce Rotterdam: 24435130
Boeken voor school en werk bestel je op studieboekencenter.nl