Why not implement this in the subclass itself? It sounds really specific for
a certain class right? So I think the subclass itself is the correct place.

On Wed, Apr 2, 2008 at 11:41 AM, Michael Sparer <[EMAIL PROTECTED]>
wrote:

>
> (Using wicket 1.3.2) I have a super class (WebPage) that throws a
> AbortWithWebErrorCodeException(404) depending on some properties of its
> subclasses. Therefore I can't check the subclasses' properties in the
> super
> class' constructor and throw the exception there.
> So I tried to throw it in the onBeforeRender method instead. The Error
> page
> for the 404 gets rendered and displayed without problems however an
> exception gets thrown (see below).
>
> So my question: where's the (right) place to throw the exception? I also
> tried RequestCycle.get().setRequestTarget(new
> WebErrorCodeResponseTarget(404)); with the same result.
>
> thanks in advance
>
> michael
>
> exception trace:
> ERROR - RequestCycle               - there was an error cleaning up target
> [EMAIL PROTECTED] pageClass=XXXXXXXX].
> org.apache.wicket.WicketRuntimeException: There is no application attached
> to current thread btpool0-2
>        at org.apache.wicket.Application.get(Application.java:166)
>        at org.apache.wicket.Component.getApplication(Component.java:1229)
>        at org.apache.wicket.markup.html.WebPage.onDetach(WebPage.java:404)
>        at org.apache.wicket.Component.detach(Component.java:1075)
>        at
>
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.detach(BookmarkablePageRequestTarget.java:122)
>        at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1046)
>        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1348)
>        at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
>        at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:358)
>        at
>
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
>        at
>
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
>        at
>
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>        at
>
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
>        at
>
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
>
> -----
> Michael Sparer
> http://talk-on-tech.blogspot.com
> --
> View this message in context:
> http://www.nabble.com/Throw-AbortWithWebErrorCodeException-in-onBeforeRender-tp16446341p16446341.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to