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


Re: AbortException

2010-02-08 Thread Erik van Oosten
Throwing a RestartResponseException will not redirect but restart the 
request handling. To force the redirect as well, you can call

 setRedirect(true)
just before throwing the exception.

But I doubt it will work for you; when you have an error page without 
the redirect, you will probably also have it with the redirect.


Regards,
   Erik.


Douglas Ferguson wrote:

I tried that and it doesn't redirect, it throws the error back up and renders 
our error page
  

org.apache.wicket.RestartResponseException:null




On Feb 7, 2010, at 2:20 AM, Martin Grigorov wrote:
  

throw new RestartResponseException(LinkPartners.class)

On Sat, 2010-02-06 at 23:53 -0800, Douglas Ferguson wrote:


I may be using this wrong, but my understanding was that if I wanted to 
redirect a user and hault execution of the current page I could do the 
following:

setResponsePage(LinkPartners.class);
throw new AbortException();

However, there seems to be situations where the AbortException actually bubbles 
back up to the user.
What would cause the redirect not to work and the AbortException to make it to 
the screen?

D/
  



--
Send from my SMTP compliant software
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AbortException

2010-02-07 Thread Douglas Ferguson
This was some really silly stuff in our code..

https://buzzstream2.fogbugz.com/default.asp?5102#31036

On Feb 7, 2010, at 2:20 AM, Martin Grigorov wrote:

> 
> throw new RestartResponseException(LinkPartners.class)
> 
> On Sat, 2010-02-06 at 23:53 -0800, Douglas Ferguson wrote:
>> I may be using this wrong, but my understanding was that if I wanted to 
>> redirect a user and hault execution of the current page I could do the 
>> following:
>> 
>> setResponsePage(LinkPartners.class);
>> throw new AbortException();
>> 
>> However, there seems to be situations where the AbortException actually 
>> bubbles back up to the user.
>> What would cause the redirect not to work and the AbortException to make it 
>> to the screen?
>> 
>> D/
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AbortException

2010-02-07 Thread Douglas Ferguson
I tried that and it doesn't redirect, it throws the error back up and renders 
our error page

> org.apache.wicket.RestartResponseException:null



On Feb 7, 2010, at 2:20 AM, Martin Grigorov wrote:

> 
> throw new RestartResponseException(LinkPartners.class)
> 
> On Sat, 2010-02-06 at 23:53 -0800, Douglas Ferguson wrote:
>> I may be using this wrong, but my understanding was that if I wanted to 
>> redirect a user and hault execution of the current page I could do the 
>> following:
>> 
>> setResponsePage(LinkPartners.class);
>> throw new AbortException();
>> 
>> However, there seems to be situations where the AbortException actually 
>> bubbles back up to the user.
>> What would cause the redirect not to work and the AbortException to make it 
>> to the screen?
>> 
>> D/
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AbortException

2010-02-07 Thread Martin Grigorov

throw new RestartResponseException(LinkPartners.class)

On Sat, 2010-02-06 at 23:53 -0800, Douglas Ferguson wrote:
> I may be using this wrong, but my understanding was that if I wanted to 
> redirect a user and hault execution of the current page I could do the 
> following:
> 
> setResponsePage(LinkPartners.class);
> throw new AbortException();
> 
> However, there seems to be situations where the AbortException actually 
> bubbles back up to the user.
> What would cause the redirect not to work and the AbortException to make it 
> to the screen?
> 
> D/



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



AbortException

2010-02-06 Thread Douglas Ferguson
I may be using this wrong, but my understanding was that if I wanted to 
redirect a user and hault execution of the current page I could do the 
following:

setResponsePage(LinkPartners.class);
throw new AbortException();

However, there seems to be situations where the AbortException actually bubbles 
back up to the user.
What would cause the redirect not to work and the AbortException to make it to 
the screen?

D/