The solution you posted there looks workable. Instead of throwing an
AbortException, I'd just call
RequestCycle.get().setRequestTarget(...). However, it seems that to
prevent the rest of my constructor from running (due to the error), I
have to explicitly call 'return' (ie. can't use exception to get out
of constructor). Is there any way I could exit without calling
'return'?

Ok, if that wasn't clear, what I'd like to do is to have a method
requireParameter(PageParams pp, String paramName) in my BasePage, so
that if the paramName value is missing, the constructor would exit
immediately with a redirect or error page. Using exceptions, I'd be
able to simply call:

  requireParameter(...)

and it could throw an exception which would take care of the control
flow of the program. But instead, what I seem to be doing now is:

  if (isMissingParameter(params, paramName))  return;

which is more verbose, but definitely not hideous.

On 5/10/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> See https://issues.apache.org/jira/browse/WICKET-552
>
> On 5/10/07, Lowell Kirsh <[EMAIL PROTECTED]> wrote:
> > I easily reproduced this problem. I did not use svn access, but
> > instead went to the wicket main page and downloaded the 1.2.6
> > quickstart. I ran it and it worked. Then I went to the Index.java and
> > inserted the following line in the constructor:
> >
> > throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_BAD_REQUEST,
> >             "FOOBAR");
> >
> > I went to my web browser, and again, blank page. Then I went to the
> > command line and typed:
> >
> > $ wget http://localhost:8081/quickstart/app
> >
> > I get a 200 status code, with empty body:
> >
> > --14:50:42--  http://localhost:8081/quickstart/app
> >            => `app.1'
> > Resolving localhost... done.
> > Connecting to localhost[127.0.0.1]:8081... connected.
> > HTTP request sent, awaiting response... 200 OK
> > Length: unspecified
> >
> >     [ <=>
> >                                                 ] 0
> > --.--K/s
> >
> > 14:50:42 (0.00 B/s) - `app.1' saved [0]
> >
> >
> > So do you think this is a bug?
> >
> > Lowell
> >
> > On 5/9/07, Johan Compagner <[EMAIL PROTECTED]> wrote:
> > > yes see our quickstart project in svn
> > >
> > > i can try to build an example for this
> > > for example if i change one of the wicket examples homepages that it 
> > > throws
> > > such an exception
> > > does it fail then?
> > >
> > > johan
> > >
> > >
> > > On 5/9/07, Lowell Kirsh <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > do you have a quickstart that you can attach to a jira issue?
> > > >
> > > > What do you mean by this? Is a quickstart some sort of self-contained
> > > > minimal jar?
> > > >
> > > >
> > > -------------------------------------------------------------------------
> > > > This SF.net email is sponsored by DB2 Express
> > > > Download DB2 Express C - the FREE version of DB2 express and take
> > > > control of your XML. No limits. Just data. Click to get it now.
> > > > http://sourceforge.net/powerbar/db2/
> > > > _______________________________________________
> > > > Wicket-user mailing list
> > > > [email protected]
> > > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >
> > >
> > >
> > > -------------------------------------------------------------------------
> > > This SF.net email is sponsored by DB2 Express
> > > Download DB2 Express C - the FREE version of DB2 express and take
> > > control of your XML. No limits. Just data. Click to get it now.
> > > http://sourceforge.net/powerbar/db2/
> > > _______________________________________________
> > > Wicket-user mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> > >
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to