You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Michael Sparer <mi...@gmx.at> on 2008/04/02 11:41:58 UTC

Throw AbortWithWebErrorCodeException in onBeforeRender

(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
[BookmarkablePageRequestTarget@915729617 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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Throw AbortWithWebErrorCodeException in onBeforeRender

Posted by Michael Sparer <mi...@gmx.at>.
While creating a quickstart for the jira issue, I noticed that it only occurs
when using custom error pages as described on
http://cwiki.apache.org/WICKET/error-pages-and-feedback-messages.html ... so
maybe jetty creates a new (internal) web request and the application gets
detached before the "old" request can be cleaned up properly. as far as i
could see the getApplication method is only needed for checking if the app
is in development mode and does some additional cleanup if it is ... anyway,
the issue can be found on https://issues.apache.org/jira/browse/WICKET-1478

regards, 
Michael

igor.vaynberg wrote:
> 
> jira...
> 
> -igor
> 
> On Wed, Apr 2, 2008 at 2:41 AM, Michael Sparer <mi...@gmx.at>
> 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
>>  [BookmarkablePageRequestTarget@915729617 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: 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
> 
> 
> 


-----
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: http://www.nabble.com/Throw-AbortWithWebErrorCodeException-in-onBeforeRender-tp16446341p16487488.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Throw AbortWithWebErrorCodeException in onBeforeRender

Posted by Igor Vaynberg <ig...@gmail.com>.
jira...

-igor

On Wed, Apr 2, 2008 at 2:41 AM, Michael Sparer <mi...@gmx.at> 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
>  [BookmarkablePageRequestTarget@915729617 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: 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: Throw AbortWithWebErrorCodeException in onBeforeRender

Posted by Johan Compagner <jc...@gmail.com>.
thats really a strange error at that time the application should still be
there.


On Wed, Apr 2, 2008 at 11:41 AM, Michael Sparer <mi...@gmx.at>
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
> [BookmarkablePageRequestTarget@915729617 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Throw AbortWithWebErrorCodeException in onBeforeRender

Posted by Michael Sparer <mi...@gmx.at>.
Maybe I didn't explain it precise enough, the subclass ain't the right place
to do that cause my usecase is like:

class Super {
    onBeforeRender() {
         if (!isValid()) {
             throw Abort...Exception(404);
         }
    }

    abstract boolean isValid();
}

class Sub extends Super{
    boolean isValid() {
         return false;
    }
}

to see it "in action" take a look at the quickstart attached to the jira
issue :)
https://issues.apache.org/jira/browse/WICKET-1478

regards,
Michael

lars vonk wrote:
> 
> 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 <mi...@gmx.at>
> 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
>> [BookmarkablePageRequestTarget@915729617 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 


-----
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: http://www.nabble.com/Throw-AbortWithWebErrorCodeException-in-onBeforeRender-tp16446341p16487491.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: should DataView.setItemsPerPage(int items) be in IDataProvider?

Posted by Igor Vaynberg <ig...@gmail.com>.
what is that have to do with dataprovider? i think you are doing
something very strange. maybe you should subclass the dataview instead
of dataprovider

-igor


On Thu, Apr 3, 2008 at 5:22 PM, i ii <kh...@hotmail.com> wrote:
>
>  i need update method to know how many items updated out of how many items shown on page
>
>  > Date: Thu, 3 Apr 2008 10:02:18 -0700
>  > From: igor.vaynberg@gmail.com
>
>
> > To: users@wicket.apache.org
>  > Subject: Re: should DataView.setItemsPerPage(int items) be in IDataProvider?
>  >
>  > whats the usecase there?
>  >
>  > -igor
>  >
>  > On Thu, Apr 3, 2008 at 6:29 AM, i ii <kh...@hotmail.com> wrote:
>  > >
>  > >  but what if items per page is needed not in iterator?
>  > >
>  > >  > Date: Thu, 3 Apr 2008 15:08:27 +0200
>  > >  > From: martijn.dashorst@gmail.com
>  > >  > To: users@wicket.apache.org
>  > >  > Subject: Re: should DataView.setItemsPerPage(int items) be in IDataProvider?
>  > >
>  > >
>  > > >
>  > >  > iterator(int start, int count)
>  > >  >
>  > >  > the count parameter is the items per page.
>  > >  >
>  > >  > Martijn
>  > >  >
>  > >  > On 4/3/08, i ii <kh...@hotmail.com> wrote:
>  > >  > >
>  > >  > >  when i need to get items per page in data provider i cannot unless i have data view. should this method be in data provider and not data view? the data provider is providing data and items per page is data, no?
>  > >  > >
>  > >  >
>  > >  >
>  > >  > --
>  > >  > Buy Wicket in Action: http://manning.com/dashorst
>  > >  > Apache Wicket 1.3.2 is released
>  > >  > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2
>  > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  > 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: should DataView.setItemsPerPage(int items) be in IDataProvider?

Posted by i ii <kh...@hotmail.com>.
i need update method to know how many items updated out of how many items shown on page

> Date: Thu, 3 Apr 2008 10:02:18 -0700
> From: igor.vaynberg@gmail.com
> To: users@wicket.apache.org
> Subject: Re: should DataView.setItemsPerPage(int items) be in IDataProvider?
> 
> whats the usecase there?
> 
> -igor
> 
> On Thu, Apr 3, 2008 at 6:29 AM, i ii <kh...@hotmail.com> wrote:
> >
> >  but what if items per page is needed not in iterator?
> >
> >  > Date: Thu, 3 Apr 2008 15:08:27 +0200
> >  > From: martijn.dashorst@gmail.com
> >  > To: users@wicket.apache.org
> >  > Subject: Re: should DataView.setItemsPerPage(int items) be in IDataProvider?
> >
> >
> > >
> >  > iterator(int start, int count)
> >  >
> >  > the count parameter is the items per page.
> >  >
> >  > Martijn
> >  >
> >  > On 4/3/08, i ii <kh...@hotmail.com> wrote:
> >  > >
> >  > >  when i need to get items per page in data provider i cannot unless i have data view. should this method be in data provider and not data view? the data provider is providing data and items per page is data, no?
> >  > >
> >  >
> >  >
> >  > --
> >  > Buy Wicket in Action: http://manning.com/dashorst
> >  > Apache Wicket 1.3.2 is released
> >  > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2
> >  >
> >  > ---------------------------------------------------------------------
> >  > 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: should DataView.setItemsPerPage(int items) be in IDataProvider?

Posted by Igor Vaynberg <ig...@gmail.com>.
whats the usecase there?

-igor

On Thu, Apr 3, 2008 at 6:29 AM, i ii <kh...@hotmail.com> wrote:
>
>  but what if items per page is needed not in iterator?
>
>  > Date: Thu, 3 Apr 2008 15:08:27 +0200
>  > From: martijn.dashorst@gmail.com
>  > To: users@wicket.apache.org
>  > Subject: Re: should DataView.setItemsPerPage(int items) be in IDataProvider?
>
>
> >
>  > iterator(int start, int count)
>  >
>  > the count parameter is the items per page.
>  >
>  > Martijn
>  >
>  > On 4/3/08, i ii <kh...@hotmail.com> wrote:
>  > >
>  > >  when i need to get items per page in data provider i cannot unless i have data view. should this method be in data provider and not data view? the data provider is providing data and items per page is data, no?
>  > >
>  >
>  >
>  > --
>  > Buy Wicket in Action: http://manning.com/dashorst
>  > Apache Wicket 1.3.2 is released
>  > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2
>  >
>  > ---------------------------------------------------------------------
>  > 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: should DataView.setItemsPerPage(int items) be in IDataProvider?

Posted by i ii <kh...@hotmail.com>.
but what if items per page is needed not in iterator?

> Date: Thu, 3 Apr 2008 15:08:27 +0200
> From: martijn.dashorst@gmail.com
> To: users@wicket.apache.org
> Subject: Re: should DataView.setItemsPerPage(int items) be in IDataProvider?
> 
> iterator(int start, int count)
> 
> the count parameter is the items per page.
> 
> Martijn
> 
> On 4/3/08, i ii <kh...@hotmail.com> wrote:
> >
> >  when i need to get items per page in data provider i cannot unless i have data view. should this method be in data provider and not data view? the data provider is providing data and items per page is data, no?
> >
> 
> 
> -- 
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.2 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

Re: should DataView.setItemsPerPage(int items) be in IDataProvider?

Posted by Martijn Dashorst <ma...@gmail.com>.
iterator(int start, int count)

the count parameter is the items per page.

Martijn

On 4/3/08, i ii <kh...@hotmail.com> wrote:
>
>  when i need to get items per page in data provider i cannot unless i have data view. should this method be in data provider and not data view? the data provider is providing data and items per page is data, no?
>


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.2 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2

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


should DataView.setItemsPerPage(int items) be in IDataProvider?

Posted by i ii <kh...@hotmail.com>.
when i need to get items per page in data provider i cannot unless i have data view. should this method be in data provider and not data view? the data provider is providing data and items per page is data, no?

Re: Throw AbortWithWebErrorCodeException in onBeforeRender

Posted by lars vonk <la...@gmail.com>.
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 <mi...@gmx.at>
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
> [BookmarkablePageRequestTarget@915729617 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>