You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Eyal Golan <eg...@gmail.com> on 2008/06/25 14:36:42 UTC
redirect page in the constructor
Hi,
After reviewing some discussion regarding the issue.
http://issues.apache.org/jira/browse/WICKET-696
and
http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
What is the conclusion?
Is the original page being mapped or no?
thanks
--
Eyal Golan
egolan74@gmail.com
Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74
P Save a tree. Please don't print this e-mail unless it's really necessary
Re: redirect page in the constructor
Posted by Eyal Golan <eg...@gmail.com>.
Igor,
Yes it does work
On Mon, Jun 30, 2008 at 6:23 PM, Igor Vaynberg <ig...@gmail.com>
wrote:
> does it work?
>
> -igor
>
> On Mon, Jun 30, 2008 at 2:28 AM, Eyal Golan <eg...@gmail.com> wrote:
> > OK.
> > That is what I did.
> > So, if a instantiate a page and then put it as a parameter in the
> exception,
> > I am fine?
> > ...
> > TicketTreeQueuePage ticketTreeQueuePage = new
> > TicketTreeQueuePage(pageParameters);
> > throw new RestartResponseAtInterceptPageException(ticketTreeQueuePage);
> >
> >
> > Thanks
> >
> >
> > On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <ig...@gmail.com>
> > wrote:
> >
> >> use restartresponseexception instead
> >>
> >> -igor
> >>
> >> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
> >> > Hi,
> >> > After reviewing some discussion regarding the issue.
> >> > http://issues.apache.org/jira/browse/WICKET-696
> >> >
> >> > and
> >> >
> >>
> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
> >> >
> >> > What is the conclusion?
> >> > Is the original page being mapped or no?
> >> >
> >> > thanks
> >> >
> >> > --
> >> > Eyal Golan
> >> > egolan74@gmail.com
> >> >
> >> > Visit: http://jvdrums.sourceforge.net/
> >> > LinkedIn: http://www.linkedin.com/in/egolan74
> >> >
> >> > P Save a tree. Please don't print this e-mail unless it's really
> >> necessary
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
> > --
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P Save a tree. Please don't print this e-mail unless it's really
> necessary
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Eyal Golan
egolan74@gmail.com
Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74
P Save a tree. Please don't print this e-mail unless it's really necessary
Re: redirect page in the constructor
Posted by James Carman <ja...@carmanconsulting.com>.
On Mon, Jun 30, 2008 at 4:36 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> exceptions are for exceptional circumstances. i think redirecting to a
> different page from a constructor of another page is pretty
> exceptional...otherwise you wouldnt be in the constructor of the wrong
> page :)
+1. Agreed.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: redirect page in the constructor
Posted by Igor Vaynberg <ig...@gmail.com>.
exceptions are for exceptional circumstances. i think redirecting to a
different page from a constructor of another page is pretty
exceptional...otherwise you wouldnt be in the constructor of the wrong
page :)
-igor
On Mon, Jun 30, 2008 at 12:14 PM, Bruno Borges <br...@gmail.com> wrote:
> I know that Igor. In fact, I wasn't thinking really about performance here.
> I suggested the annotation because sounds more objective than throwing an
> exception. Exceptions are for errors or invalidations. Redirection is a flow
> control. No error in that.
>
> But, anyway... it was an idea... Ideas are born to be killed or to grow up.
> :-)
>
> []'s
> --
> Bruno Borges
> blog.brunoborges.com.br
> +55 21 76727099
>
> "The glory of great men should always be
> measured by the means they have used to
> acquire it."
> - Francois de La Rochefoucauld
>
> On Mon, Jun 30, 2008 at 4:07 PM, Igor Vaynberg <ig...@gmail.com>
> wrote:
>
>> On Mon, Jun 30, 2008 at 11:59 AM, Bruno Borges <br...@gmail.com>
>> wrote:
>> > I have an idea that sounds crazy, but imho, is better then throwing an
>> > exception (stack trace is a little bit expensive to the VM).
>>
>> right, because we dont care about performance :)
>>
>> /**
>> * Immediately aborts any further processing.
>> *
>> * @author Igor Vaynberg (ivaynberg)
>> */
>> public class AbortException extends RuntimeException
>> {
>> private static final long serialVersionUID = 1L;
>>
>> /**
>> * @see java.lang.Throwable#fillInStackTrace()
>> */
>> public synchronized Throwable fillInStackTrace()
>> {
>> // we do not need a stack trace, so to speed things up just
>> return null
>> return null;
>> }
>>
>> }
>>
>>
>> -igor
>>
>>
>>
>>
>> >
>> > Here it goes:
>> >
>> > public class MyPage extends WebPage {
>> > @Redirect(MyPageRedirector.class)
>> > public MyPage() {
>> > add(new Label("label", "Foo"));
>> > }
>> >
>> > public static class MyPageRedirector implements IRedirectPage {
>> > public void redirect(Object ... args) {
>> > // args is an array of objects that might be passed as arguments to
>> > MyPage annotated constructor, if it has arguments
>> > if (args[0].equals("success")) {
>> > RequestCycle.get().setResponsePage(AnotherPage.class);
>> > }
>> > }
>> > }
>> > }
>> >
>> > The concept here is to define a class that implements IRedirectPage and
>> > annotate the constructor which must check something if it intents to
>> > redirect to another page. IMHO, this is a nice feature as it sounds more
>> > elegant than throwing an exception and saves a lot of object creation
>> time.
>> >
>> > Any thoughts?
>> >
>> > []'s
>> >
>> > --
>> > Bruno Borges
>> > blog.brunoborges.com.br
>> > +55 21 76727099
>> >
>> > "The glory of great men should always be
>> > measured by the means they have used to
>> > acquire it."
>> > - Francois de La Rochefoucauld
>> >
>> > On Mon, Jun 30, 2008 at 12:23 PM, Igor Vaynberg <igor.vaynberg@gmail.com
>> >
>> > wrote:
>> >
>> >> does it work?
>> >>
>> >> -igor
>> >>
>> >> On Mon, Jun 30, 2008 at 2:28 AM, Eyal Golan <eg...@gmail.com> wrote:
>> >> > OK.
>> >> > That is what I did.
>> >> > So, if a instantiate a page and then put it as a parameter in the
>> >> exception,
>> >> > I am fine?
>> >> > ...
>> >> > TicketTreeQueuePage ticketTreeQueuePage = new
>> >> > TicketTreeQueuePage(pageParameters);
>> >> > throw new
>> RestartResponseAtInterceptPageException(ticketTreeQueuePage);
>> >> >
>> >> >
>> >> > Thanks
>> >> >
>> >> >
>> >> > On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <
>> igor.vaynberg@gmail.com>
>> >> > wrote:
>> >> >
>> >> >> use restartresponseexception instead
>> >> >>
>> >> >> -igor
>> >> >>
>> >> >> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com>
>> wrote:
>> >> >> > Hi,
>> >> >> > After reviewing some discussion regarding the issue.
>> >> >> > http://issues.apache.org/jira/browse/WICKET-696
>> >> >> >
>> >> >> > and
>> >> >> >
>> >> >>
>> >>
>> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
>> >> >> >
>> >> >> > What is the conclusion?
>> >> >> > Is the original page being mapped or no?
>> >> >> >
>> >> >> > thanks
>> >> >> >
>> >> >> > --
>> >> >> > Eyal Golan
>> >> >> > egolan74@gmail.com
>> >> >> >
>> >> >> > Visit: http://jvdrums.sourceforge.net/
>> >> >> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >> >> >
>> >> >> > P Save a tree. Please don't print this e-mail unless it's really
>> >> >> necessary
>> >> >> >
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Eyal Golan
>> >> > egolan74@gmail.com
>> >> >
>> >> > Visit: http://jvdrums.sourceforge.net/
>> >> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >> >
>> >> > P Save a tree. Please don't print this e-mail unless it's really
>> >> necessary
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: redirect page in the constructor
Posted by Bruno Borges <br...@gmail.com>.
I know that Igor. In fact, I wasn't thinking really about performance here.
I suggested the annotation because sounds more objective than throwing an
exception. Exceptions are for errors or invalidations. Redirection is a flow
control. No error in that.
But, anyway... it was an idea... Ideas are born to be killed or to grow up.
:-)
[]'s
--
Bruno Borges
blog.brunoborges.com.br
+55 21 76727099
"The glory of great men should always be
measured by the means they have used to
acquire it."
- Francois de La Rochefoucauld
On Mon, Jun 30, 2008 at 4:07 PM, Igor Vaynberg <ig...@gmail.com>
wrote:
> On Mon, Jun 30, 2008 at 11:59 AM, Bruno Borges <br...@gmail.com>
> wrote:
> > I have an idea that sounds crazy, but imho, is better then throwing an
> > exception (stack trace is a little bit expensive to the VM).
>
> right, because we dont care about performance :)
>
> /**
> * Immediately aborts any further processing.
> *
> * @author Igor Vaynberg (ivaynberg)
> */
> public class AbortException extends RuntimeException
> {
> private static final long serialVersionUID = 1L;
>
> /**
> * @see java.lang.Throwable#fillInStackTrace()
> */
> public synchronized Throwable fillInStackTrace()
> {
> // we do not need a stack trace, so to speed things up just
> return null
> return null;
> }
>
> }
>
>
> -igor
>
>
>
>
> >
> > Here it goes:
> >
> > public class MyPage extends WebPage {
> > @Redirect(MyPageRedirector.class)
> > public MyPage() {
> > add(new Label("label", "Foo"));
> > }
> >
> > public static class MyPageRedirector implements IRedirectPage {
> > public void redirect(Object ... args) {
> > // args is an array of objects that might be passed as arguments to
> > MyPage annotated constructor, if it has arguments
> > if (args[0].equals("success")) {
> > RequestCycle.get().setResponsePage(AnotherPage.class);
> > }
> > }
> > }
> > }
> >
> > The concept here is to define a class that implements IRedirectPage and
> > annotate the constructor which must check something if it intents to
> > redirect to another page. IMHO, this is a nice feature as it sounds more
> > elegant than throwing an exception and saves a lot of object creation
> time.
> >
> > Any thoughts?
> >
> > []'s
> >
> > --
> > Bruno Borges
> > blog.brunoborges.com.br
> > +55 21 76727099
> >
> > "The glory of great men should always be
> > measured by the means they have used to
> > acquire it."
> > - Francois de La Rochefoucauld
> >
> > On Mon, Jun 30, 2008 at 12:23 PM, Igor Vaynberg <igor.vaynberg@gmail.com
> >
> > wrote:
> >
> >> does it work?
> >>
> >> -igor
> >>
> >> On Mon, Jun 30, 2008 at 2:28 AM, Eyal Golan <eg...@gmail.com> wrote:
> >> > OK.
> >> > That is what I did.
> >> > So, if a instantiate a page and then put it as a parameter in the
> >> exception,
> >> > I am fine?
> >> > ...
> >> > TicketTreeQueuePage ticketTreeQueuePage = new
> >> > TicketTreeQueuePage(pageParameters);
> >> > throw new
> RestartResponseAtInterceptPageException(ticketTreeQueuePage);
> >> >
> >> >
> >> > Thanks
> >> >
> >> >
> >> > On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <
> igor.vaynberg@gmail.com>
> >> > wrote:
> >> >
> >> >> use restartresponseexception instead
> >> >>
> >> >> -igor
> >> >>
> >> >> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com>
> wrote:
> >> >> > Hi,
> >> >> > After reviewing some discussion regarding the issue.
> >> >> > http://issues.apache.org/jira/browse/WICKET-696
> >> >> >
> >> >> > and
> >> >> >
> >> >>
> >>
> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
> >> >> >
> >> >> > What is the conclusion?
> >> >> > Is the original page being mapped or no?
> >> >> >
> >> >> > thanks
> >> >> >
> >> >> > --
> >> >> > Eyal Golan
> >> >> > egolan74@gmail.com
> >> >> >
> >> >> > Visit: http://jvdrums.sourceforge.net/
> >> >> > LinkedIn: http://www.linkedin.com/in/egolan74
> >> >> >
> >> >> > P Save a tree. Please don't print this e-mail unless it's really
> >> >> necessary
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Eyal Golan
> >> > egolan74@gmail.com
> >> >
> >> > Visit: http://jvdrums.sourceforge.net/
> >> > LinkedIn: http://www.linkedin.com/in/egolan74
> >> >
> >> > P Save a tree. Please don't print this e-mail unless it's really
> >> necessary
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: redirect page in the constructor
Posted by Igor Vaynberg <ig...@gmail.com>.
On Mon, Jun 30, 2008 at 11:59 AM, Bruno Borges <br...@gmail.com> wrote:
> I have an idea that sounds crazy, but imho, is better then throwing an
> exception (stack trace is a little bit expensive to the VM).
right, because we dont care about performance :)
/**
* Immediately aborts any further processing.
*
* @author Igor Vaynberg (ivaynberg)
*/
public class AbortException extends RuntimeException
{
private static final long serialVersionUID = 1L;
/**
* @see java.lang.Throwable#fillInStackTrace()
*/
public synchronized Throwable fillInStackTrace()
{
// we do not need a stack trace, so to speed things up just return null
return null;
}
}
-igor
>
> Here it goes:
>
> public class MyPage extends WebPage {
> @Redirect(MyPageRedirector.class)
> public MyPage() {
> add(new Label("label", "Foo"));
> }
>
> public static class MyPageRedirector implements IRedirectPage {
> public void redirect(Object ... args) {
> // args is an array of objects that might be passed as arguments to
> MyPage annotated constructor, if it has arguments
> if (args[0].equals("success")) {
> RequestCycle.get().setResponsePage(AnotherPage.class);
> }
> }
> }
> }
>
> The concept here is to define a class that implements IRedirectPage and
> annotate the constructor which must check something if it intents to
> redirect to another page. IMHO, this is a nice feature as it sounds more
> elegant than throwing an exception and saves a lot of object creation time.
>
> Any thoughts?
>
> []'s
>
> --
> Bruno Borges
> blog.brunoborges.com.br
> +55 21 76727099
>
> "The glory of great men should always be
> measured by the means they have used to
> acquire it."
> - Francois de La Rochefoucauld
>
> On Mon, Jun 30, 2008 at 12:23 PM, Igor Vaynberg <ig...@gmail.com>
> wrote:
>
>> does it work?
>>
>> -igor
>>
>> On Mon, Jun 30, 2008 at 2:28 AM, Eyal Golan <eg...@gmail.com> wrote:
>> > OK.
>> > That is what I did.
>> > So, if a instantiate a page and then put it as a parameter in the
>> exception,
>> > I am fine?
>> > ...
>> > TicketTreeQueuePage ticketTreeQueuePage = new
>> > TicketTreeQueuePage(pageParameters);
>> > throw new RestartResponseAtInterceptPageException(ticketTreeQueuePage);
>> >
>> >
>> > Thanks
>> >
>> >
>> > On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <ig...@gmail.com>
>> > wrote:
>> >
>> >> use restartresponseexception instead
>> >>
>> >> -igor
>> >>
>> >> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
>> >> > Hi,
>> >> > After reviewing some discussion regarding the issue.
>> >> > http://issues.apache.org/jira/browse/WICKET-696
>> >> >
>> >> > and
>> >> >
>> >>
>> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
>> >> >
>> >> > What is the conclusion?
>> >> > Is the original page being mapped or no?
>> >> >
>> >> > thanks
>> >> >
>> >> > --
>> >> > Eyal Golan
>> >> > egolan74@gmail.com
>> >> >
>> >> > Visit: http://jvdrums.sourceforge.net/
>> >> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >> >
>> >> > P Save a tree. Please don't print this e-mail unless it's really
>> >> necessary
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > Eyal Golan
>> > egolan74@gmail.com
>> >
>> > Visit: http://jvdrums.sourceforge.net/
>> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >
>> > P Save a tree. Please don't print this e-mail unless it's really
>> necessary
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: redirect page in the constructor
Posted by James Carman <ja...@carmanconsulting.com>.
Sounds a bit too confusing to me. Seems overkill.
On Mon, Jun 30, 2008 at 2:59 PM, Bruno Borges <br...@gmail.com> wrote:
> I have an idea that sounds crazy, but imho, is better then throwing an
> exception (stack trace is a little bit expensive to the VM).
>
> Here it goes:
>
> public class MyPage extends WebPage {
> @Redirect(MyPageRedirector.class)
> public MyPage() {
> add(new Label("label", "Foo"));
> }
>
> public static class MyPageRedirector implements IRedirectPage {
> public void redirect(Object ... args) {
> // args is an array of objects that might be passed as arguments to
> MyPage annotated constructor, if it has arguments
> if (args[0].equals("success")) {
> RequestCycle.get().setResponsePage(AnotherPage.class);
> }
> }
> }
> }
>
> The concept here is to define a class that implements IRedirectPage and
> annotate the constructor which must check something if it intents to
> redirect to another page. IMHO, this is a nice feature as it sounds more
> elegant than throwing an exception and saves a lot of object creation time.
>
> Any thoughts?
>
> []'s
>
> --
> Bruno Borges
> blog.brunoborges.com.br
> +55 21 76727099
>
> "The glory of great men should always be
> measured by the means they have used to
> acquire it."
> - Francois de La Rochefoucauld
>
> On Mon, Jun 30, 2008 at 12:23 PM, Igor Vaynberg <ig...@gmail.com>
> wrote:
>
>> does it work?
>>
>> -igor
>>
>> On Mon, Jun 30, 2008 at 2:28 AM, Eyal Golan <eg...@gmail.com> wrote:
>> > OK.
>> > That is what I did.
>> > So, if a instantiate a page and then put it as a parameter in the
>> exception,
>> > I am fine?
>> > ...
>> > TicketTreeQueuePage ticketTreeQueuePage = new
>> > TicketTreeQueuePage(pageParameters);
>> > throw new RestartResponseAtInterceptPageException(ticketTreeQueuePage);
>> >
>> >
>> > Thanks
>> >
>> >
>> > On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <ig...@gmail.com>
>> > wrote:
>> >
>> >> use restartresponseexception instead
>> >>
>> >> -igor
>> >>
>> >> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
>> >> > Hi,
>> >> > After reviewing some discussion regarding the issue.
>> >> > http://issues.apache.org/jira/browse/WICKET-696
>> >> >
>> >> > and
>> >> >
>> >>
>> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
>> >> >
>> >> > What is the conclusion?
>> >> > Is the original page being mapped or no?
>> >> >
>> >> > thanks
>> >> >
>> >> > --
>> >> > Eyal Golan
>> >> > egolan74@gmail.com
>> >> >
>> >> > Visit: http://jvdrums.sourceforge.net/
>> >> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >> >
>> >> > P Save a tree. Please don't print this e-mail unless it's really
>> >> necessary
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > Eyal Golan
>> > egolan74@gmail.com
>> >
>> > Visit: http://jvdrums.sourceforge.net/
>> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >
>> > P Save a tree. Please don't print this e-mail unless it's really
>> necessary
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: redirect page in the constructor
Posted by Bruno Borges <br...@gmail.com>.
I have an idea that sounds crazy, but imho, is better then throwing an
exception (stack trace is a little bit expensive to the VM).
Here it goes:
public class MyPage extends WebPage {
@Redirect(MyPageRedirector.class)
public MyPage() {
add(new Label("label", "Foo"));
}
public static class MyPageRedirector implements IRedirectPage {
public void redirect(Object ... args) {
// args is an array of objects that might be passed as arguments to
MyPage annotated constructor, if it has arguments
if (args[0].equals("success")) {
RequestCycle.get().setResponsePage(AnotherPage.class);
}
}
}
}
The concept here is to define a class that implements IRedirectPage and
annotate the constructor which must check something if it intents to
redirect to another page. IMHO, this is a nice feature as it sounds more
elegant than throwing an exception and saves a lot of object creation time.
Any thoughts?
[]'s
--
Bruno Borges
blog.brunoborges.com.br
+55 21 76727099
"The glory of great men should always be
measured by the means they have used to
acquire it."
- Francois de La Rochefoucauld
On Mon, Jun 30, 2008 at 12:23 PM, Igor Vaynberg <ig...@gmail.com>
wrote:
> does it work?
>
> -igor
>
> On Mon, Jun 30, 2008 at 2:28 AM, Eyal Golan <eg...@gmail.com> wrote:
> > OK.
> > That is what I did.
> > So, if a instantiate a page and then put it as a parameter in the
> exception,
> > I am fine?
> > ...
> > TicketTreeQueuePage ticketTreeQueuePage = new
> > TicketTreeQueuePage(pageParameters);
> > throw new RestartResponseAtInterceptPageException(ticketTreeQueuePage);
> >
> >
> > Thanks
> >
> >
> > On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <ig...@gmail.com>
> > wrote:
> >
> >> use restartresponseexception instead
> >>
> >> -igor
> >>
> >> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
> >> > Hi,
> >> > After reviewing some discussion regarding the issue.
> >> > http://issues.apache.org/jira/browse/WICKET-696
> >> >
> >> > and
> >> >
> >>
> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
> >> >
> >> > What is the conclusion?
> >> > Is the original page being mapped or no?
> >> >
> >> > thanks
> >> >
> >> > --
> >> > Eyal Golan
> >> > egolan74@gmail.com
> >> >
> >> > Visit: http://jvdrums.sourceforge.net/
> >> > LinkedIn: http://www.linkedin.com/in/egolan74
> >> >
> >> > P Save a tree. Please don't print this e-mail unless it's really
> >> necessary
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
> > --
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P Save a tree. Please don't print this e-mail unless it's really
> necessary
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: redirect page in the constructor
Posted by Igor Vaynberg <ig...@gmail.com>.
does it work?
-igor
On Mon, Jun 30, 2008 at 2:28 AM, Eyal Golan <eg...@gmail.com> wrote:
> OK.
> That is what I did.
> So, if a instantiate a page and then put it as a parameter in the exception,
> I am fine?
> ...
> TicketTreeQueuePage ticketTreeQueuePage = new
> TicketTreeQueuePage(pageParameters);
> throw new RestartResponseAtInterceptPageException(ticketTreeQueuePage);
>
>
> Thanks
>
>
> On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <ig...@gmail.com>
> wrote:
>
>> use restartresponseexception instead
>>
>> -igor
>>
>> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
>> > Hi,
>> > After reviewing some discussion regarding the issue.
>> > http://issues.apache.org/jira/browse/WICKET-696
>> >
>> > and
>> >
>> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
>> >
>> > What is the conclusion?
>> > Is the original page being mapped or no?
>> >
>> > thanks
>> >
>> > --
>> > Eyal Golan
>> > egolan74@gmail.com
>> >
>> > Visit: http://jvdrums.sourceforge.net/
>> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >
>> > P Save a tree. Please don't print this e-mail unless it's really
>> necessary
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P Save a tree. Please don't print this e-mail unless it's really necessary
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: redirect page in the constructor
Posted by Eyal Golan <eg...@gmail.com>.
OK.
That is what I did.
So, if a instantiate a page and then put it as a parameter in the exception,
I am fine?
...
TicketTreeQueuePage ticketTreeQueuePage = new
TicketTreeQueuePage(pageParameters);
throw new RestartResponseAtInterceptPageException(ticketTreeQueuePage);
Thanks
On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <ig...@gmail.com>
wrote:
> use restartresponseexception instead
>
> -igor
>
> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
> > Hi,
> > After reviewing some discussion regarding the issue.
> > http://issues.apache.org/jira/browse/WICKET-696
> >
> > and
> >
> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
> >
> > What is the conclusion?
> > Is the original page being mapped or no?
> >
> > thanks
> >
> > --
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P Save a tree. Please don't print this e-mail unless it's really
> necessary
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Eyal Golan
egolan74@gmail.com
Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74
P Save a tree. Please don't print this e-mail unless it's really necessary
Re: redirect page in the constructor
Posted by Martijn Dashorst <ma...@gmail.com>.
ROFLOL
On Sun, Jun 29, 2008 at 11:59 PM, Matthijs Wensveen <m....@func.nl> wrote:
> System.exit(0);
>
> Igor Vaynberg wrote:
>>
>> if you can find another way to abort creation of a class instance in
>> java feel free to let us know.
>>
>> -igor
>>
>> On Thu, Jun 26, 2008 at 4:29 AM, Eyal Golan <eg...@gmail.com> wrote:
>>
>>>
>>> Igor,
>>> That is what we used before.
>>> Then I looked on the links above, tried the setResponsePage and found out
>>> that it works.
>>> After your answer, I understand that it does pollute the page map.
>>>
>>> I'll change to use the Exception instead.
>>> IMHO it's not a "nice" way to implement such a feature.
>>>
>>> On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <ig...@gmail.com>
>>> wrote:
>>>
>>>
>>>>
>>>> use restartresponseexception instead
>>>>
>>>> -igor
>>>>
>>>> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>> After reviewing some discussion regarding the issue.
>>>>> http://issues.apache.org/jira/browse/WICKET-696
>>>>>
>>>>> and
>>>>>
>>>>>
>>>>
>>>>
>>>> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
>>>>
>>>>>
>>>>> What is the conclusion?
>>>>> Is the original page being mapped or no?
>>>>>
>>>>> thanks
>>>>>
>>>>> --
>>>>> Eyal Golan
>>>>> egolan74@gmail.com
>>>>>
>>>>> Visit: http://jvdrums.sourceforge.net/
>>>>> LinkedIn: http://www.linkedin.com/in/egolan74
>>>>>
>>>>> P Save a tree. Please don't print this e-mail unless it's really
>>>>>
>>>>
>>>> necessary
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> Eyal Golan
>>> egolan74@gmail.com
>>>
>>> Visit: http://jvdrums.sourceforge.net/
>>> LinkedIn: http://www.linkedin.com/in/egolan74
>>>
>>> P Save a tree. Please don't print this e-mail unless it's really
>>> necessary
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: redirect page in the constructor
Posted by Matthijs Wensveen <m....@func.nl>.
System.exit(0);
Igor Vaynberg wrote:
> if you can find another way to abort creation of a class instance in
> java feel free to let us know.
>
> -igor
>
> On Thu, Jun 26, 2008 at 4:29 AM, Eyal Golan <eg...@gmail.com> wrote:
>
>> Igor,
>> That is what we used before.
>> Then I looked on the links above, tried the setResponsePage and found out
>> that it works.
>> After your answer, I understand that it does pollute the page map.
>>
>> I'll change to use the Exception instead.
>> IMHO it's not a "nice" way to implement such a feature.
>>
>> On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <ig...@gmail.com>
>> wrote:
>>
>>
>>> use restartresponseexception instead
>>>
>>> -igor
>>>
>>> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
>>>
>>>> Hi,
>>>> After reviewing some discussion regarding the issue.
>>>> http://issues.apache.org/jira/browse/WICKET-696
>>>>
>>>> and
>>>>
>>>>
>>> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
>>>
>>>> What is the conclusion?
>>>> Is the original page being mapped or no?
>>>>
>>>> thanks
>>>>
>>>> --
>>>> Eyal Golan
>>>> egolan74@gmail.com
>>>>
>>>> Visit: http://jvdrums.sourceforge.net/
>>>> LinkedIn: http://www.linkedin.com/in/egolan74
>>>>
>>>> P Save a tree. Please don't print this e-mail unless it's really
>>>>
>>> necessary
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>> --
>> Eyal Golan
>> egolan74@gmail.com
>>
>> Visit: http://jvdrums.sourceforge.net/
>> LinkedIn: http://www.linkedin.com/in/egolan74
>>
>> P Save a tree. Please don't print this e-mail unless it's really necessary
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: redirect page in the constructor
Posted by Igor Vaynberg <ig...@gmail.com>.
if you can find another way to abort creation of a class instance in
java feel free to let us know.
-igor
On Thu, Jun 26, 2008 at 4:29 AM, Eyal Golan <eg...@gmail.com> wrote:
> Igor,
> That is what we used before.
> Then I looked on the links above, tried the setResponsePage and found out
> that it works.
> After your answer, I understand that it does pollute the page map.
>
> I'll change to use the Exception instead.
> IMHO it's not a "nice" way to implement such a feature.
>
> On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <ig...@gmail.com>
> wrote:
>
>> use restartresponseexception instead
>>
>> -igor
>>
>> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
>> > Hi,
>> > After reviewing some discussion regarding the issue.
>> > http://issues.apache.org/jira/browse/WICKET-696
>> >
>> > and
>> >
>> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
>> >
>> > What is the conclusion?
>> > Is the original page being mapped or no?
>> >
>> > thanks
>> >
>> > --
>> > Eyal Golan
>> > egolan74@gmail.com
>> >
>> > Visit: http://jvdrums.sourceforge.net/
>> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >
>> > P Save a tree. Please don't print this e-mail unless it's really
>> necessary
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P Save a tree. Please don't print this e-mail unless it's really necessary
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: redirect page in the constructor
Posted by Eyal Golan <eg...@gmail.com>.
Igor,
That is what we used before.
Then I looked on the links above, tried the setResponsePage and found out
that it works.
After your answer, I understand that it does pollute the page map.
I'll change to use the Exception instead.
IMHO it's not a "nice" way to implement such a feature.
On Wed, Jun 25, 2008 at 5:11 PM, Igor Vaynberg <ig...@gmail.com>
wrote:
> use restartresponseexception instead
>
> -igor
>
> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
> > Hi,
> > After reviewing some discussion regarding the issue.
> > http://issues.apache.org/jira/browse/WICKET-696
> >
> > and
> >
> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
> >
> > What is the conclusion?
> > Is the original page being mapped or no?
> >
> > thanks
> >
> > --
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P Save a tree. Please don't print this e-mail unless it's really
> necessary
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Eyal Golan
egolan74@gmail.com
Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74
P Save a tree. Please don't print this e-mail unless it's really necessary
Re: redirect page in the constructor
Posted by Igor Vaynberg <ig...@gmail.com>.
use restartresponseexception instead
-igor
On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <eg...@gmail.com> wrote:
> Hi,
> After reviewing some discussion regarding the issue.
> http://issues.apache.org/jira/browse/WICKET-696
>
> and
> http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg30288.html
>
> What is the conclusion?
> Is the original page being mapped or no?
>
> thanks
>
> --
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P Save a tree. Please don't print this e-mail unless it's really necessary
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org