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 <[EMAIL PROTECTED]>
wrote:
> On Mon, Jun 30, 2008 at 11:59 AM, Bruno Borges <[EMAIL PROTECTED]>
> 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 <[EMAIL PROTECTED]
> >
> > wrote:
> >
> >> does it work?
> >>
> >> -igor
> >>
> >> On Mon, Jun 30, 2008 at 2:28 AM, Eyal Golan <[EMAIL PROTECTED]> 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 <
> [EMAIL PROTECTED]>
> >> > wrote:
> >> >
> >> >> use restartresponseexception instead
> >> >>
> >> >> -igor
> >> >>
> >> >> On Wed, Jun 25, 2008 at 5:36 AM, Eyal Golan <[EMAIL PROTECTED]>
> wrote:
> >> >> > Hi,
> >> >> > After reviewing some discussion regarding the issue.
> >> >> > http://issues.apache.org/jira/browse/WICKET-696
> >> >> >
> >> >> > and
> >> >> >
> >> >>
> >>
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg30288.html
> >> >> >
> >> >> > What is the conclusion?
> >> >> > Is the original page being mapped or no?
> >> >> >
> >> >> > thanks
> >> >> >
> >> >> > --
> >> >> > Eyal Golan
> >> >> > [EMAIL PROTECTED]
> >> >> >
> >> >> > 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: [EMAIL PROTECTED]
> >> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Eyal Golan
> >> > [EMAIL PROTECTED]
> >> >
> >> > 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: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>