You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tobias Gierke <to...@voipfuture.com> on 2014/10/10 11:12:32 UTC

Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Hi,

In our web application we have a dashboard-like homepage that displays a 
number of user-configurable 'portlets' (which are really just ordinary 
Wicket components and have nothing to do with the Portlet spec). I'm 
looking for a way of preventing the application from becoming unusable 
in case one or more of these portlets continuously fail to render 
because of some internal error/bug.

We're currently using a custom RequestCycleListener with the 
onException() method redirecting to a generic error page, thus when 
rendering of a 'portlet' fails the user will never get to see the 
homepage and always end up on the error page - which is obviously not 
really desirable.

Is there a way to to hook into Wicket's rendering cycle so that I can 
provide some default markup in case rendering of a component (subtree) 
fails with a RuntimeException ?

I understand that this maybe be very tricky since the component subtree 
might've rendered partially and thus internal state will be 
inconsistent. It would probably require serializing the initial state of 
the component (subtree) before rendering starts and reverting the wholle 
subtree to its initial state once a RuntimeException is thrown.

We're running Wicket 1.5.12.

Thanks in advance,
Tobias

-- 
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 164 Fax +49 40 688 900 199
Email tobias.gierke@voipfuture.com   Web http://www.voipfuture.com
  
CEO Jan Bastian
	
Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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


Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
it seems no :-(

On Tue, Oct 14, 2014 at 11:16 AM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> It is already good for people wanting/needing to use it :-)
>
> Is there any other way to hook into onRender? Any way to avoid onRender
> being called via a global listener? If component is intanceof Bla don't
> call onRender?
>
> On Tue, Oct 14, 2014 at 10:47 AM, Martin Grigorov <mg...@apache.org>
> wrote:
>
>> Oops. It seems PortletLike (a copy of PanelA with an exception in the
>> rendering of its Label child) hasn't be added to Git ...
>>
>> I've refactored it even further.
>> But as you can see the default rendering of a component should be
>> suppressed (PortletLike#onRender() {}) so it is not enough just to have
>> the
>> behavior.
>>
>> This is just a simple demo.
>> I'd like some feedback from a real usage before even thinking about adding
>> this to core.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Tue, Oct 14, 2014 at 1:24 PM, Ernesto Reinaldo Barreiro <
>> reiern70@gmail.com> wrote:
>>
>> > Martin,
>> >
>> > PortletLike b = new PortletLike("b", Model.of("panel b"))... I can't
>> > see a PortletLike...
>> > on same package. Maybe a good way to use the behavior is: 1- Roll a
>> > PorletLikeBehavior. and an Interface IPorletLike { CharSequence
>> > getOnFailContents(); } to mark porlet like components. 2- Add a
>> component
>> > instantiation listener that if a component implement IPorletLike
>> > automatically adds the behavior.
>> >
>> > On Tue, Oct 14, 2014 at 10:14 AM, Martin Grigorov <mgrigorov@apache.org
>> >
>> > wrote:
>> >
>> > > Hi Ernesto,
>> > >
>> > > I didn't get the question.
>> > >
>> > > Martin Grigorov
>> > > Wicket Training and Consulting
>> > > https://twitter.com/mtgrigorov
>> > >
>> > > On Tue, Oct 14, 2014 at 1:10 PM, Ernesto Reinaldo Barreiro <
>> > > reiern70@gmail.com> wrote:
>> > >
>> > > > Thanks! Whose PortletLike on
>> > > >
>> > > >
>> > >
>> >
>> https://github.com/martin-g/component-rendering-default/blob/master/src/main/java/com/mycompany/HomePage.java
>> > > > ?
>> > > > PanelA?
>> > > >
>> > > > On Tue, Oct 14, 2014 at 9:03 AM, Martin Grigorov <
>> mgrigorov@apache.org
>> > >
>> > > > wrote:
>> > > >
>> > > > > Hi,
>> > > > >
>> > > > > Here is a demo app with Wicket 6.x:
>> > > > > https://github.com/martin-g/component-rendering-default
>> > > > >
>> > > > > Martin Grigorov
>> > > > > Wicket Training and Consulting
>> > > > > https://twitter.com/mtgrigorov
>> > > > >
>> > > > > On Mon, Oct 13, 2014 at 6:13 PM, Martin Grigorov <
>> > mgrigorov@apache.org
>> > > >
>> > > > > wrote:
>> > > > >
>> > > > > > Here is a possible solution *now*:
>> > > > > >
>> > > > > > portletLike.add(new AbstractTransformerBehavior() {
>> > > > > >   @Override public CharSequence transform(Component c,
>> CharSequence
>> > > > > > output) {
>> > > > > >      try {
>> > > > > >        c.internalRenderComponent();
>> > > > > >      } catch (Exception x) {
>> > > > > >        return "default result";
>> > > > > >      }
>> > > > > >    }
>> > > > > > });
>> > > > > >
>> > > > > > Something like this should do it.
>> > > > > >
>> > > > > > Martin Grigorov
>> > > > > > Wicket Training and Consulting
>> > > > > > https://twitter.com/mtgrigorov
>> > > > > >
>> > > > > > On Mon, Oct 13, 2014 at 5:39 PM, Ernesto Reinaldo Barreiro <
>> > > > > > reiern70@gmail.com> wrote:
>> > > > > >
>> > > > > >> I see... you may have already streamed content --> Maybe same
>> > > > interface
>> > > > > >> serves to mark a component as "do not stream anything till the
>> > end",
>> > > > or
>> > > > > >> stream the contents to an intermediate buffer... but what I way
>> > > above
>> > > > > >> might
>> > > > > >> not make sense as well.
>> > > > > >>
>> > > > > >>
>> > > > > >> On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <
>> > > > mgrigorov@apache.org>
>> > > > > >> wrote:
>> > > > > >>
>> > > > > >> > On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
>> > > > > >> > reiern70@gmail.com> wrote:
>> > > > > >> >
>> > > > > >> > > @Martin,
>> > > > > >> > >
>> > > > > >> > > Just a (maybe stupid) idea:
>> > > > > >> > >
>> > > > > >> > > 1- Mark some component as ISafeFail
>> > > > > >> > > 2- If rendering fails take Component_onfail.html and
>> render it
>> > > > > >> > >
>> > > > > >> >
>> > > > > >> > As I said earlier this is not so trivial.
>> > > > > >> > The failure may happen in the middle of the rendering and the
>> > > > content
>> > > > > >> > collected so far in RequestCycle#getResponse() could be
>> invalid
>> > > > HTML.
>> > > > > >> > Appending anything (loaded from a file or generated on the
>> fly)
>> > is
>> > > > not
>> > > > > >> > really a solution.
>> > > > > >> >
>> > > > > >> >
>> > > > > >> > >
>> > > > > >> > > On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <
>> > > > > >> mgrigorov@apache.org>
>> > > > > >> > > wrote:
>> > > > > >> > >
>> > > > > >> > > > https://issues.apache.org/jira/browse/WICKET-4321
>> > > > > >> > > > this is the ticker I meant
>> > > > > >> > > > it suggests to restart the rendering completely for the
>> > whole
>> > > > page
>> > > > > >> and
>> > > > > >> > > this
>> > > > > >> > > > is not enough
>> > > > > >> > > > I'll see what kind of changes would be needed to
>> accomplish
>> > > > this.
>> > > > > >> > > >
>> > > > > >> > > > Martin Grigorov
>> > > > > >> > > > Wicket Training and Consulting
>> > > > > >> > > > https://twitter.com/mtgrigorov
>> > > > > >> > > >
>> > > > > >> > > > On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <
>> > > > > >> mgrigorov@apache.org
>> > > > > >> > >
>> > > > > >> > > > wrote:
>> > > > > >> > > >
>> > > > > >> > > > > Hi,
>> > > > > >> > > > >
>> > > > > >> > > > > There is no support for this, even in 7.x.
>> > > > > >> > > > > I remember Carl-Eric Menzel asking for the same
>> > > functionality
>> > > > > >> before
>> > > > > >> > > ...
>> > > > > >> > > > > Behavior#onException() sounds like something similar
>> but
>> > > there
>> > > > > is
>> > > > > >> no
>> > > > > >> > > way
>> > > > > >> > > > > to suppress the bubbling of the exception at the
>> moment.
>> > > > > >> > > > > The bigger problem is that the rendering can fail in
>> the
>> > > > middle,
>> > > > > >> i.e.
>> > > > > >> > > the
>> > > > > >> > > > > component can have written some response already and
>> then
>> > > > fail.
>> > > > > If
>> > > > > >> > the
>> > > > > >> > > > > written response is proper HTML then it is OKish. But
>> if
>> > > some
>> > > > > tag
>> > > > > >> is
>> > > > > >> > > not
>> > > > > >> > > > > closed then the rendering of the complete page may
>> fail.
>> > > > > >> > > > > So if we try to add this functionality we will have to
>> use
>> > > > > >> temporary
>> > > > > >> > > > > Response objects for the rendering of each component
>> to be
>> > > > able
>> > > > > to
>> > > > > >> > > throw
>> > > > > >> > > > > away whatever it has produced before failing.
>> > > > > >> > > > >
>> > > > > >> > > > > Usually the problem is related to the component's
>> model. A
>> > > > > >> workaround
>> > > > > >> > > for
>> > > > > >> > > > > you could be to use a wrapper Model that returns "empty
>> > > data"
>> > > > > when
>> > > > > >> > the
>> > > > > >> > > > > underlying model throws an exception.
>> > > > > >> > > > >
>> > > > > >> > > > > Martin Grigorov
>> > > > > >> > > > > Wicket Training and Consulting
>> > > > > >> > > > > https://twitter.com/mtgrigorov
>> > > > > >> > > > >
>> > > > > >> > > > > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo
>> > Barreiro
>> > > <
>> > > > > >> > > > > reiern70@gmail.com> wrote:
>> > > > > >> > > > >
>> > > > > >> > > > >> Hi,
>> > > > > >> > > > >>
>> > > > > >> > > > >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
>> > > > > >> > > > >> tobias.gierke@voipfuture.com> wrote:
>> > > > > >> > > > >>
>> > > > > >> > > > >> > Hi,
>> > > > > >> > > > >> >
>> > > > > >> > > > >> >> Wouldn't it be possible to "embed"  the failing
>> prone
>> > > > > porlets
>> > > > > >> > > inside
>> > > > > >> > > > >> >> iframes so that each one is a Wicket page?
>> > > > > >> > > > >> >>
>> > > > > >> > > > >> > I already thought about this but the page uses
>> quite a
>> > > lot
>> > > > of
>> > > > > >> > fancy
>> > > > > >> > > > >> > CSS/Ajax/Javascript (portlets are rendered in a grid
>> > with
>> > > > > >> > > configurable
>> > > > > >> > > > >> > row/column count, drag'n'drop to move them around
>> etc.)
>> > > and
>> > > > > I'd
>> > > > > >> > > rather
>> > > > > >> > > > >> not
>> > > > > >> > > > >> > touch the existing code if there's a Java-side only
>> > > > solution
>> > > > > >> ;-)
>> > > > > >> > > > >> >
>> > > > > >> > > > >>
>> > > > > >> > > > >> I do not know of any :-(
>> > > > > >> > > > >>
>> > > > > >> > > > >> Another possibility is build each client entirely on
>> > > > JavaScript
>> > > > > >> and
>> > > > > >> > > use
>> > > > > >> > > > >> Wicket just as a service layer... not very Wicket like
>> > but
>> > > > you
>> > > > > >> would
>> > > > > >> > > not
>> > > > > >> > > > >> have this problem.
>> > > > > >> > > > >>
>> > > > > >> > > > >>
>> > > > > >> > > > >> >
>> > > > > >> > > > >> > Cheers,
>> > > > > >> > > > >> > Tobias
>> > > > > >> > > > >> >
>> > > > > >> > > > >> >
>> > > > > >> > > > >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
>> > > > > >> > > > >> >> tobias.gierke@voipfuture.com> wrote:
>> > > > > >> > > > >> >>
>> > > > > >> > > > >> >>  Hi,
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>> In our web application we have a dashboard-like
>> > > homepage
>> > > > > that
>> > > > > >> > > > >> displays a
>> > > > > >> > > > >> >>> number of user-configurable 'portlets' (which are
>> > > really
>> > > > > just
>> > > > > >> > > > ordinary
>> > > > > >> > > > >> >>> Wicket components and have nothing to do with the
>> > > Portlet
>> > > > > >> spec).
>> > > > > >> > > I'm
>> > > > > >> > > > >> >>> looking for a way of preventing the application
>> from
>> > > > > becoming
>> > > > > >> > > > >> unusable in
>> > > > > >> > > > >> >>> case one or more of these portlets continuously
>> fail
>> > to
>> > > > > >> render
>> > > > > >> > > > >> because of
>> > > > > >> > > > >> >>> some internal error/bug.
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>> We're currently using a custom
>> RequestCycleListener
>> > > with
>> > > > > the
>> > > > > >> > > > >> >>> onException()
>> > > > > >> > > > >> >>> method redirecting to a generic error page, thus
>> when
>> > > > > >> rendering
>> > > > > >> > > of a
>> > > > > >> > > > >> >>> 'portlet' fails the user will never get to see the
>> > > > homepage
>> > > > > >> and
>> > > > > >> > > > always
>> > > > > >> > > > >> >>> end
>> > > > > >> > > > >> >>> up on the error page - which is obviously not
>> really
>> > > > > >> desirable.
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>> Is there a way to to hook into Wicket's rendering
>> > cycle
>> > > > so
>> > > > > >> that
>> > > > > >> > I
>> > > > > >> > > > can
>> > > > > >> > > > >> >>> provide some default markup in case rendering of a
>> > > > > component
>> > > > > >> > > > (subtree)
>> > > > > >> > > > >> >>> fails with a RuntimeException ?
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>> I understand that this maybe be very tricky since
>> the
>> > > > > >> component
>> > > > > >> > > > >> subtree
>> > > > > >> > > > >> >>> might've rendered partially and thus internal
>> state
>> > > will
>> > > > be
>> > > > > >> > > > >> inconsistent.
>> > > > > >> > > > >> >>> It would probably require serializing the initial
>> > state
>> > > > of
>> > > > > >> the
>> > > > > >> > > > >> component
>> > > > > >> > > > >> >>> (subtree) before rendering starts and reverting
>> the
>> > > > wholle
>> > > > > >> > subtree
>> > > > > >> > > > to
>> > > > > >> > > > >> its
>> > > > > >> > > > >> >>> initial state once a RuntimeException is thrown.
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>> We're running Wicket 1.5.12.
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>> Thanks in advance,
>> > > > > >> > > > >> >>> Tobias
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>> --
>> > > > > >> > > > >> >>> Tobias Gierke
>> > > > > >> > > > >> >>> Development
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,
>> > > > Germany
>> > > > > >> > > > >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
>> > > > > >> > > > >> >>> Email tobias.gierke@voipfuture.com   Web
>> > > > > >> > > http://www.voipfuture.com
>> > > > > >> > > > >> >>>   CEO Jan Bastian
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID
>> > > > > DE263738086
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>>
>> > > > > >> > > > >> >>>
>> > > > > >> > > >
>> > > > > >>
>> > > ---------------------------------------------------------------------
>> > > > > >> > > > >> >>> 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
>> > > > > >> > > > >> >
>> > > > > >> > > > >> >
>> > > > > >> > > > >>
>> > > > > >> > > > >>
>> > > > > >> > > > >> --
>> > > > > >> > > > >> Regards - Ernesto Reinaldo Barreiro
>> > > > > >> > > > >>
>> > > > > >> > > > >
>> > > > > >> > > > >
>> > > > > >> > > >
>> > > > > >> > >
>> > > > > >> > >
>> > > > > >> > >
>> > > > > >> > > --
>> > > > > >> > > Regards - Ernesto Reinaldo Barreiro
>> > > > > >> > >
>> > > > > >> >
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >> --
>> > > > > >> Regards - Ernesto Reinaldo Barreiro
>> > > > > >>
>> > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > Regards - Ernesto Reinaldo Barreiro
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > Regards - Ernesto Reinaldo Barreiro
>> >
>>
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
It is already good for people wanting/needing to use it :-)

Is there any other way to hook into onRender? Any way to avoid onRender
being called via a global listener? If component is intanceof Bla don't
call onRender?

On Tue, Oct 14, 2014 at 10:47 AM, Martin Grigorov <mg...@apache.org>
wrote:

> Oops. It seems PortletLike (a copy of PanelA with an exception in the
> rendering of its Label child) hasn't be added to Git ...
>
> I've refactored it even further.
> But as you can see the default rendering of a component should be
> suppressed (PortletLike#onRender() {}) so it is not enough just to have the
> behavior.
>
> This is just a simple demo.
> I'd like some feedback from a real usage before even thinking about adding
> this to core.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, Oct 14, 2014 at 1:24 PM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
> > Martin,
> >
> > PortletLike b = new PortletLike("b", Model.of("panel b"))... I can't
> > see a PortletLike...
> > on same package. Maybe a good way to use the behavior is: 1- Roll a
> > PorletLikeBehavior. and an Interface IPorletLike { CharSequence
> > getOnFailContents(); } to mark porlet like components. 2- Add a component
> > instantiation listener that if a component implement IPorletLike
> > automatically adds the behavior.
> >
> > On Tue, Oct 14, 2014 at 10:14 AM, Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> > > Hi Ernesto,
> > >
> > > I didn't get the question.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Tue, Oct 14, 2014 at 1:10 PM, Ernesto Reinaldo Barreiro <
> > > reiern70@gmail.com> wrote:
> > >
> > > > Thanks! Whose PortletLike on
> > > >
> > > >
> > >
> >
> https://github.com/martin-g/component-rendering-default/blob/master/src/main/java/com/mycompany/HomePage.java
> > > > ?
> > > > PanelA?
> > > >
> > > > On Tue, Oct 14, 2014 at 9:03 AM, Martin Grigorov <
> mgrigorov@apache.org
> > >
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > Here is a demo app with Wicket 6.x:
> > > > > https://github.com/martin-g/component-rendering-default
> > > > >
> > > > > Martin Grigorov
> > > > > Wicket Training and Consulting
> > > > > https://twitter.com/mtgrigorov
> > > > >
> > > > > On Mon, Oct 13, 2014 at 6:13 PM, Martin Grigorov <
> > mgrigorov@apache.org
> > > >
> > > > > wrote:
> > > > >
> > > > > > Here is a possible solution *now*:
> > > > > >
> > > > > > portletLike.add(new AbstractTransformerBehavior() {
> > > > > >   @Override public CharSequence transform(Component c,
> CharSequence
> > > > > > output) {
> > > > > >      try {
> > > > > >        c.internalRenderComponent();
> > > > > >      } catch (Exception x) {
> > > > > >        return "default result";
> > > > > >      }
> > > > > >    }
> > > > > > });
> > > > > >
> > > > > > Something like this should do it.
> > > > > >
> > > > > > Martin Grigorov
> > > > > > Wicket Training and Consulting
> > > > > > https://twitter.com/mtgrigorov
> > > > > >
> > > > > > On Mon, Oct 13, 2014 at 5:39 PM, Ernesto Reinaldo Barreiro <
> > > > > > reiern70@gmail.com> wrote:
> > > > > >
> > > > > >> I see... you may have already streamed content --> Maybe same
> > > > interface
> > > > > >> serves to mark a component as "do not stream anything till the
> > end",
> > > > or
> > > > > >> stream the contents to an intermediate buffer... but what I way
> > > above
> > > > > >> might
> > > > > >> not make sense as well.
> > > > > >>
> > > > > >>
> > > > > >> On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <
> > > > mgrigorov@apache.org>
> > > > > >> wrote:
> > > > > >>
> > > > > >> > On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
> > > > > >> > reiern70@gmail.com> wrote:
> > > > > >> >
> > > > > >> > > @Martin,
> > > > > >> > >
> > > > > >> > > Just a (maybe stupid) idea:
> > > > > >> > >
> > > > > >> > > 1- Mark some component as ISafeFail
> > > > > >> > > 2- If rendering fails take Component_onfail.html and render
> it
> > > > > >> > >
> > > > > >> >
> > > > > >> > As I said earlier this is not so trivial.
> > > > > >> > The failure may happen in the middle of the rendering and the
> > > > content
> > > > > >> > collected so far in RequestCycle#getResponse() could be
> invalid
> > > > HTML.
> > > > > >> > Appending anything (loaded from a file or generated on the
> fly)
> > is
> > > > not
> > > > > >> > really a solution.
> > > > > >> >
> > > > > >> >
> > > > > >> > >
> > > > > >> > > On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <
> > > > > >> mgrigorov@apache.org>
> > > > > >> > > wrote:
> > > > > >> > >
> > > > > >> > > > https://issues.apache.org/jira/browse/WICKET-4321
> > > > > >> > > > this is the ticker I meant
> > > > > >> > > > it suggests to restart the rendering completely for the
> > whole
> > > > page
> > > > > >> and
> > > > > >> > > this
> > > > > >> > > > is not enough
> > > > > >> > > > I'll see what kind of changes would be needed to
> accomplish
> > > > this.
> > > > > >> > > >
> > > > > >> > > > Martin Grigorov
> > > > > >> > > > Wicket Training and Consulting
> > > > > >> > > > https://twitter.com/mtgrigorov
> > > > > >> > > >
> > > > > >> > > > On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <
> > > > > >> mgrigorov@apache.org
> > > > > >> > >
> > > > > >> > > > wrote:
> > > > > >> > > >
> > > > > >> > > > > Hi,
> > > > > >> > > > >
> > > > > >> > > > > There is no support for this, even in 7.x.
> > > > > >> > > > > I remember Carl-Eric Menzel asking for the same
> > > functionality
> > > > > >> before
> > > > > >> > > ...
> > > > > >> > > > > Behavior#onException() sounds like something similar but
> > > there
> > > > > is
> > > > > >> no
> > > > > >> > > way
> > > > > >> > > > > to suppress the bubbling of the exception at the moment.
> > > > > >> > > > > The bigger problem is that the rendering can fail in the
> > > > middle,
> > > > > >> i.e.
> > > > > >> > > the
> > > > > >> > > > > component can have written some response already and
> then
> > > > fail.
> > > > > If
> > > > > >> > the
> > > > > >> > > > > written response is proper HTML then it is OKish. But if
> > > some
> > > > > tag
> > > > > >> is
> > > > > >> > > not
> > > > > >> > > > > closed then the rendering of the complete page may fail.
> > > > > >> > > > > So if we try to add this functionality we will have to
> use
> > > > > >> temporary
> > > > > >> > > > > Response objects for the rendering of each component to
> be
> > > > able
> > > > > to
> > > > > >> > > throw
> > > > > >> > > > > away whatever it has produced before failing.
> > > > > >> > > > >
> > > > > >> > > > > Usually the problem is related to the component's
> model. A
> > > > > >> workaround
> > > > > >> > > for
> > > > > >> > > > > you could be to use a wrapper Model that returns "empty
> > > data"
> > > > > when
> > > > > >> > the
> > > > > >> > > > > underlying model throws an exception.
> > > > > >> > > > >
> > > > > >> > > > > Martin Grigorov
> > > > > >> > > > > Wicket Training and Consulting
> > > > > >> > > > > https://twitter.com/mtgrigorov
> > > > > >> > > > >
> > > > > >> > > > > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo
> > Barreiro
> > > <
> > > > > >> > > > > reiern70@gmail.com> wrote:
> > > > > >> > > > >
> > > > > >> > > > >> Hi,
> > > > > >> > > > >>
> > > > > >> > > > >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
> > > > > >> > > > >> tobias.gierke@voipfuture.com> wrote:
> > > > > >> > > > >>
> > > > > >> > > > >> > Hi,
> > > > > >> > > > >> >
> > > > > >> > > > >> >> Wouldn't it be possible to "embed"  the failing
> prone
> > > > > porlets
> > > > > >> > > inside
> > > > > >> > > > >> >> iframes so that each one is a Wicket page?
> > > > > >> > > > >> >>
> > > > > >> > > > >> > I already thought about this but the page uses quite
> a
> > > lot
> > > > of
> > > > > >> > fancy
> > > > > >> > > > >> > CSS/Ajax/Javascript (portlets are rendered in a grid
> > with
> > > > > >> > > configurable
> > > > > >> > > > >> > row/column count, drag'n'drop to move them around
> etc.)
> > > and
> > > > > I'd
> > > > > >> > > rather
> > > > > >> > > > >> not
> > > > > >> > > > >> > touch the existing code if there's a Java-side only
> > > > solution
> > > > > >> ;-)
> > > > > >> > > > >> >
> > > > > >> > > > >>
> > > > > >> > > > >> I do not know of any :-(
> > > > > >> > > > >>
> > > > > >> > > > >> Another possibility is build each client entirely on
> > > > JavaScript
> > > > > >> and
> > > > > >> > > use
> > > > > >> > > > >> Wicket just as a service layer... not very Wicket like
> > but
> > > > you
> > > > > >> would
> > > > > >> > > not
> > > > > >> > > > >> have this problem.
> > > > > >> > > > >>
> > > > > >> > > > >>
> > > > > >> > > > >> >
> > > > > >> > > > >> > Cheers,
> > > > > >> > > > >> > Tobias
> > > > > >> > > > >> >
> > > > > >> > > > >> >
> > > > > >> > > > >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> > > > > >> > > > >> >> tobias.gierke@voipfuture.com> wrote:
> > > > > >> > > > >> >>
> > > > > >> > > > >> >>  Hi,
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>> In our web application we have a dashboard-like
> > > homepage
> > > > > that
> > > > > >> > > > >> displays a
> > > > > >> > > > >> >>> number of user-configurable 'portlets' (which are
> > > really
> > > > > just
> > > > > >> > > > ordinary
> > > > > >> > > > >> >>> Wicket components and have nothing to do with the
> > > Portlet
> > > > > >> spec).
> > > > > >> > > I'm
> > > > > >> > > > >> >>> looking for a way of preventing the application
> from
> > > > > becoming
> > > > > >> > > > >> unusable in
> > > > > >> > > > >> >>> case one or more of these portlets continuously
> fail
> > to
> > > > > >> render
> > > > > >> > > > >> because of
> > > > > >> > > > >> >>> some internal error/bug.
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>> We're currently using a custom RequestCycleListener
> > > with
> > > > > the
> > > > > >> > > > >> >>> onException()
> > > > > >> > > > >> >>> method redirecting to a generic error page, thus
> when
> > > > > >> rendering
> > > > > >> > > of a
> > > > > >> > > > >> >>> 'portlet' fails the user will never get to see the
> > > > homepage
> > > > > >> and
> > > > > >> > > > always
> > > > > >> > > > >> >>> end
> > > > > >> > > > >> >>> up on the error page - which is obviously not
> really
> > > > > >> desirable.
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>> Is there a way to to hook into Wicket's rendering
> > cycle
> > > > so
> > > > > >> that
> > > > > >> > I
> > > > > >> > > > can
> > > > > >> > > > >> >>> provide some default markup in case rendering of a
> > > > > component
> > > > > >> > > > (subtree)
> > > > > >> > > > >> >>> fails with a RuntimeException ?
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>> I understand that this maybe be very tricky since
> the
> > > > > >> component
> > > > > >> > > > >> subtree
> > > > > >> > > > >> >>> might've rendered partially and thus internal state
> > > will
> > > > be
> > > > > >> > > > >> inconsistent.
> > > > > >> > > > >> >>> It would probably require serializing the initial
> > state
> > > > of
> > > > > >> the
> > > > > >> > > > >> component
> > > > > >> > > > >> >>> (subtree) before rendering starts and reverting the
> > > > wholle
> > > > > >> > subtree
> > > > > >> > > > to
> > > > > >> > > > >> its
> > > > > >> > > > >> >>> initial state once a RuntimeException is thrown.
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>> We're running Wicket 1.5.12.
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>> Thanks in advance,
> > > > > >> > > > >> >>> Tobias
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>> --
> > > > > >> > > > >> >>> Tobias Gierke
> > > > > >> > > > >> >>> Development
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,
> > > > Germany
> > > > > >> > > > >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> > > > > >> > > > >> >>> Email tobias.gierke@voipfuture.com   Web
> > > > > >> > > http://www.voipfuture.com
> > > > > >> > > > >> >>>   CEO Jan Bastian
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID
> > > > > DE263738086
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>>
> > > > > >> > > > >> >>>
> > > > > >> > > >
> > > > > >>
> > > ---------------------------------------------------------------------
> > > > > >> > > > >> >>> 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
> > > > > >> > > > >> >
> > > > > >> > > > >> >
> > > > > >> > > > >>
> > > > > >> > > > >>
> > > > > >> > > > >> --
> > > > > >> > > > >> Regards - Ernesto Reinaldo Barreiro
> > > > > >> > > > >>
> > > > > >> > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> > >
> > > > > >> > >
> > > > > >> > > --
> > > > > >> > > Regards - Ernesto Reinaldo Barreiro
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >> --
> > > > > >> Regards - Ernesto Reinaldo Barreiro
> > > > > >>
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Regards - Ernesto Reinaldo Barreiro
> > > >
> > >
> >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> >
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Martin Grigorov <mg...@apache.org>.
I'll play some more with this.
At the moment I think it will be much easier if Behavior#onException() can
return a result saying "I can deal with the problem" and Wicket just
continue with the rendering of the other components pretending that nothing
bad happened so far.

But any API changes would mean that the change will be applied only in 7.x
branch!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Oct 14, 2014 at 3:27 PM, Tobias Gierke <tobias.gierke@voipfuture.com
> wrote:

> Hi,
>
> I've just come to the same conclusion. And I don't really like the fact
> that every component that needs to be rendered in a 'fail-safe' way also
> has to override onRender() with an empty implementation. To me this
> 'fail-safe rendering' looks more like a cross-cutting concern that
> wicket-core should provide a hook for (maybe exposed through a new method
> in IRequestCycleListener).
>
> Cheers,
> Tobias
>
>
>  Hi,
>>
>> isVisible() is called at many places in Wicket.
>> It is not easy to try/catch it.
>>
>> I've updated (locally) the demo app and with 6.x it breaks with:
>>
>> java.lang.RuntimeException: Problem in #isVisible
>> at com.mycompany.HomePage$2.isVisible(HomePage.java:35)
>> at org.apache.wicket.Component.determineVisibility(Component.java:4340)
>> at org.apache.wicket.Component.isVisibleInHierarchy(Component.java:2131)
>> at org.apache.wicket.Component.isStateless(Component.java:2048)
>> at org.apache.wicket.Page$2.component(Page.java:479)
>> at org.apache.wicket.Page$2.component(Page.java:475)
>> at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:144)
>> at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:162)
>> at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:123)
>> at org.apache.wicket.MarkupContainer.visitChildren(
>> MarkupContainer.java:860)
>> at org.apache.wicket.Page.isPageStateless(Page.java:473)
>> at
>> org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.
>> getPageInfo(AbstractBookmarkableMapper.java:465)
>> at
>> org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.
>> mapHandler(AbstractBookmarkableMapper.java:409)
>> at
>> org.apache.wicket.core.request.mapper.MountedMapper.
>> mapHandler(MountedMapper.java:395)
>> at
>> org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(
>> CompoundRequestMapper.java:215)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.mapUrlFor(
>> RequestCycle.java:429)
>> at
>> org.apache.wicket.request.handler.render.WebPageRenderer.respond(
>> WebPageRenderer.java:281)
>>
>> This is even before starting rendering the page itself.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Tue, Oct 14, 2014 at 2:50 PM, Tobias Gierke <
>> tobias.gierke@voipfuture.com
>>
>>> wrote:
>>> Sorry for the noise, I should've read your e-mail more thorougly :(
>>>
>>> "But as you can see the default rendering of a component should be
>>> suppressed (PortletLike#onRender() {}) so it is not enough just to have
>>> the
>>> behavior. "
>>>
>>> I'll fix my implementation and try again.
>>>
>>> Cheers,
>>> Tobias
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>
> --
> Tobias Gierke
> Development
>
> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> Email tobias.gierke@voipfuture.com   Web http://www.voipfuture.com
>  CEO Jan Bastian
>
> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Tobias Gierke <to...@voipfuture.com>.
Hi,

I've just come to the same conclusion. And I don't really like the fact 
that every component that needs to be rendered in a 'fail-safe' way also 
has to override onRender() with an empty implementation. To me this 
'fail-safe rendering' looks more like a cross-cutting concern that 
wicket-core should provide a hook for (maybe exposed through a new 
method in IRequestCycleListener).

Cheers,
Tobias

> Hi,
>
> isVisible() is called at many places in Wicket.
> It is not easy to try/catch it.
>
> I've updated (locally) the demo app and with 6.x it breaks with:
>
> java.lang.RuntimeException: Problem in #isVisible
> at com.mycompany.HomePage$2.isVisible(HomePage.java:35)
> at org.apache.wicket.Component.determineVisibility(Component.java:4340)
> at org.apache.wicket.Component.isVisibleInHierarchy(Component.java:2131)
> at org.apache.wicket.Component.isStateless(Component.java:2048)
> at org.apache.wicket.Page$2.component(Page.java:479)
> at org.apache.wicket.Page$2.component(Page.java:475)
> at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:144)
> at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:162)
> at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:123)
> at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:860)
> at org.apache.wicket.Page.isPageStateless(Page.java:473)
> at
> org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.getPageInfo(AbstractBookmarkableMapper.java:465)
> at
> org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.mapHandler(AbstractBookmarkableMapper.java:409)
> at
> org.apache.wicket.core.request.mapper.MountedMapper.mapHandler(MountedMapper.java:395)
> at
> org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:215)
> at
> org.apache.wicket.request.cycle.RequestCycle.mapUrlFor(RequestCycle.java:429)
> at
> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:281)
>
> This is even before starting rendering the page itself.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, Oct 14, 2014 at 2:50 PM, Tobias Gierke <tobias.gierke@voipfuture.com
>> wrote:
>> Sorry for the noise, I should've read your e-mail more thorougly :(
>>
>> "But as you can see the default rendering of a component should be
>> suppressed (PortletLike#onRender() {}) so it is not enough just to have the
>> behavior. "
>>
>> I'll fix my implementation and try again.
>>
>> Cheers,
>> Tobias
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>


-- 
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 164 Fax +49 40 688 900 199
Email tobias.gierke@voipfuture.com   Web http://www.voipfuture.com
  
CEO Jan Bastian
	
Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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


Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

isVisible() is called at many places in Wicket.
It is not easy to try/catch it.

I've updated (locally) the demo app and with 6.x it breaks with:

java.lang.RuntimeException: Problem in #isVisible
at com.mycompany.HomePage$2.isVisible(HomePage.java:35)
at org.apache.wicket.Component.determineVisibility(Component.java:4340)
at org.apache.wicket.Component.isVisibleInHierarchy(Component.java:2131)
at org.apache.wicket.Component.isStateless(Component.java:2048)
at org.apache.wicket.Page$2.component(Page.java:479)
at org.apache.wicket.Page$2.component(Page.java:475)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:144)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:162)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:123)
at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:860)
at org.apache.wicket.Page.isPageStateless(Page.java:473)
at
org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.getPageInfo(AbstractBookmarkableMapper.java:465)
at
org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.mapHandler(AbstractBookmarkableMapper.java:409)
at
org.apache.wicket.core.request.mapper.MountedMapper.mapHandler(MountedMapper.java:395)
at
org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:215)
at
org.apache.wicket.request.cycle.RequestCycle.mapUrlFor(RequestCycle.java:429)
at
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:281)

This is even before starting rendering the page itself.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Oct 14, 2014 at 2:50 PM, Tobias Gierke <tobias.gierke@voipfuture.com
> wrote:

> Sorry for the noise, I should've read your e-mail more thorougly :(
>
> "But as you can see the default rendering of a component should be
> suppressed (PortletLike#onRender() {}) so it is not enough just to have the
> behavior. "
>
> I'll fix my implementation and try again.
>
> Cheers,
> Tobias
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Tobias Gierke <to...@voipfuture.com>.
Sorry for the noise, I should've read your e-mail more thorougly :(

"But as you can see the default rendering of a component should be 
suppressed (PortletLike#onRender() {}) so it is not enough just to have 
the behavior. "

I'll fix my implementation and try again.

Cheers,
Tobias


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


Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Tobias Gierke <to...@voipfuture.com>.
Hi,
> Oops. It seems PortletLike (a copy of PanelA with an exception in the
> rendering of its Label child) hasn't be added to Git ...
>
> I've refactored it even further.
> But as you can see the default rendering of a component should be
> suppressed (PortletLike#onRender() {}) so it is not enough just to have the
> behavior.
>
> This is just a simple demo.
> I'd like some feedback from a real usage before even thinking about adding
> this to core.
I tested the code of your Behavior implementation on our project by 
throwing a RuntimeException from inside a LoadableDetachableModel#load() 
method but the Behavior never gets called.

This makes sense since I happen to throw the dummy exception from within 
a model that's used by an overridden isVisible() method  - and before a 
component is rendered Wicket checks whether the component needs to be 
rendered at all.

I tested this using Wicket 1.5.11 - did the rendering control flow 
change in Wicket 6.x so that your github example would cover this 
failure scenario as well ?

Very much appreciate you looking into this,
Tobias


java.lang.RuntimeException: Dummy exception
      at 
com.vodecc.voipmng.boundary.wicket.dashboard.portlets.PolicyConformancePortlet$1.load(PolicyConformancePortlet.java:180)
      at 
com.vodecc.voipmng.boundary.wicket.dashboard.portlets.PolicyConformancePortlet$1.load(PolicyConformancePortlet.java:1)
      at 
org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:119)
      at 
com.vodecc.voipmng.boundary.wicket.dashboard.portlets.components.PolicyConformancePortletPanel.hasData(PolicyConformancePortletPanel.java:241)
      at 
com.vodecc.voipmng.boundary.wicket.dashboard.portlets.components.PolicyConformancePortletPanel.access$2(PolicyConformancePortletPanel.java:240)
      at 
com.vodecc.voipmng.boundary.wicket.dashboard.portlets.components.PolicyConformancePortletPanel$2.isVisible(PolicyConformancePortletPanel.java:112)
      at 
org.apache.wicket.Component.determineVisibility(Component.java:4402)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:987)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at 
com.vodecc.voipmng.boundary.wicket.general.CustomPanel.onBeforeRender(CustomPanel.java:107)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at 
com.vodecc.voipmng.boundary.wicket.general.CustomPanel.onBeforeRender(CustomPanel.java:107)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at 
org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:139)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at 
com.vodecc.voipmng.boundary.wicket.general.CustomPanel.onBeforeRender(CustomPanel.java:107)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at 
com.vodecc.voipmng.boundary.wicket.general.DynamicTabbedPanel.onBeforeRender(DynamicTabbedPanel.java:479)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739)
      at org.apache.wicket.Component.onBeforeRender(Component.java:3871)
      at org.apache.wicket.Page.onBeforeRender(Page.java:826)
      at 
org.apache.wicket.Component.internalBeforeRender(Component.java:994)
      at org.apache.wicket.Component.beforeRender(Component.java:1028)
      at 
org.apache.wicket.Component.internalPrepareForRender(Component.java:2237)
      at org.apache.wicket.Page.internalPrepareForRender(Page.java:279)
      at org.apache.wicket.Component.render(Component.java:2325)
      at org.apache.wicket.Page.renderPage(Page.java:1035)
      at 
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:118)
      at 
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:246)
      at 
org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
      at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
      at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
      at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
      at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
      at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
      at 
com.vodecc.voipmng.boundary.wicket.WicketApplication$CustomRequestCycle.processRequestAndDetach(WicketApplication.java:171)
      at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
      at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
      at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      at 
org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:122)
      at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
      at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      at 
org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:170)
      at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
      at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
      at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
      at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
      at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)

>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, Oct 14, 2014 at 1:24 PM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
>> Martin,
>>
>> PortletLike b = new PortletLike("b", Model.of("panel b"))... I can't
>> see a PortletLike...
>> on same package. Maybe a good way to use the behavior is: 1- Roll a
>> PorletLikeBehavior. and an Interface IPorletLike { CharSequence
>> getOnFailContents(); } to mark porlet like components. 2- Add a component
>> instantiation listener that if a component implement IPorletLike
>> automatically adds the behavior.
>>
>> On Tue, Oct 14, 2014 at 10:14 AM, Martin Grigorov <mg...@apache.org>
>> wrote:
>>
>>> Hi Ernesto,
>>>
>>> I didn't get the question.
>>>
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>>
>>> On Tue, Oct 14, 2014 at 1:10 PM, Ernesto Reinaldo Barreiro <
>>> reiern70@gmail.com> wrote:
>>>
>>>> Thanks! Whose PortletLike on
>>>>
>>>>
>> https://github.com/martin-g/component-rendering-default/blob/master/src/main/java/com/mycompany/HomePage.java
>>>> ?
>>>> PanelA?
>>>>
>>>> On Tue, Oct 14, 2014 at 9:03 AM, Martin Grigorov <mgrigorov@apache.org
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Here is a demo app with Wicket 6.x:
>>>>> https://github.com/martin-g/component-rendering-default
>>>>>
>>>>> Martin Grigorov
>>>>> Wicket Training and Consulting
>>>>> https://twitter.com/mtgrigorov
>>>>>
>>>>> On Mon, Oct 13, 2014 at 6:13 PM, Martin Grigorov <
>> mgrigorov@apache.org
>>>>> wrote:
>>>>>
>>>>>> Here is a possible solution *now*:
>>>>>>
>>>>>> portletLike.add(new AbstractTransformerBehavior() {
>>>>>>    @Override public CharSequence transform(Component c, CharSequence
>>>>>> output) {
>>>>>>       try {
>>>>>>         c.internalRenderComponent();
>>>>>>       } catch (Exception x) {
>>>>>>         return "default result";
>>>>>>       }
>>>>>>     }
>>>>>> });
>>>>>>
>>>>>> Something like this should do it.
>>>>>>
>>>>>> Martin Grigorov
>>>>>> Wicket Training and Consulting
>>>>>> https://twitter.com/mtgrigorov
>>>>>>
>>>>>> On Mon, Oct 13, 2014 at 5:39 PM, Ernesto Reinaldo Barreiro <
>>>>>> reiern70@gmail.com> wrote:
>>>>>>
>>>>>>> I see... you may have already streamed content --> Maybe same
>>>> interface
>>>>>>> serves to mark a component as "do not stream anything till the
>> end",
>>>> or
>>>>>>> stream the contents to an intermediate buffer... but what I way
>>> above
>>>>>>> might
>>>>>>> not make sense as well.
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <
>>>> mgrigorov@apache.org>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
>>>>>>>> reiern70@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> @Martin,
>>>>>>>>>
>>>>>>>>> Just a (maybe stupid) idea:
>>>>>>>>>
>>>>>>>>> 1- Mark some component as ISafeFail
>>>>>>>>> 2- If rendering fails take Component_onfail.html and render it
>>>>>>>>>
>>>>>>>> As I said earlier this is not so trivial.
>>>>>>>> The failure may happen in the middle of the rendering and the
>>>> content
>>>>>>>> collected so far in RequestCycle#getResponse() could be invalid
>>>> HTML.
>>>>>>>> Appending anything (loaded from a file or generated on the fly)
>> is
>>>> not
>>>>>>>> really a solution.
>>>>>>>>
>>>>>>>>
>>>>>>>>> On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <
>>>>>>> mgrigorov@apache.org>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> https://issues.apache.org/jira/browse/WICKET-4321
>>>>>>>>>> this is the ticker I meant
>>>>>>>>>> it suggests to restart the rendering completely for the
>> whole
>>>> page
>>>>>>> and
>>>>>>>>> this
>>>>>>>>>> is not enough
>>>>>>>>>> I'll see what kind of changes would be needed to accomplish
>>>> this.
>>>>>>>>>> Martin Grigorov
>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>
>>>>>>>>>> On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <
>>>>>>> mgrigorov@apache.org
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> There is no support for this, even in 7.x.
>>>>>>>>>>> I remember Carl-Eric Menzel asking for the same
>>> functionality
>>>>>>> before
>>>>>>>>> ...
>>>>>>>>>>> Behavior#onException() sounds like something similar but
>>> there
>>>>> is
>>>>>>> no
>>>>>>>>> way
>>>>>>>>>>> to suppress the bubbling of the exception at the moment.
>>>>>>>>>>> The bigger problem is that the rendering can fail in the
>>>> middle,
>>>>>>> i.e.
>>>>>>>>> the
>>>>>>>>>>> component can have written some response already and then
>>>> fail.
>>>>> If
>>>>>>>> the
>>>>>>>>>>> written response is proper HTML then it is OKish. But if
>>> some
>>>>> tag
>>>>>>> is
>>>>>>>>> not
>>>>>>>>>>> closed then the rendering of the complete page may fail.
>>>>>>>>>>> So if we try to add this functionality we will have to use
>>>>>>> temporary
>>>>>>>>>>> Response objects for the rendering of each component to be
>>>> able
>>>>> to
>>>>>>>>> throw
>>>>>>>>>>> away whatever it has produced before failing.
>>>>>>>>>>>
>>>>>>>>>>> Usually the problem is related to the component's model. A
>>>>>>> workaround
>>>>>>>>> for
>>>>>>>>>>> you could be to use a wrapper Model that returns "empty
>>> data"
>>>>> when
>>>>>>>> the
>>>>>>>>>>> underlying model throws an exception.
>>>>>>>>>>>
>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>
>>>>>>>>>>> On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo
>> Barreiro
>>> <
>>>>>>>>>>> reiern70@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
>>>>>>>>>>>> tobias.gierke@voipfuture.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Wouldn't it be possible to "embed"  the failing prone
>>>>> porlets
>>>>>>>>> inside
>>>>>>>>>>>>>> iframes so that each one is a Wicket page?
>>>>>>>>>>>>>>
>>>>>>>>>>>>> I already thought about this but the page uses quite a
>>> lot
>>>> of
>>>>>>>> fancy
>>>>>>>>>>>>> CSS/Ajax/Javascript (portlets are rendered in a grid
>> with
>>>>>>>>> configurable
>>>>>>>>>>>>> row/column count, drag'n'drop to move them around etc.)
>>> and
>>>>> I'd
>>>>>>>>> rather
>>>>>>>>>>>> not
>>>>>>>>>>>>> touch the existing code if there's a Java-side only
>>>> solution
>>>>>>> ;-)
>>>>>>>>>>>> I do not know of any :-(
>>>>>>>>>>>>
>>>>>>>>>>>> Another possibility is build each client entirely on
>>>> JavaScript
>>>>>>> and
>>>>>>>>> use
>>>>>>>>>>>> Wicket just as a service layer... not very Wicket like
>> but
>>>> you
>>>>>>> would
>>>>>>>>> not
>>>>>>>>>>>> have this problem.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> Cheers,
>>>>>>>>>>>>> Tobias
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
>>>>>>>>>>>>>> tobias.gierke@voipfuture.com> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>   Hi,
>>>>>>>>>>>>>>> In our web application we have a dashboard-like
>>> homepage
>>>>> that
>>>>>>>>>>>> displays a
>>>>>>>>>>>>>>> number of user-configurable 'portlets' (which are
>>> really
>>>>> just
>>>>>>>>>> ordinary
>>>>>>>>>>>>>>> Wicket components and have nothing to do with the
>>> Portlet
>>>>>>> spec).
>>>>>>>>> I'm
>>>>>>>>>>>>>>> looking for a way of preventing the application from
>>>>> becoming
>>>>>>>>>>>> unusable in
>>>>>>>>>>>>>>> case one or more of these portlets continuously fail
>> to
>>>>>>> render
>>>>>>>>>>>> because of
>>>>>>>>>>>>>>> some internal error/bug.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> We're currently using a custom RequestCycleListener
>>> with
>>>>> the
>>>>>>>>>>>>>>> onException()
>>>>>>>>>>>>>>> method redirecting to a generic error page, thus when
>>>>>>> rendering
>>>>>>>>> of a
>>>>>>>>>>>>>>> 'portlet' fails the user will never get to see the
>>>> homepage
>>>>>>> and
>>>>>>>>>> always
>>>>>>>>>>>>>>> end
>>>>>>>>>>>>>>> up on the error page - which is obviously not really
>>>>>>> desirable.
>>>>>>>>>>>>>>> Is there a way to to hook into Wicket's rendering
>> cycle
>>>> so
>>>>>>> that
>>>>>>>> I
>>>>>>>>>> can
>>>>>>>>>>>>>>> provide some default markup in case rendering of a
>>>>> component
>>>>>>>>>> (subtree)
>>>>>>>>>>>>>>> fails with a RuntimeException ?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I understand that this maybe be very tricky since the
>>>>>>> component
>>>>>>>>>>>> subtree
>>>>>>>>>>>>>>> might've rendered partially and thus internal state
>>> will
>>>> be
>>>>>>>>>>>> inconsistent.
>>>>>>>>>>>>>>> It would probably require serializing the initial
>> state
>>>> of
>>>>>>> the
>>>>>>>>>>>> component
>>>>>>>>>>>>>>> (subtree) before rendering starts and reverting the
>>>> wholle
>>>>>>>> subtree
>>>>>>>>>> to
>>>>>>>>>>>> its
>>>>>>>>>>>>>>> initial state once a RuntimeException is thrown.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> We're running Wicket 1.5.12.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Thanks in advance,
>>>>>>>>>>>>>>> Tobias
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> Tobias Gierke
>>>>>>>>>>>>>>> Development
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,
>>>> Germany
>>>>>>>>>>>>>>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
>>>>>>>>>>>>>>> Email tobias.gierke@voipfuture.com   Web
>>>>>>>>> http://www.voipfuture.com
>>>>>>>>>>>>>>>    CEO Jan Bastian
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Commercial Court AG Hamburg   HRB 109896, VAT ID
>>>>> DE263738086
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>> 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
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Regards - Ernesto Reinaldo Barreiro
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Regards - Ernesto Reinaldo Barreiro
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Regards - Ernesto Reinaldo Barreiro
>>>>>>>
>>>>>>
>>>>
>>>>
>>>> --
>>>> Regards - Ernesto Reinaldo Barreiro
>>>>
>>
>>
>> --
>> Regards - Ernesto Reinaldo Barreiro
>>


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


Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Martin Grigorov <mg...@apache.org>.
Oops. It seems PortletLike (a copy of PanelA with an exception in the
rendering of its Label child) hasn't be added to Git ...

I've refactored it even further.
But as you can see the default rendering of a component should be
suppressed (PortletLike#onRender() {}) so it is not enough just to have the
behavior.

This is just a simple demo.
I'd like some feedback from a real usage before even thinking about adding
this to core.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Oct 14, 2014 at 1:24 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Martin,
>
> PortletLike b = new PortletLike("b", Model.of("panel b"))... I can't
> see a PortletLike...
> on same package. Maybe a good way to use the behavior is: 1- Roll a
> PorletLikeBehavior. and an Interface IPorletLike { CharSequence
> getOnFailContents(); } to mark porlet like components. 2- Add a component
> instantiation listener that if a component implement IPorletLike
> automatically adds the behavior.
>
> On Tue, Oct 14, 2014 at 10:14 AM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi Ernesto,
> >
> > I didn't get the question.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Tue, Oct 14, 2014 at 1:10 PM, Ernesto Reinaldo Barreiro <
> > reiern70@gmail.com> wrote:
> >
> > > Thanks! Whose PortletLike on
> > >
> > >
> >
> https://github.com/martin-g/component-rendering-default/blob/master/src/main/java/com/mycompany/HomePage.java
> > > ?
> > > PanelA?
> > >
> > > On Tue, Oct 14, 2014 at 9:03 AM, Martin Grigorov <mgrigorov@apache.org
> >
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > Here is a demo app with Wicket 6.x:
> > > > https://github.com/martin-g/component-rendering-default
> > > >
> > > > Martin Grigorov
> > > > Wicket Training and Consulting
> > > > https://twitter.com/mtgrigorov
> > > >
> > > > On Mon, Oct 13, 2014 at 6:13 PM, Martin Grigorov <
> mgrigorov@apache.org
> > >
> > > > wrote:
> > > >
> > > > > Here is a possible solution *now*:
> > > > >
> > > > > portletLike.add(new AbstractTransformerBehavior() {
> > > > >   @Override public CharSequence transform(Component c, CharSequence
> > > > > output) {
> > > > >      try {
> > > > >        c.internalRenderComponent();
> > > > >      } catch (Exception x) {
> > > > >        return "default result";
> > > > >      }
> > > > >    }
> > > > > });
> > > > >
> > > > > Something like this should do it.
> > > > >
> > > > > Martin Grigorov
> > > > > Wicket Training and Consulting
> > > > > https://twitter.com/mtgrigorov
> > > > >
> > > > > On Mon, Oct 13, 2014 at 5:39 PM, Ernesto Reinaldo Barreiro <
> > > > > reiern70@gmail.com> wrote:
> > > > >
> > > > >> I see... you may have already streamed content --> Maybe same
> > > interface
> > > > >> serves to mark a component as "do not stream anything till the
> end",
> > > or
> > > > >> stream the contents to an intermediate buffer... but what I way
> > above
> > > > >> might
> > > > >> not make sense as well.
> > > > >>
> > > > >>
> > > > >> On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <
> > > mgrigorov@apache.org>
> > > > >> wrote:
> > > > >>
> > > > >> > On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
> > > > >> > reiern70@gmail.com> wrote:
> > > > >> >
> > > > >> > > @Martin,
> > > > >> > >
> > > > >> > > Just a (maybe stupid) idea:
> > > > >> > >
> > > > >> > > 1- Mark some component as ISafeFail
> > > > >> > > 2- If rendering fails take Component_onfail.html and render it
> > > > >> > >
> > > > >> >
> > > > >> > As I said earlier this is not so trivial.
> > > > >> > The failure may happen in the middle of the rendering and the
> > > content
> > > > >> > collected so far in RequestCycle#getResponse() could be invalid
> > > HTML.
> > > > >> > Appending anything (loaded from a file or generated on the fly)
> is
> > > not
> > > > >> > really a solution.
> > > > >> >
> > > > >> >
> > > > >> > >
> > > > >> > > On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <
> > > > >> mgrigorov@apache.org>
> > > > >> > > wrote:
> > > > >> > >
> > > > >> > > > https://issues.apache.org/jira/browse/WICKET-4321
> > > > >> > > > this is the ticker I meant
> > > > >> > > > it suggests to restart the rendering completely for the
> whole
> > > page
> > > > >> and
> > > > >> > > this
> > > > >> > > > is not enough
> > > > >> > > > I'll see what kind of changes would be needed to accomplish
> > > this.
> > > > >> > > >
> > > > >> > > > Martin Grigorov
> > > > >> > > > Wicket Training and Consulting
> > > > >> > > > https://twitter.com/mtgrigorov
> > > > >> > > >
> > > > >> > > > On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <
> > > > >> mgrigorov@apache.org
> > > > >> > >
> > > > >> > > > wrote:
> > > > >> > > >
> > > > >> > > > > Hi,
> > > > >> > > > >
> > > > >> > > > > There is no support for this, even in 7.x.
> > > > >> > > > > I remember Carl-Eric Menzel asking for the same
> > functionality
> > > > >> before
> > > > >> > > ...
> > > > >> > > > > Behavior#onException() sounds like something similar but
> > there
> > > > is
> > > > >> no
> > > > >> > > way
> > > > >> > > > > to suppress the bubbling of the exception at the moment.
> > > > >> > > > > The bigger problem is that the rendering can fail in the
> > > middle,
> > > > >> i.e.
> > > > >> > > the
> > > > >> > > > > component can have written some response already and then
> > > fail.
> > > > If
> > > > >> > the
> > > > >> > > > > written response is proper HTML then it is OKish. But if
> > some
> > > > tag
> > > > >> is
> > > > >> > > not
> > > > >> > > > > closed then the rendering of the complete page may fail.
> > > > >> > > > > So if we try to add this functionality we will have to use
> > > > >> temporary
> > > > >> > > > > Response objects for the rendering of each component to be
> > > able
> > > > to
> > > > >> > > throw
> > > > >> > > > > away whatever it has produced before failing.
> > > > >> > > > >
> > > > >> > > > > Usually the problem is related to the component's model. A
> > > > >> workaround
> > > > >> > > for
> > > > >> > > > > you could be to use a wrapper Model that returns "empty
> > data"
> > > > when
> > > > >> > the
> > > > >> > > > > underlying model throws an exception.
> > > > >> > > > >
> > > > >> > > > > Martin Grigorov
> > > > >> > > > > Wicket Training and Consulting
> > > > >> > > > > https://twitter.com/mtgrigorov
> > > > >> > > > >
> > > > >> > > > > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo
> Barreiro
> > <
> > > > >> > > > > reiern70@gmail.com> wrote:
> > > > >> > > > >
> > > > >> > > > >> Hi,
> > > > >> > > > >>
> > > > >> > > > >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
> > > > >> > > > >> tobias.gierke@voipfuture.com> wrote:
> > > > >> > > > >>
> > > > >> > > > >> > Hi,
> > > > >> > > > >> >
> > > > >> > > > >> >> Wouldn't it be possible to "embed"  the failing prone
> > > > porlets
> > > > >> > > inside
> > > > >> > > > >> >> iframes so that each one is a Wicket page?
> > > > >> > > > >> >>
> > > > >> > > > >> > I already thought about this but the page uses quite a
> > lot
> > > of
> > > > >> > fancy
> > > > >> > > > >> > CSS/Ajax/Javascript (portlets are rendered in a grid
> with
> > > > >> > > configurable
> > > > >> > > > >> > row/column count, drag'n'drop to move them around etc.)
> > and
> > > > I'd
> > > > >> > > rather
> > > > >> > > > >> not
> > > > >> > > > >> > touch the existing code if there's a Java-side only
> > > solution
> > > > >> ;-)
> > > > >> > > > >> >
> > > > >> > > > >>
> > > > >> > > > >> I do not know of any :-(
> > > > >> > > > >>
> > > > >> > > > >> Another possibility is build each client entirely on
> > > JavaScript
> > > > >> and
> > > > >> > > use
> > > > >> > > > >> Wicket just as a service layer... not very Wicket like
> but
> > > you
> > > > >> would
> > > > >> > > not
> > > > >> > > > >> have this problem.
> > > > >> > > > >>
> > > > >> > > > >>
> > > > >> > > > >> >
> > > > >> > > > >> > Cheers,
> > > > >> > > > >> > Tobias
> > > > >> > > > >> >
> > > > >> > > > >> >
> > > > >> > > > >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> > > > >> > > > >> >> tobias.gierke@voipfuture.com> wrote:
> > > > >> > > > >> >>
> > > > >> > > > >> >>  Hi,
> > > > >> > > > >> >>>
> > > > >> > > > >> >>> In our web application we have a dashboard-like
> > homepage
> > > > that
> > > > >> > > > >> displays a
> > > > >> > > > >> >>> number of user-configurable 'portlets' (which are
> > really
> > > > just
> > > > >> > > > ordinary
> > > > >> > > > >> >>> Wicket components and have nothing to do with the
> > Portlet
> > > > >> spec).
> > > > >> > > I'm
> > > > >> > > > >> >>> looking for a way of preventing the application from
> > > > becoming
> > > > >> > > > >> unusable in
> > > > >> > > > >> >>> case one or more of these portlets continuously fail
> to
> > > > >> render
> > > > >> > > > >> because of
> > > > >> > > > >> >>> some internal error/bug.
> > > > >> > > > >> >>>
> > > > >> > > > >> >>> We're currently using a custom RequestCycleListener
> > with
> > > > the
> > > > >> > > > >> >>> onException()
> > > > >> > > > >> >>> method redirecting to a generic error page, thus when
> > > > >> rendering
> > > > >> > > of a
> > > > >> > > > >> >>> 'portlet' fails the user will never get to see the
> > > homepage
> > > > >> and
> > > > >> > > > always
> > > > >> > > > >> >>> end
> > > > >> > > > >> >>> up on the error page - which is obviously not really
> > > > >> desirable.
> > > > >> > > > >> >>>
> > > > >> > > > >> >>> Is there a way to to hook into Wicket's rendering
> cycle
> > > so
> > > > >> that
> > > > >> > I
> > > > >> > > > can
> > > > >> > > > >> >>> provide some default markup in case rendering of a
> > > > component
> > > > >> > > > (subtree)
> > > > >> > > > >> >>> fails with a RuntimeException ?
> > > > >> > > > >> >>>
> > > > >> > > > >> >>> I understand that this maybe be very tricky since the
> > > > >> component
> > > > >> > > > >> subtree
> > > > >> > > > >> >>> might've rendered partially and thus internal state
> > will
> > > be
> > > > >> > > > >> inconsistent.
> > > > >> > > > >> >>> It would probably require serializing the initial
> state
> > > of
> > > > >> the
> > > > >> > > > >> component
> > > > >> > > > >> >>> (subtree) before rendering starts and reverting the
> > > wholle
> > > > >> > subtree
> > > > >> > > > to
> > > > >> > > > >> its
> > > > >> > > > >> >>> initial state once a RuntimeException is thrown.
> > > > >> > > > >> >>>
> > > > >> > > > >> >>> We're running Wicket 1.5.12.
> > > > >> > > > >> >>>
> > > > >> > > > >> >>> Thanks in advance,
> > > > >> > > > >> >>> Tobias
> > > > >> > > > >> >>>
> > > > >> > > > >> >>> --
> > > > >> > > > >> >>> Tobias Gierke
> > > > >> > > > >> >>> Development
> > > > >> > > > >> >>>
> > > > >> > > > >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,
> > > Germany
> > > > >> > > > >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> > > > >> > > > >> >>> Email tobias.gierke@voipfuture.com   Web
> > > > >> > > http://www.voipfuture.com
> > > > >> > > > >> >>>   CEO Jan Bastian
> > > > >> > > > >> >>>
> > > > >> > > > >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID
> > > > DE263738086
> > > > >> > > > >> >>>
> > > > >> > > > >> >>>
> > > > >> > > > >> >>>
> > > > >> > > > >> >>>
> > > > >> > > >
> > > > >>
> > ---------------------------------------------------------------------
> > > > >> > > > >> >>> 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
> > > > >> > > > >> >
> > > > >> > > > >> >
> > > > >> > > > >>
> > > > >> > > > >>
> > > > >> > > > >> --
> > > > >> > > > >> Regards - Ernesto Reinaldo Barreiro
> > > > >> > > > >>
> > > > >> > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> > >
> > > > >> > >
> > > > >> > > --
> > > > >> > > Regards - Ernesto Reinaldo Barreiro
> > > > >> > >
> > > > >> >
> > > > >>
> > > > >>
> > > > >>
> > > > >> --
> > > > >> Regards - Ernesto Reinaldo Barreiro
> > > > >>
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Regards - Ernesto Reinaldo Barreiro
> > >
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Martin,

PortletLike b = new PortletLike("b", Model.of("panel b"))... I can't
see a PortletLike...
on same package. Maybe a good way to use the behavior is: 1- Roll a
PorletLikeBehavior. and an Interface IPorletLike { CharSequence
getOnFailContents(); } to mark porlet like components. 2- Add a component
instantiation listener that if a component implement IPorletLike
automatically adds the behavior.

On Tue, Oct 14, 2014 at 10:14 AM, Martin Grigorov <mg...@apache.org>
wrote:

> Hi Ernesto,
>
> I didn't get the question.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, Oct 14, 2014 at 1:10 PM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
> > Thanks! Whose PortletLike on
> >
> >
> https://github.com/martin-g/component-rendering-default/blob/master/src/main/java/com/mycompany/HomePage.java
> > ?
> > PanelA?
> >
> > On Tue, Oct 14, 2014 at 9:03 AM, Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> > > Hi,
> > >
> > > Here is a demo app with Wicket 6.x:
> > > https://github.com/martin-g/component-rendering-default
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Mon, Oct 13, 2014 at 6:13 PM, Martin Grigorov <mgrigorov@apache.org
> >
> > > wrote:
> > >
> > > > Here is a possible solution *now*:
> > > >
> > > > portletLike.add(new AbstractTransformerBehavior() {
> > > >   @Override public CharSequence transform(Component c, CharSequence
> > > > output) {
> > > >      try {
> > > >        c.internalRenderComponent();
> > > >      } catch (Exception x) {
> > > >        return "default result";
> > > >      }
> > > >    }
> > > > });
> > > >
> > > > Something like this should do it.
> > > >
> > > > Martin Grigorov
> > > > Wicket Training and Consulting
> > > > https://twitter.com/mtgrigorov
> > > >
> > > > On Mon, Oct 13, 2014 at 5:39 PM, Ernesto Reinaldo Barreiro <
> > > > reiern70@gmail.com> wrote:
> > > >
> > > >> I see... you may have already streamed content --> Maybe same
> > interface
> > > >> serves to mark a component as "do not stream anything till the end",
> > or
> > > >> stream the contents to an intermediate buffer... but what I way
> above
> > > >> might
> > > >> not make sense as well.
> > > >>
> > > >>
> > > >> On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <
> > mgrigorov@apache.org>
> > > >> wrote:
> > > >>
> > > >> > On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
> > > >> > reiern70@gmail.com> wrote:
> > > >> >
> > > >> > > @Martin,
> > > >> > >
> > > >> > > Just a (maybe stupid) idea:
> > > >> > >
> > > >> > > 1- Mark some component as ISafeFail
> > > >> > > 2- If rendering fails take Component_onfail.html and render it
> > > >> > >
> > > >> >
> > > >> > As I said earlier this is not so trivial.
> > > >> > The failure may happen in the middle of the rendering and the
> > content
> > > >> > collected so far in RequestCycle#getResponse() could be invalid
> > HTML.
> > > >> > Appending anything (loaded from a file or generated on the fly) is
> > not
> > > >> > really a solution.
> > > >> >
> > > >> >
> > > >> > >
> > > >> > > On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <
> > > >> mgrigorov@apache.org>
> > > >> > > wrote:
> > > >> > >
> > > >> > > > https://issues.apache.org/jira/browse/WICKET-4321
> > > >> > > > this is the ticker I meant
> > > >> > > > it suggests to restart the rendering completely for the whole
> > page
> > > >> and
> > > >> > > this
> > > >> > > > is not enough
> > > >> > > > I'll see what kind of changes would be needed to accomplish
> > this.
> > > >> > > >
> > > >> > > > Martin Grigorov
> > > >> > > > Wicket Training and Consulting
> > > >> > > > https://twitter.com/mtgrigorov
> > > >> > > >
> > > >> > > > On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <
> > > >> mgrigorov@apache.org
> > > >> > >
> > > >> > > > wrote:
> > > >> > > >
> > > >> > > > > Hi,
> > > >> > > > >
> > > >> > > > > There is no support for this, even in 7.x.
> > > >> > > > > I remember Carl-Eric Menzel asking for the same
> functionality
> > > >> before
> > > >> > > ...
> > > >> > > > > Behavior#onException() sounds like something similar but
> there
> > > is
> > > >> no
> > > >> > > way
> > > >> > > > > to suppress the bubbling of the exception at the moment.
> > > >> > > > > The bigger problem is that the rendering can fail in the
> > middle,
> > > >> i.e.
> > > >> > > the
> > > >> > > > > component can have written some response already and then
> > fail.
> > > If
> > > >> > the
> > > >> > > > > written response is proper HTML then it is OKish. But if
> some
> > > tag
> > > >> is
> > > >> > > not
> > > >> > > > > closed then the rendering of the complete page may fail.
> > > >> > > > > So if we try to add this functionality we will have to use
> > > >> temporary
> > > >> > > > > Response objects for the rendering of each component to be
> > able
> > > to
> > > >> > > throw
> > > >> > > > > away whatever it has produced before failing.
> > > >> > > > >
> > > >> > > > > Usually the problem is related to the component's model. A
> > > >> workaround
> > > >> > > for
> > > >> > > > > you could be to use a wrapper Model that returns "empty
> data"
> > > when
> > > >> > the
> > > >> > > > > underlying model throws an exception.
> > > >> > > > >
> > > >> > > > > Martin Grigorov
> > > >> > > > > Wicket Training and Consulting
> > > >> > > > > https://twitter.com/mtgrigorov
> > > >> > > > >
> > > >> > > > > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo Barreiro
> <
> > > >> > > > > reiern70@gmail.com> wrote:
> > > >> > > > >
> > > >> > > > >> Hi,
> > > >> > > > >>
> > > >> > > > >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
> > > >> > > > >> tobias.gierke@voipfuture.com> wrote:
> > > >> > > > >>
> > > >> > > > >> > Hi,
> > > >> > > > >> >
> > > >> > > > >> >> Wouldn't it be possible to "embed"  the failing prone
> > > porlets
> > > >> > > inside
> > > >> > > > >> >> iframes so that each one is a Wicket page?
> > > >> > > > >> >>
> > > >> > > > >> > I already thought about this but the page uses quite a
> lot
> > of
> > > >> > fancy
> > > >> > > > >> > CSS/Ajax/Javascript (portlets are rendered in a grid with
> > > >> > > configurable
> > > >> > > > >> > row/column count, drag'n'drop to move them around etc.)
> and
> > > I'd
> > > >> > > rather
> > > >> > > > >> not
> > > >> > > > >> > touch the existing code if there's a Java-side only
> > solution
> > > >> ;-)
> > > >> > > > >> >
> > > >> > > > >>
> > > >> > > > >> I do not know of any :-(
> > > >> > > > >>
> > > >> > > > >> Another possibility is build each client entirely on
> > JavaScript
> > > >> and
> > > >> > > use
> > > >> > > > >> Wicket just as a service layer... not very Wicket like but
> > you
> > > >> would
> > > >> > > not
> > > >> > > > >> have this problem.
> > > >> > > > >>
> > > >> > > > >>
> > > >> > > > >> >
> > > >> > > > >> > Cheers,
> > > >> > > > >> > Tobias
> > > >> > > > >> >
> > > >> > > > >> >
> > > >> > > > >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> > > >> > > > >> >> tobias.gierke@voipfuture.com> wrote:
> > > >> > > > >> >>
> > > >> > > > >> >>  Hi,
> > > >> > > > >> >>>
> > > >> > > > >> >>> In our web application we have a dashboard-like
> homepage
> > > that
> > > >> > > > >> displays a
> > > >> > > > >> >>> number of user-configurable 'portlets' (which are
> really
> > > just
> > > >> > > > ordinary
> > > >> > > > >> >>> Wicket components and have nothing to do with the
> Portlet
> > > >> spec).
> > > >> > > I'm
> > > >> > > > >> >>> looking for a way of preventing the application from
> > > becoming
> > > >> > > > >> unusable in
> > > >> > > > >> >>> case one or more of these portlets continuously fail to
> > > >> render
> > > >> > > > >> because of
> > > >> > > > >> >>> some internal error/bug.
> > > >> > > > >> >>>
> > > >> > > > >> >>> We're currently using a custom RequestCycleListener
> with
> > > the
> > > >> > > > >> >>> onException()
> > > >> > > > >> >>> method redirecting to a generic error page, thus when
> > > >> rendering
> > > >> > > of a
> > > >> > > > >> >>> 'portlet' fails the user will never get to see the
> > homepage
> > > >> and
> > > >> > > > always
> > > >> > > > >> >>> end
> > > >> > > > >> >>> up on the error page - which is obviously not really
> > > >> desirable.
> > > >> > > > >> >>>
> > > >> > > > >> >>> Is there a way to to hook into Wicket's rendering cycle
> > so
> > > >> that
> > > >> > I
> > > >> > > > can
> > > >> > > > >> >>> provide some default markup in case rendering of a
> > > component
> > > >> > > > (subtree)
> > > >> > > > >> >>> fails with a RuntimeException ?
> > > >> > > > >> >>>
> > > >> > > > >> >>> I understand that this maybe be very tricky since the
> > > >> component
> > > >> > > > >> subtree
> > > >> > > > >> >>> might've rendered partially and thus internal state
> will
> > be
> > > >> > > > >> inconsistent.
> > > >> > > > >> >>> It would probably require serializing the initial state
> > of
> > > >> the
> > > >> > > > >> component
> > > >> > > > >> >>> (subtree) before rendering starts and reverting the
> > wholle
> > > >> > subtree
> > > >> > > > to
> > > >> > > > >> its
> > > >> > > > >> >>> initial state once a RuntimeException is thrown.
> > > >> > > > >> >>>
> > > >> > > > >> >>> We're running Wicket 1.5.12.
> > > >> > > > >> >>>
> > > >> > > > >> >>> Thanks in advance,
> > > >> > > > >> >>> Tobias
> > > >> > > > >> >>>
> > > >> > > > >> >>> --
> > > >> > > > >> >>> Tobias Gierke
> > > >> > > > >> >>> Development
> > > >> > > > >> >>>
> > > >> > > > >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,
> > Germany
> > > >> > > > >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> > > >> > > > >> >>> Email tobias.gierke@voipfuture.com   Web
> > > >> > > http://www.voipfuture.com
> > > >> > > > >> >>>   CEO Jan Bastian
> > > >> > > > >> >>>
> > > >> > > > >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID
> > > DE263738086
> > > >> > > > >> >>>
> > > >> > > > >> >>>
> > > >> > > > >> >>>
> > > >> > > > >> >>>
> > > >> > > >
> > > >>
> ---------------------------------------------------------------------
> > > >> > > > >> >>> 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
> > > >> > > > >> >
> > > >> > > > >> >
> > > >> > > > >>
> > > >> > > > >>
> > > >> > > > >> --
> > > >> > > > >> Regards - Ernesto Reinaldo Barreiro
> > > >> > > > >>
> > > >> > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> > >
> > > >> > >
> > > >> > > --
> > > >> > > Regards - Ernesto Reinaldo Barreiro
> > > >> > >
> > > >> >
> > > >>
> > > >>
> > > >>
> > > >> --
> > > >> Regards - Ernesto Reinaldo Barreiro
> > > >>
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> >
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Martin Grigorov <mg...@apache.org>.
Hi Ernesto,

I didn't get the question.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Oct 14, 2014 at 1:10 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Thanks! Whose PortletLike on
>
> https://github.com/martin-g/component-rendering-default/blob/master/src/main/java/com/mycompany/HomePage.java
> ?
> PanelA?
>
> On Tue, Oct 14, 2014 at 9:03 AM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi,
> >
> > Here is a demo app with Wicket 6.x:
> > https://github.com/martin-g/component-rendering-default
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Mon, Oct 13, 2014 at 6:13 PM, Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> > > Here is a possible solution *now*:
> > >
> > > portletLike.add(new AbstractTransformerBehavior() {
> > >   @Override public CharSequence transform(Component c, CharSequence
> > > output) {
> > >      try {
> > >        c.internalRenderComponent();
> > >      } catch (Exception x) {
> > >        return "default result";
> > >      }
> > >    }
> > > });
> > >
> > > Something like this should do it.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Mon, Oct 13, 2014 at 5:39 PM, Ernesto Reinaldo Barreiro <
> > > reiern70@gmail.com> wrote:
> > >
> > >> I see... you may have already streamed content --> Maybe same
> interface
> > >> serves to mark a component as "do not stream anything till the end",
> or
> > >> stream the contents to an intermediate buffer... but what I way above
> > >> might
> > >> not make sense as well.
> > >>
> > >>
> > >> On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <
> mgrigorov@apache.org>
> > >> wrote:
> > >>
> > >> > On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
> > >> > reiern70@gmail.com> wrote:
> > >> >
> > >> > > @Martin,
> > >> > >
> > >> > > Just a (maybe stupid) idea:
> > >> > >
> > >> > > 1- Mark some component as ISafeFail
> > >> > > 2- If rendering fails take Component_onfail.html and render it
> > >> > >
> > >> >
> > >> > As I said earlier this is not so trivial.
> > >> > The failure may happen in the middle of the rendering and the
> content
> > >> > collected so far in RequestCycle#getResponse() could be invalid
> HTML.
> > >> > Appending anything (loaded from a file or generated on the fly) is
> not
> > >> > really a solution.
> > >> >
> > >> >
> > >> > >
> > >> > > On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <
> > >> mgrigorov@apache.org>
> > >> > > wrote:
> > >> > >
> > >> > > > https://issues.apache.org/jira/browse/WICKET-4321
> > >> > > > this is the ticker I meant
> > >> > > > it suggests to restart the rendering completely for the whole
> page
> > >> and
> > >> > > this
> > >> > > > is not enough
> > >> > > > I'll see what kind of changes would be needed to accomplish
> this.
> > >> > > >
> > >> > > > Martin Grigorov
> > >> > > > Wicket Training and Consulting
> > >> > > > https://twitter.com/mtgrigorov
> > >> > > >
> > >> > > > On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <
> > >> mgrigorov@apache.org
> > >> > >
> > >> > > > wrote:
> > >> > > >
> > >> > > > > Hi,
> > >> > > > >
> > >> > > > > There is no support for this, even in 7.x.
> > >> > > > > I remember Carl-Eric Menzel asking for the same functionality
> > >> before
> > >> > > ...
> > >> > > > > Behavior#onException() sounds like something similar but there
> > is
> > >> no
> > >> > > way
> > >> > > > > to suppress the bubbling of the exception at the moment.
> > >> > > > > The bigger problem is that the rendering can fail in the
> middle,
> > >> i.e.
> > >> > > the
> > >> > > > > component can have written some response already and then
> fail.
> > If
> > >> > the
> > >> > > > > written response is proper HTML then it is OKish. But if some
> > tag
> > >> is
> > >> > > not
> > >> > > > > closed then the rendering of the complete page may fail.
> > >> > > > > So if we try to add this functionality we will have to use
> > >> temporary
> > >> > > > > Response objects for the rendering of each component to be
> able
> > to
> > >> > > throw
> > >> > > > > away whatever it has produced before failing.
> > >> > > > >
> > >> > > > > Usually the problem is related to the component's model. A
> > >> workaround
> > >> > > for
> > >> > > > > you could be to use a wrapper Model that returns "empty data"
> > when
> > >> > the
> > >> > > > > underlying model throws an exception.
> > >> > > > >
> > >> > > > > Martin Grigorov
> > >> > > > > Wicket Training and Consulting
> > >> > > > > https://twitter.com/mtgrigorov
> > >> > > > >
> > >> > > > > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo Barreiro <
> > >> > > > > reiern70@gmail.com> wrote:
> > >> > > > >
> > >> > > > >> Hi,
> > >> > > > >>
> > >> > > > >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
> > >> > > > >> tobias.gierke@voipfuture.com> wrote:
> > >> > > > >>
> > >> > > > >> > Hi,
> > >> > > > >> >
> > >> > > > >> >> Wouldn't it be possible to "embed"  the failing prone
> > porlets
> > >> > > inside
> > >> > > > >> >> iframes so that each one is a Wicket page?
> > >> > > > >> >>
> > >> > > > >> > I already thought about this but the page uses quite a lot
> of
> > >> > fancy
> > >> > > > >> > CSS/Ajax/Javascript (portlets are rendered in a grid with
> > >> > > configurable
> > >> > > > >> > row/column count, drag'n'drop to move them around etc.) and
> > I'd
> > >> > > rather
> > >> > > > >> not
> > >> > > > >> > touch the existing code if there's a Java-side only
> solution
> > >> ;-)
> > >> > > > >> >
> > >> > > > >>
> > >> > > > >> I do not know of any :-(
> > >> > > > >>
> > >> > > > >> Another possibility is build each client entirely on
> JavaScript
> > >> and
> > >> > > use
> > >> > > > >> Wicket just as a service layer... not very Wicket like but
> you
> > >> would
> > >> > > not
> > >> > > > >> have this problem.
> > >> > > > >>
> > >> > > > >>
> > >> > > > >> >
> > >> > > > >> > Cheers,
> > >> > > > >> > Tobias
> > >> > > > >> >
> > >> > > > >> >
> > >> > > > >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> > >> > > > >> >> tobias.gierke@voipfuture.com> wrote:
> > >> > > > >> >>
> > >> > > > >> >>  Hi,
> > >> > > > >> >>>
> > >> > > > >> >>> In our web application we have a dashboard-like homepage
> > that
> > >> > > > >> displays a
> > >> > > > >> >>> number of user-configurable 'portlets' (which are really
> > just
> > >> > > > ordinary
> > >> > > > >> >>> Wicket components and have nothing to do with the Portlet
> > >> spec).
> > >> > > I'm
> > >> > > > >> >>> looking for a way of preventing the application from
> > becoming
> > >> > > > >> unusable in
> > >> > > > >> >>> case one or more of these portlets continuously fail to
> > >> render
> > >> > > > >> because of
> > >> > > > >> >>> some internal error/bug.
> > >> > > > >> >>>
> > >> > > > >> >>> We're currently using a custom RequestCycleListener with
> > the
> > >> > > > >> >>> onException()
> > >> > > > >> >>> method redirecting to a generic error page, thus when
> > >> rendering
> > >> > > of a
> > >> > > > >> >>> 'portlet' fails the user will never get to see the
> homepage
> > >> and
> > >> > > > always
> > >> > > > >> >>> end
> > >> > > > >> >>> up on the error page - which is obviously not really
> > >> desirable.
> > >> > > > >> >>>
> > >> > > > >> >>> Is there a way to to hook into Wicket's rendering cycle
> so
> > >> that
> > >> > I
> > >> > > > can
> > >> > > > >> >>> provide some default markup in case rendering of a
> > component
> > >> > > > (subtree)
> > >> > > > >> >>> fails with a RuntimeException ?
> > >> > > > >> >>>
> > >> > > > >> >>> I understand that this maybe be very tricky since the
> > >> component
> > >> > > > >> subtree
> > >> > > > >> >>> might've rendered partially and thus internal state will
> be
> > >> > > > >> inconsistent.
> > >> > > > >> >>> It would probably require serializing the initial state
> of
> > >> the
> > >> > > > >> component
> > >> > > > >> >>> (subtree) before rendering starts and reverting the
> wholle
> > >> > subtree
> > >> > > > to
> > >> > > > >> its
> > >> > > > >> >>> initial state once a RuntimeException is thrown.
> > >> > > > >> >>>
> > >> > > > >> >>> We're running Wicket 1.5.12.
> > >> > > > >> >>>
> > >> > > > >> >>> Thanks in advance,
> > >> > > > >> >>> Tobias
> > >> > > > >> >>>
> > >> > > > >> >>> --
> > >> > > > >> >>> Tobias Gierke
> > >> > > > >> >>> Development
> > >> > > > >> >>>
> > >> > > > >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,
> Germany
> > >> > > > >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> > >> > > > >> >>> Email tobias.gierke@voipfuture.com   Web
> > >> > > http://www.voipfuture.com
> > >> > > > >> >>>   CEO Jan Bastian
> > >> > > > >> >>>
> > >> > > > >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID
> > DE263738086
> > >> > > > >> >>>
> > >> > > > >> >>>
> > >> > > > >> >>>
> > >> > > > >> >>>
> > >> > > >
> > >> ---------------------------------------------------------------------
> > >> > > > >> >>> 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
> > >> > > > >> >
> > >> > > > >> >
> > >> > > > >>
> > >> > > > >>
> > >> > > > >> --
> > >> > > > >> Regards - Ernesto Reinaldo Barreiro
> > >> > > > >>
> > >> > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> > >
> > >> > >
> > >> > > --
> > >> > > Regards - Ernesto Reinaldo Barreiro
> > >> > >
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >> Regards - Ernesto Reinaldo Barreiro
> > >>
> > >
> > >
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Thanks! Whose PortletLike on
https://github.com/martin-g/component-rendering-default/blob/master/src/main/java/com/mycompany/HomePage.java?
PanelA?

On Tue, Oct 14, 2014 at 9:03 AM, Martin Grigorov <mg...@apache.org>
wrote:

> Hi,
>
> Here is a demo app with Wicket 6.x:
> https://github.com/martin-g/component-rendering-default
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Oct 13, 2014 at 6:13 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Here is a possible solution *now*:
> >
> > portletLike.add(new AbstractTransformerBehavior() {
> >   @Override public CharSequence transform(Component c, CharSequence
> > output) {
> >      try {
> >        c.internalRenderComponent();
> >      } catch (Exception x) {
> >        return "default result";
> >      }
> >    }
> > });
> >
> > Something like this should do it.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Mon, Oct 13, 2014 at 5:39 PM, Ernesto Reinaldo Barreiro <
> > reiern70@gmail.com> wrote:
> >
> >> I see... you may have already streamed content --> Maybe same interface
> >> serves to mark a component as "do not stream anything till the end", or
> >> stream the contents to an intermediate buffer... but what I way above
> >> might
> >> not make sense as well.
> >>
> >>
> >> On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <mg...@apache.org>
> >> wrote:
> >>
> >> > On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
> >> > reiern70@gmail.com> wrote:
> >> >
> >> > > @Martin,
> >> > >
> >> > > Just a (maybe stupid) idea:
> >> > >
> >> > > 1- Mark some component as ISafeFail
> >> > > 2- If rendering fails take Component_onfail.html and render it
> >> > >
> >> >
> >> > As I said earlier this is not so trivial.
> >> > The failure may happen in the middle of the rendering and the content
> >> > collected so far in RequestCycle#getResponse() could be invalid HTML.
> >> > Appending anything (loaded from a file or generated on the fly) is not
> >> > really a solution.
> >> >
> >> >
> >> > >
> >> > > On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <
> >> mgrigorov@apache.org>
> >> > > wrote:
> >> > >
> >> > > > https://issues.apache.org/jira/browse/WICKET-4321
> >> > > > this is the ticker I meant
> >> > > > it suggests to restart the rendering completely for the whole page
> >> and
> >> > > this
> >> > > > is not enough
> >> > > > I'll see what kind of changes would be needed to accomplish this.
> >> > > >
> >> > > > Martin Grigorov
> >> > > > Wicket Training and Consulting
> >> > > > https://twitter.com/mtgrigorov
> >> > > >
> >> > > > On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <
> >> mgrigorov@apache.org
> >> > >
> >> > > > wrote:
> >> > > >
> >> > > > > Hi,
> >> > > > >
> >> > > > > There is no support for this, even in 7.x.
> >> > > > > I remember Carl-Eric Menzel asking for the same functionality
> >> before
> >> > > ...
> >> > > > > Behavior#onException() sounds like something similar but there
> is
> >> no
> >> > > way
> >> > > > > to suppress the bubbling of the exception at the moment.
> >> > > > > The bigger problem is that the rendering can fail in the middle,
> >> i.e.
> >> > > the
> >> > > > > component can have written some response already and then fail.
> If
> >> > the
> >> > > > > written response is proper HTML then it is OKish. But if some
> tag
> >> is
> >> > > not
> >> > > > > closed then the rendering of the complete page may fail.
> >> > > > > So if we try to add this functionality we will have to use
> >> temporary
> >> > > > > Response objects for the rendering of each component to be able
> to
> >> > > throw
> >> > > > > away whatever it has produced before failing.
> >> > > > >
> >> > > > > Usually the problem is related to the component's model. A
> >> workaround
> >> > > for
> >> > > > > you could be to use a wrapper Model that returns "empty data"
> when
> >> > the
> >> > > > > underlying model throws an exception.
> >> > > > >
> >> > > > > Martin Grigorov
> >> > > > > Wicket Training and Consulting
> >> > > > > https://twitter.com/mtgrigorov
> >> > > > >
> >> > > > > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo Barreiro <
> >> > > > > reiern70@gmail.com> wrote:
> >> > > > >
> >> > > > >> Hi,
> >> > > > >>
> >> > > > >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
> >> > > > >> tobias.gierke@voipfuture.com> wrote:
> >> > > > >>
> >> > > > >> > Hi,
> >> > > > >> >
> >> > > > >> >> Wouldn't it be possible to "embed"  the failing prone
> porlets
> >> > > inside
> >> > > > >> >> iframes so that each one is a Wicket page?
> >> > > > >> >>
> >> > > > >> > I already thought about this but the page uses quite a lot of
> >> > fancy
> >> > > > >> > CSS/Ajax/Javascript (portlets are rendered in a grid with
> >> > > configurable
> >> > > > >> > row/column count, drag'n'drop to move them around etc.) and
> I'd
> >> > > rather
> >> > > > >> not
> >> > > > >> > touch the existing code if there's a Java-side only solution
> >> ;-)
> >> > > > >> >
> >> > > > >>
> >> > > > >> I do not know of any :-(
> >> > > > >>
> >> > > > >> Another possibility is build each client entirely on JavaScript
> >> and
> >> > > use
> >> > > > >> Wicket just as a service layer... not very Wicket like but you
> >> would
> >> > > not
> >> > > > >> have this problem.
> >> > > > >>
> >> > > > >>
> >> > > > >> >
> >> > > > >> > Cheers,
> >> > > > >> > Tobias
> >> > > > >> >
> >> > > > >> >
> >> > > > >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> >> > > > >> >> tobias.gierke@voipfuture.com> wrote:
> >> > > > >> >>
> >> > > > >> >>  Hi,
> >> > > > >> >>>
> >> > > > >> >>> In our web application we have a dashboard-like homepage
> that
> >> > > > >> displays a
> >> > > > >> >>> number of user-configurable 'portlets' (which are really
> just
> >> > > > ordinary
> >> > > > >> >>> Wicket components and have nothing to do with the Portlet
> >> spec).
> >> > > I'm
> >> > > > >> >>> looking for a way of preventing the application from
> becoming
> >> > > > >> unusable in
> >> > > > >> >>> case one or more of these portlets continuously fail to
> >> render
> >> > > > >> because of
> >> > > > >> >>> some internal error/bug.
> >> > > > >> >>>
> >> > > > >> >>> We're currently using a custom RequestCycleListener with
> the
> >> > > > >> >>> onException()
> >> > > > >> >>> method redirecting to a generic error page, thus when
> >> rendering
> >> > > of a
> >> > > > >> >>> 'portlet' fails the user will never get to see the homepage
> >> and
> >> > > > always
> >> > > > >> >>> end
> >> > > > >> >>> up on the error page - which is obviously not really
> >> desirable.
> >> > > > >> >>>
> >> > > > >> >>> Is there a way to to hook into Wicket's rendering cycle so
> >> that
> >> > I
> >> > > > can
> >> > > > >> >>> provide some default markup in case rendering of a
> component
> >> > > > (subtree)
> >> > > > >> >>> fails with a RuntimeException ?
> >> > > > >> >>>
> >> > > > >> >>> I understand that this maybe be very tricky since the
> >> component
> >> > > > >> subtree
> >> > > > >> >>> might've rendered partially and thus internal state will be
> >> > > > >> inconsistent.
> >> > > > >> >>> It would probably require serializing the initial state of
> >> the
> >> > > > >> component
> >> > > > >> >>> (subtree) before rendering starts and reverting the wholle
> >> > subtree
> >> > > > to
> >> > > > >> its
> >> > > > >> >>> initial state once a RuntimeException is thrown.
> >> > > > >> >>>
> >> > > > >> >>> We're running Wicket 1.5.12.
> >> > > > >> >>>
> >> > > > >> >>> Thanks in advance,
> >> > > > >> >>> Tobias
> >> > > > >> >>>
> >> > > > >> >>> --
> >> > > > >> >>> Tobias Gierke
> >> > > > >> >>> Development
> >> > > > >> >>>
> >> > > > >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
> >> > > > >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> >> > > > >> >>> Email tobias.gierke@voipfuture.com   Web
> >> > > http://www.voipfuture.com
> >> > > > >> >>>   CEO Jan Bastian
> >> > > > >> >>>
> >> > > > >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID
> DE263738086
> >> > > > >> >>>
> >> > > > >> >>>
> >> > > > >> >>>
> >> > > > >> >>>
> >> > > >
> >> ---------------------------------------------------------------------
> >> > > > >> >>> 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
> >> > > > >> >
> >> > > > >> >
> >> > > > >>
> >> > > > >>
> >> > > > >> --
> >> > > > >> Regards - Ernesto Reinaldo Barreiro
> >> > > > >>
> >> > > > >
> >> > > > >
> >> > > >
> >> > >
> >> > >
> >> > >
> >> > > --
> >> > > Regards - Ernesto Reinaldo Barreiro
> >> > >
> >> >
> >>
> >>
> >>
> >> --
> >> Regards - Ernesto Reinaldo Barreiro
> >>
> >
> >
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Here is a demo app with Wicket 6.x:
https://github.com/martin-g/component-rendering-default

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Oct 13, 2014 at 6:13 PM, Martin Grigorov <mg...@apache.org>
wrote:

> Here is a possible solution *now*:
>
> portletLike.add(new AbstractTransformerBehavior() {
>   @Override public CharSequence transform(Component c, CharSequence
> output) {
>      try {
>        c.internalRenderComponent();
>      } catch (Exception x) {
>        return "default result";
>      }
>    }
> });
>
> Something like this should do it.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Oct 13, 2014 at 5:39 PM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
>> I see... you may have already streamed content --> Maybe same interface
>> serves to mark a component as "do not stream anything till the end", or
>> stream the contents to an intermediate buffer... but what I way above
>> might
>> not make sense as well.
>>
>>
>> On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <mg...@apache.org>
>> wrote:
>>
>> > On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
>> > reiern70@gmail.com> wrote:
>> >
>> > > @Martin,
>> > >
>> > > Just a (maybe stupid) idea:
>> > >
>> > > 1- Mark some component as ISafeFail
>> > > 2- If rendering fails take Component_onfail.html and render it
>> > >
>> >
>> > As I said earlier this is not so trivial.
>> > The failure may happen in the middle of the rendering and the content
>> > collected so far in RequestCycle#getResponse() could be invalid HTML.
>> > Appending anything (loaded from a file or generated on the fly) is not
>> > really a solution.
>> >
>> >
>> > >
>> > > On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <
>> mgrigorov@apache.org>
>> > > wrote:
>> > >
>> > > > https://issues.apache.org/jira/browse/WICKET-4321
>> > > > this is the ticker I meant
>> > > > it suggests to restart the rendering completely for the whole page
>> and
>> > > this
>> > > > is not enough
>> > > > I'll see what kind of changes would be needed to accomplish this.
>> > > >
>> > > > Martin Grigorov
>> > > > Wicket Training and Consulting
>> > > > https://twitter.com/mtgrigorov
>> > > >
>> > > > On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <
>> mgrigorov@apache.org
>> > >
>> > > > wrote:
>> > > >
>> > > > > Hi,
>> > > > >
>> > > > > There is no support for this, even in 7.x.
>> > > > > I remember Carl-Eric Menzel asking for the same functionality
>> before
>> > > ...
>> > > > > Behavior#onException() sounds like something similar but there is
>> no
>> > > way
>> > > > > to suppress the bubbling of the exception at the moment.
>> > > > > The bigger problem is that the rendering can fail in the middle,
>> i.e.
>> > > the
>> > > > > component can have written some response already and then fail. If
>> > the
>> > > > > written response is proper HTML then it is OKish. But if some tag
>> is
>> > > not
>> > > > > closed then the rendering of the complete page may fail.
>> > > > > So if we try to add this functionality we will have to use
>> temporary
>> > > > > Response objects for the rendering of each component to be able to
>> > > throw
>> > > > > away whatever it has produced before failing.
>> > > > >
>> > > > > Usually the problem is related to the component's model. A
>> workaround
>> > > for
>> > > > > you could be to use a wrapper Model that returns "empty data" when
>> > the
>> > > > > underlying model throws an exception.
>> > > > >
>> > > > > Martin Grigorov
>> > > > > Wicket Training and Consulting
>> > > > > https://twitter.com/mtgrigorov
>> > > > >
>> > > > > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo Barreiro <
>> > > > > reiern70@gmail.com> wrote:
>> > > > >
>> > > > >> Hi,
>> > > > >>
>> > > > >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
>> > > > >> tobias.gierke@voipfuture.com> wrote:
>> > > > >>
>> > > > >> > Hi,
>> > > > >> >
>> > > > >> >> Wouldn't it be possible to "embed"  the failing prone porlets
>> > > inside
>> > > > >> >> iframes so that each one is a Wicket page?
>> > > > >> >>
>> > > > >> > I already thought about this but the page uses quite a lot of
>> > fancy
>> > > > >> > CSS/Ajax/Javascript (portlets are rendered in a grid with
>> > > configurable
>> > > > >> > row/column count, drag'n'drop to move them around etc.) and I'd
>> > > rather
>> > > > >> not
>> > > > >> > touch the existing code if there's a Java-side only solution
>> ;-)
>> > > > >> >
>> > > > >>
>> > > > >> I do not know of any :-(
>> > > > >>
>> > > > >> Another possibility is build each client entirely on JavaScript
>> and
>> > > use
>> > > > >> Wicket just as a service layer... not very Wicket like but you
>> would
>> > > not
>> > > > >> have this problem.
>> > > > >>
>> > > > >>
>> > > > >> >
>> > > > >> > Cheers,
>> > > > >> > Tobias
>> > > > >> >
>> > > > >> >
>> > > > >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
>> > > > >> >> tobias.gierke@voipfuture.com> wrote:
>> > > > >> >>
>> > > > >> >>  Hi,
>> > > > >> >>>
>> > > > >> >>> In our web application we have a dashboard-like homepage that
>> > > > >> displays a
>> > > > >> >>> number of user-configurable 'portlets' (which are really just
>> > > > ordinary
>> > > > >> >>> Wicket components and have nothing to do with the Portlet
>> spec).
>> > > I'm
>> > > > >> >>> looking for a way of preventing the application from becoming
>> > > > >> unusable in
>> > > > >> >>> case one or more of these portlets continuously fail to
>> render
>> > > > >> because of
>> > > > >> >>> some internal error/bug.
>> > > > >> >>>
>> > > > >> >>> We're currently using a custom RequestCycleListener with the
>> > > > >> >>> onException()
>> > > > >> >>> method redirecting to a generic error page, thus when
>> rendering
>> > > of a
>> > > > >> >>> 'portlet' fails the user will never get to see the homepage
>> and
>> > > > always
>> > > > >> >>> end
>> > > > >> >>> up on the error page - which is obviously not really
>> desirable.
>> > > > >> >>>
>> > > > >> >>> Is there a way to to hook into Wicket's rendering cycle so
>> that
>> > I
>> > > > can
>> > > > >> >>> provide some default markup in case rendering of a component
>> > > > (subtree)
>> > > > >> >>> fails with a RuntimeException ?
>> > > > >> >>>
>> > > > >> >>> I understand that this maybe be very tricky since the
>> component
>> > > > >> subtree
>> > > > >> >>> might've rendered partially and thus internal state will be
>> > > > >> inconsistent.
>> > > > >> >>> It would probably require serializing the initial state of
>> the
>> > > > >> component
>> > > > >> >>> (subtree) before rendering starts and reverting the wholle
>> > subtree
>> > > > to
>> > > > >> its
>> > > > >> >>> initial state once a RuntimeException is thrown.
>> > > > >> >>>
>> > > > >> >>> We're running Wicket 1.5.12.
>> > > > >> >>>
>> > > > >> >>> Thanks in advance,
>> > > > >> >>> Tobias
>> > > > >> >>>
>> > > > >> >>> --
>> > > > >> >>> Tobias Gierke
>> > > > >> >>> Development
>> > > > >> >>>
>> > > > >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
>> > > > >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
>> > > > >> >>> Email tobias.gierke@voipfuture.com   Web
>> > > http://www.voipfuture.com
>> > > > >> >>>   CEO Jan Bastian
>> > > > >> >>>
>> > > > >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
>> > > > >> >>>
>> > > > >> >>>
>> > > > >> >>>
>> > > > >> >>>
>> > > >
>> ---------------------------------------------------------------------
>> > > > >> >>> 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
>> > > > >> >
>> > > > >> >
>> > > > >>
>> > > > >>
>> > > > >> --
>> > > > >> Regards - Ernesto Reinaldo Barreiro
>> > > > >>
>> > > > >
>> > > > >
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > Regards - Ernesto Reinaldo Barreiro
>> > >
>> >
>>
>>
>>
>> --
>> Regards - Ernesto Reinaldo Barreiro
>>
>
>

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Martin Grigorov <mg...@apache.org>.
Here is a possible solution *now*:

portletLike.add(new AbstractTransformerBehavior() {
  @Override public CharSequence transform(Component c, CharSequence output)
{
     try {
       c.internalRenderComponent();
     } catch (Exception x) {
       return "default result";
     }
   }
});

Something like this should do it.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Oct 13, 2014 at 5:39 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> I see... you may have already streamed content --> Maybe same interface
> serves to mark a component as "do not stream anything till the end", or
> stream the contents to an intermediate buffer... but what I way above might
> not make sense as well.
>
>
> On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
> > reiern70@gmail.com> wrote:
> >
> > > @Martin,
> > >
> > > Just a (maybe stupid) idea:
> > >
> > > 1- Mark some component as ISafeFail
> > > 2- If rendering fails take Component_onfail.html and render it
> > >
> >
> > As I said earlier this is not so trivial.
> > The failure may happen in the middle of the rendering and the content
> > collected so far in RequestCycle#getResponse() could be invalid HTML.
> > Appending anything (loaded from a file or generated on the fly) is not
> > really a solution.
> >
> >
> > >
> > > On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <mgrigorov@apache.org
> >
> > > wrote:
> > >
> > > > https://issues.apache.org/jira/browse/WICKET-4321
> > > > this is the ticker I meant
> > > > it suggests to restart the rendering completely for the whole page
> and
> > > this
> > > > is not enough
> > > > I'll see what kind of changes would be needed to accomplish this.
> > > >
> > > > Martin Grigorov
> > > > Wicket Training and Consulting
> > > > https://twitter.com/mtgrigorov
> > > >
> > > > On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <
> mgrigorov@apache.org
> > >
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > There is no support for this, even in 7.x.
> > > > > I remember Carl-Eric Menzel asking for the same functionality
> before
> > > ...
> > > > > Behavior#onException() sounds like something similar but there is
> no
> > > way
> > > > > to suppress the bubbling of the exception at the moment.
> > > > > The bigger problem is that the rendering can fail in the middle,
> i.e.
> > > the
> > > > > component can have written some response already and then fail. If
> > the
> > > > > written response is proper HTML then it is OKish. But if some tag
> is
> > > not
> > > > > closed then the rendering of the complete page may fail.
> > > > > So if we try to add this functionality we will have to use
> temporary
> > > > > Response objects for the rendering of each component to be able to
> > > throw
> > > > > away whatever it has produced before failing.
> > > > >
> > > > > Usually the problem is related to the component's model. A
> workaround
> > > for
> > > > > you could be to use a wrapper Model that returns "empty data" when
> > the
> > > > > underlying model throws an exception.
> > > > >
> > > > > Martin Grigorov
> > > > > Wicket Training and Consulting
> > > > > https://twitter.com/mtgrigorov
> > > > >
> > > > > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo Barreiro <
> > > > > reiern70@gmail.com> wrote:
> > > > >
> > > > >> Hi,
> > > > >>
> > > > >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
> > > > >> tobias.gierke@voipfuture.com> wrote:
> > > > >>
> > > > >> > Hi,
> > > > >> >
> > > > >> >> Wouldn't it be possible to "embed"  the failing prone porlets
> > > inside
> > > > >> >> iframes so that each one is a Wicket page?
> > > > >> >>
> > > > >> > I already thought about this but the page uses quite a lot of
> > fancy
> > > > >> > CSS/Ajax/Javascript (portlets are rendered in a grid with
> > > configurable
> > > > >> > row/column count, drag'n'drop to move them around etc.) and I'd
> > > rather
> > > > >> not
> > > > >> > touch the existing code if there's a Java-side only solution ;-)
> > > > >> >
> > > > >>
> > > > >> I do not know of any :-(
> > > > >>
> > > > >> Another possibility is build each client entirely on JavaScript
> and
> > > use
> > > > >> Wicket just as a service layer... not very Wicket like but you
> would
> > > not
> > > > >> have this problem.
> > > > >>
> > > > >>
> > > > >> >
> > > > >> > Cheers,
> > > > >> > Tobias
> > > > >> >
> > > > >> >
> > > > >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> > > > >> >> tobias.gierke@voipfuture.com> wrote:
> > > > >> >>
> > > > >> >>  Hi,
> > > > >> >>>
> > > > >> >>> In our web application we have a dashboard-like homepage that
> > > > >> displays a
> > > > >> >>> number of user-configurable 'portlets' (which are really just
> > > > ordinary
> > > > >> >>> Wicket components and have nothing to do with the Portlet
> spec).
> > > I'm
> > > > >> >>> looking for a way of preventing the application from becoming
> > > > >> unusable in
> > > > >> >>> case one or more of these portlets continuously fail to render
> > > > >> because of
> > > > >> >>> some internal error/bug.
> > > > >> >>>
> > > > >> >>> We're currently using a custom RequestCycleListener with the
> > > > >> >>> onException()
> > > > >> >>> method redirecting to a generic error page, thus when
> rendering
> > > of a
> > > > >> >>> 'portlet' fails the user will never get to see the homepage
> and
> > > > always
> > > > >> >>> end
> > > > >> >>> up on the error page - which is obviously not really
> desirable.
> > > > >> >>>
> > > > >> >>> Is there a way to to hook into Wicket's rendering cycle so
> that
> > I
> > > > can
> > > > >> >>> provide some default markup in case rendering of a component
> > > > (subtree)
> > > > >> >>> fails with a RuntimeException ?
> > > > >> >>>
> > > > >> >>> I understand that this maybe be very tricky since the
> component
> > > > >> subtree
> > > > >> >>> might've rendered partially and thus internal state will be
> > > > >> inconsistent.
> > > > >> >>> It would probably require serializing the initial state of the
> > > > >> component
> > > > >> >>> (subtree) before rendering starts and reverting the wholle
> > subtree
> > > > to
> > > > >> its
> > > > >> >>> initial state once a RuntimeException is thrown.
> > > > >> >>>
> > > > >> >>> We're running Wicket 1.5.12.
> > > > >> >>>
> > > > >> >>> Thanks in advance,
> > > > >> >>> Tobias
> > > > >> >>>
> > > > >> >>> --
> > > > >> >>> Tobias Gierke
> > > > >> >>> Development
> > > > >> >>>
> > > > >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
> > > > >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> > > > >> >>> Email tobias.gierke@voipfuture.com   Web
> > > http://www.voipfuture.com
> > > > >> >>>   CEO Jan Bastian
> > > > >> >>>
> > > > >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
> > > > >> >>>
> > > > >> >>>
> > > > >> >>>
> > > > >> >>>
> > > > ---------------------------------------------------------------------
> > > > >> >>> 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
> > > > >> >
> > > > >> >
> > > > >>
> > > > >>
> > > > >> --
> > > > >> Regards - Ernesto Reinaldo Barreiro
> > > > >>
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Regards - Ernesto Reinaldo Barreiro
> > >
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
I see... you may have already streamed content --> Maybe same interface
serves to mark a component as "do not stream anything till the end", or
stream the contents to an intermediate buffer... but what I way above might
not make sense as well.


On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <mg...@apache.org>
wrote:

> On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
> > @Martin,
> >
> > Just a (maybe stupid) idea:
> >
> > 1- Mark some component as ISafeFail
> > 2- If rendering fails take Component_onfail.html and render it
> >
>
> As I said earlier this is not so trivial.
> The failure may happen in the middle of the rendering and the content
> collected so far in RequestCycle#getResponse() could be invalid HTML.
> Appending anything (loaded from a file or generated on the fly) is not
> really a solution.
>
>
> >
> > On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> > > https://issues.apache.org/jira/browse/WICKET-4321
> > > this is the ticker I meant
> > > it suggests to restart the rendering completely for the whole page and
> > this
> > > is not enough
> > > I'll see what kind of changes would be needed to accomplish this.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <mgrigorov@apache.org
> >
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > There is no support for this, even in 7.x.
> > > > I remember Carl-Eric Menzel asking for the same functionality before
> > ...
> > > > Behavior#onException() sounds like something similar but there is no
> > way
> > > > to suppress the bubbling of the exception at the moment.
> > > > The bigger problem is that the rendering can fail in the middle, i.e.
> > the
> > > > component can have written some response already and then fail. If
> the
> > > > written response is proper HTML then it is OKish. But if some tag is
> > not
> > > > closed then the rendering of the complete page may fail.
> > > > So if we try to add this functionality we will have to use temporary
> > > > Response objects for the rendering of each component to be able to
> > throw
> > > > away whatever it has produced before failing.
> > > >
> > > > Usually the problem is related to the component's model. A workaround
> > for
> > > > you could be to use a wrapper Model that returns "empty data" when
> the
> > > > underlying model throws an exception.
> > > >
> > > > Martin Grigorov
> > > > Wicket Training and Consulting
> > > > https://twitter.com/mtgrigorov
> > > >
> > > > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo Barreiro <
> > > > reiern70@gmail.com> wrote:
> > > >
> > > >> Hi,
> > > >>
> > > >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
> > > >> tobias.gierke@voipfuture.com> wrote:
> > > >>
> > > >> > Hi,
> > > >> >
> > > >> >> Wouldn't it be possible to "embed"  the failing prone porlets
> > inside
> > > >> >> iframes so that each one is a Wicket page?
> > > >> >>
> > > >> > I already thought about this but the page uses quite a lot of
> fancy
> > > >> > CSS/Ajax/Javascript (portlets are rendered in a grid with
> > configurable
> > > >> > row/column count, drag'n'drop to move them around etc.) and I'd
> > rather
> > > >> not
> > > >> > touch the existing code if there's a Java-side only solution ;-)
> > > >> >
> > > >>
> > > >> I do not know of any :-(
> > > >>
> > > >> Another possibility is build each client entirely on JavaScript and
> > use
> > > >> Wicket just as a service layer... not very Wicket like but you would
> > not
> > > >> have this problem.
> > > >>
> > > >>
> > > >> >
> > > >> > Cheers,
> > > >> > Tobias
> > > >> >
> > > >> >
> > > >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> > > >> >> tobias.gierke@voipfuture.com> wrote:
> > > >> >>
> > > >> >>  Hi,
> > > >> >>>
> > > >> >>> In our web application we have a dashboard-like homepage that
> > > >> displays a
> > > >> >>> number of user-configurable 'portlets' (which are really just
> > > ordinary
> > > >> >>> Wicket components and have nothing to do with the Portlet spec).
> > I'm
> > > >> >>> looking for a way of preventing the application from becoming
> > > >> unusable in
> > > >> >>> case one or more of these portlets continuously fail to render
> > > >> because of
> > > >> >>> some internal error/bug.
> > > >> >>>
> > > >> >>> We're currently using a custom RequestCycleListener with the
> > > >> >>> onException()
> > > >> >>> method redirecting to a generic error page, thus when rendering
> > of a
> > > >> >>> 'portlet' fails the user will never get to see the homepage and
> > > always
> > > >> >>> end
> > > >> >>> up on the error page - which is obviously not really desirable.
> > > >> >>>
> > > >> >>> Is there a way to to hook into Wicket's rendering cycle so that
> I
> > > can
> > > >> >>> provide some default markup in case rendering of a component
> > > (subtree)
> > > >> >>> fails with a RuntimeException ?
> > > >> >>>
> > > >> >>> I understand that this maybe be very tricky since the component
> > > >> subtree
> > > >> >>> might've rendered partially and thus internal state will be
> > > >> inconsistent.
> > > >> >>> It would probably require serializing the initial state of the
> > > >> component
> > > >> >>> (subtree) before rendering starts and reverting the wholle
> subtree
> > > to
> > > >> its
> > > >> >>> initial state once a RuntimeException is thrown.
> > > >> >>>
> > > >> >>> We're running Wicket 1.5.12.
> > > >> >>>
> > > >> >>> Thanks in advance,
> > > >> >>> Tobias
> > > >> >>>
> > > >> >>> --
> > > >> >>> Tobias Gierke
> > > >> >>> Development
> > > >> >>>
> > > >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
> > > >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> > > >> >>> Email tobias.gierke@voipfuture.com   Web
> > http://www.voipfuture.com
> > > >> >>>   CEO Jan Bastian
> > > >> >>>
> > > >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
> > > >> >>>
> > > >> >>>
> > > >> >>>
> > > >> >>>
> > > ---------------------------------------------------------------------
> > > >> >>> 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
> > > >> >
> > > >> >
> > > >>
> > > >>
> > > >> --
> > > >> Regards - Ernesto Reinaldo Barreiro
> > > >>
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> >
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> @Martin,
>
> Just a (maybe stupid) idea:
>
> 1- Mark some component as ISafeFail
> 2- If rendering fails take Component_onfail.html and render it
>

As I said earlier this is not so trivial.
The failure may happen in the middle of the rendering and the content
collected so far in RequestCycle#getResponse() could be invalid HTML.
Appending anything (loaded from a file or generated on the fly) is not
really a solution.


>
> On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > https://issues.apache.org/jira/browse/WICKET-4321
> > this is the ticker I meant
> > it suggests to restart the rendering completely for the whole page and
> this
> > is not enough
> > I'll see what kind of changes would be needed to accomplish this.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> > > Hi,
> > >
> > > There is no support for this, even in 7.x.
> > > I remember Carl-Eric Menzel asking for the same functionality before
> ...
> > > Behavior#onException() sounds like something similar but there is no
> way
> > > to suppress the bubbling of the exception at the moment.
> > > The bigger problem is that the rendering can fail in the middle, i.e.
> the
> > > component can have written some response already and then fail. If the
> > > written response is proper HTML then it is OKish. But if some tag is
> not
> > > closed then the rendering of the complete page may fail.
> > > So if we try to add this functionality we will have to use temporary
> > > Response objects for the rendering of each component to be able to
> throw
> > > away whatever it has produced before failing.
> > >
> > > Usually the problem is related to the component's model. A workaround
> for
> > > you could be to use a wrapper Model that returns "empty data" when the
> > > underlying model throws an exception.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo Barreiro <
> > > reiern70@gmail.com> wrote:
> > >
> > >> Hi,
> > >>
> > >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
> > >> tobias.gierke@voipfuture.com> wrote:
> > >>
> > >> > Hi,
> > >> >
> > >> >> Wouldn't it be possible to "embed"  the failing prone porlets
> inside
> > >> >> iframes so that each one is a Wicket page?
> > >> >>
> > >> > I already thought about this but the page uses quite a lot of fancy
> > >> > CSS/Ajax/Javascript (portlets are rendered in a grid with
> configurable
> > >> > row/column count, drag'n'drop to move them around etc.) and I'd
> rather
> > >> not
> > >> > touch the existing code if there's a Java-side only solution ;-)
> > >> >
> > >>
> > >> I do not know of any :-(
> > >>
> > >> Another possibility is build each client entirely on JavaScript and
> use
> > >> Wicket just as a service layer... not very Wicket like but you would
> not
> > >> have this problem.
> > >>
> > >>
> > >> >
> > >> > Cheers,
> > >> > Tobias
> > >> >
> > >> >
> > >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> > >> >> tobias.gierke@voipfuture.com> wrote:
> > >> >>
> > >> >>  Hi,
> > >> >>>
> > >> >>> In our web application we have a dashboard-like homepage that
> > >> displays a
> > >> >>> number of user-configurable 'portlets' (which are really just
> > ordinary
> > >> >>> Wicket components and have nothing to do with the Portlet spec).
> I'm
> > >> >>> looking for a way of preventing the application from becoming
> > >> unusable in
> > >> >>> case one or more of these portlets continuously fail to render
> > >> because of
> > >> >>> some internal error/bug.
> > >> >>>
> > >> >>> We're currently using a custom RequestCycleListener with the
> > >> >>> onException()
> > >> >>> method redirecting to a generic error page, thus when rendering
> of a
> > >> >>> 'portlet' fails the user will never get to see the homepage and
> > always
> > >> >>> end
> > >> >>> up on the error page - which is obviously not really desirable.
> > >> >>>
> > >> >>> Is there a way to to hook into Wicket's rendering cycle so that I
> > can
> > >> >>> provide some default markup in case rendering of a component
> > (subtree)
> > >> >>> fails with a RuntimeException ?
> > >> >>>
> > >> >>> I understand that this maybe be very tricky since the component
> > >> subtree
> > >> >>> might've rendered partially and thus internal state will be
> > >> inconsistent.
> > >> >>> It would probably require serializing the initial state of the
> > >> component
> > >> >>> (subtree) before rendering starts and reverting the wholle subtree
> > to
> > >> its
> > >> >>> initial state once a RuntimeException is thrown.
> > >> >>>
> > >> >>> We're running Wicket 1.5.12.
> > >> >>>
> > >> >>> Thanks in advance,
> > >> >>> Tobias
> > >> >>>
> > >> >>> --
> > >> >>> Tobias Gierke
> > >> >>> Development
> > >> >>>
> > >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
> > >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> > >> >>> Email tobias.gierke@voipfuture.com   Web
> http://www.voipfuture.com
> > >> >>>   CEO Jan Bastian
> > >> >>>
> > >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
> > >> >>>
> > >> >>>
> > >> >>>
> > >> >>>
> > ---------------------------------------------------------------------
> > >> >>> 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
> > >> >
> > >> >
> > >>
> > >>
> > >> --
> > >> Regards - Ernesto Reinaldo Barreiro
> > >>
> > >
> > >
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
@Martin,

Just a (maybe stupid) idea:

1- Mark some component as ISafeFail
2- If rendering fails take Component_onfail.html and render it

On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <mg...@apache.org>
wrote:

> https://issues.apache.org/jira/browse/WICKET-4321
> this is the ticker I meant
> it suggests to restart the rendering completely for the whole page and this
> is not enough
> I'll see what kind of changes would be needed to accomplish this.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi,
> >
> > There is no support for this, even in 7.x.
> > I remember Carl-Eric Menzel asking for the same functionality before ...
> > Behavior#onException() sounds like something similar but there is no way
> > to suppress the bubbling of the exception at the moment.
> > The bigger problem is that the rendering can fail in the middle, i.e. the
> > component can have written some response already and then fail. If the
> > written response is proper HTML then it is OKish. But if some tag is not
> > closed then the rendering of the complete page may fail.
> > So if we try to add this functionality we will have to use temporary
> > Response objects for the rendering of each component to be able to throw
> > away whatever it has produced before failing.
> >
> > Usually the problem is related to the component's model. A workaround for
> > you could be to use a wrapper Model that returns "empty data" when the
> > underlying model throws an exception.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo Barreiro <
> > reiern70@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
> >> tobias.gierke@voipfuture.com> wrote:
> >>
> >> > Hi,
> >> >
> >> >> Wouldn't it be possible to "embed"  the failing prone porlets inside
> >> >> iframes so that each one is a Wicket page?
> >> >>
> >> > I already thought about this but the page uses quite a lot of fancy
> >> > CSS/Ajax/Javascript (portlets are rendered in a grid with configurable
> >> > row/column count, drag'n'drop to move them around etc.) and I'd rather
> >> not
> >> > touch the existing code if there's a Java-side only solution ;-)
> >> >
> >>
> >> I do not know of any :-(
> >>
> >> Another possibility is build each client entirely on JavaScript and use
> >> Wicket just as a service layer... not very Wicket like but you would not
> >> have this problem.
> >>
> >>
> >> >
> >> > Cheers,
> >> > Tobias
> >> >
> >> >
> >> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> >> >> tobias.gierke@voipfuture.com> wrote:
> >> >>
> >> >>  Hi,
> >> >>>
> >> >>> In our web application we have a dashboard-like homepage that
> >> displays a
> >> >>> number of user-configurable 'portlets' (which are really just
> ordinary
> >> >>> Wicket components and have nothing to do with the Portlet spec). I'm
> >> >>> looking for a way of preventing the application from becoming
> >> unusable in
> >> >>> case one or more of these portlets continuously fail to render
> >> because of
> >> >>> some internal error/bug.
> >> >>>
> >> >>> We're currently using a custom RequestCycleListener with the
> >> >>> onException()
> >> >>> method redirecting to a generic error page, thus when rendering of a
> >> >>> 'portlet' fails the user will never get to see the homepage and
> always
> >> >>> end
> >> >>> up on the error page - which is obviously not really desirable.
> >> >>>
> >> >>> Is there a way to to hook into Wicket's rendering cycle so that I
> can
> >> >>> provide some default markup in case rendering of a component
> (subtree)
> >> >>> fails with a RuntimeException ?
> >> >>>
> >> >>> I understand that this maybe be very tricky since the component
> >> subtree
> >> >>> might've rendered partially and thus internal state will be
> >> inconsistent.
> >> >>> It would probably require serializing the initial state of the
> >> component
> >> >>> (subtree) before rendering starts and reverting the wholle subtree
> to
> >> its
> >> >>> initial state once a RuntimeException is thrown.
> >> >>>
> >> >>> We're running Wicket 1.5.12.
> >> >>>
> >> >>> Thanks in advance,
> >> >>> Tobias
> >> >>>
> >> >>> --
> >> >>> Tobias Gierke
> >> >>> Development
> >> >>>
> >> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
> >> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> >> >>> Email tobias.gierke@voipfuture.com   Web http://www.voipfuture.com
> >> >>>   CEO Jan Bastian
> >> >>>
> >> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
> >> >>>
> >> >>>
> >> >>>
> >> >>>
> ---------------------------------------------------------------------
> >> >>> 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
> >> >
> >> >
> >>
> >>
> >> --
> >> Regards - Ernesto Reinaldo Barreiro
> >>
> >
> >
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Martin Grigorov <mg...@apache.org>.
https://issues.apache.org/jira/browse/WICKET-4321
this is the ticker I meant
it suggests to restart the rendering completely for the whole page and this
is not enough
I'll see what kind of changes would be needed to accomplish this.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <mg...@apache.org>
wrote:

> Hi,
>
> There is no support for this, even in 7.x.
> I remember Carl-Eric Menzel asking for the same functionality before ...
> Behavior#onException() sounds like something similar but there is no way
> to suppress the bubbling of the exception at the moment.
> The bigger problem is that the rendering can fail in the middle, i.e. the
> component can have written some response already and then fail. If the
> written response is proper HTML then it is OKish. But if some tag is not
> closed then the rendering of the complete page may fail.
> So if we try to add this functionality we will have to use temporary
> Response objects for the rendering of each component to be able to throw
> away whatever it has produced before failing.
>
> Usually the problem is related to the component's model. A workaround for
> you could be to use a wrapper Model that returns "empty data" when the
> underlying model throws an exception.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
>> Hi,
>>
>> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
>> tobias.gierke@voipfuture.com> wrote:
>>
>> > Hi,
>> >
>> >> Wouldn't it be possible to "embed"  the failing prone porlets inside
>> >> iframes so that each one is a Wicket page?
>> >>
>> > I already thought about this but the page uses quite a lot of fancy
>> > CSS/Ajax/Javascript (portlets are rendered in a grid with configurable
>> > row/column count, drag'n'drop to move them around etc.) and I'd rather
>> not
>> > touch the existing code if there's a Java-side only solution ;-)
>> >
>>
>> I do not know of any :-(
>>
>> Another possibility is build each client entirely on JavaScript and use
>> Wicket just as a service layer... not very Wicket like but you would not
>> have this problem.
>>
>>
>> >
>> > Cheers,
>> > Tobias
>> >
>> >
>> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
>> >> tobias.gierke@voipfuture.com> wrote:
>> >>
>> >>  Hi,
>> >>>
>> >>> In our web application we have a dashboard-like homepage that
>> displays a
>> >>> number of user-configurable 'portlets' (which are really just ordinary
>> >>> Wicket components and have nothing to do with the Portlet spec). I'm
>> >>> looking for a way of preventing the application from becoming
>> unusable in
>> >>> case one or more of these portlets continuously fail to render
>> because of
>> >>> some internal error/bug.
>> >>>
>> >>> We're currently using a custom RequestCycleListener with the
>> >>> onException()
>> >>> method redirecting to a generic error page, thus when rendering of a
>> >>> 'portlet' fails the user will never get to see the homepage and always
>> >>> end
>> >>> up on the error page - which is obviously not really desirable.
>> >>>
>> >>> Is there a way to to hook into Wicket's rendering cycle so that I can
>> >>> provide some default markup in case rendering of a component (subtree)
>> >>> fails with a RuntimeException ?
>> >>>
>> >>> I understand that this maybe be very tricky since the component
>> subtree
>> >>> might've rendered partially and thus internal state will be
>> inconsistent.
>> >>> It would probably require serializing the initial state of the
>> component
>> >>> (subtree) before rendering starts and reverting the wholle subtree to
>> its
>> >>> initial state once a RuntimeException is thrown.
>> >>>
>> >>> We're running Wicket 1.5.12.
>> >>>
>> >>> Thanks in advance,
>> >>> Tobias
>> >>>
>> >>> --
>> >>> Tobias Gierke
>> >>> Development
>> >>>
>> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
>> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
>> >>> Email tobias.gierke@voipfuture.com   Web http://www.voipfuture.com
>> >>>   CEO Jan Bastian
>> >>>
>> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
>> >>>
>> >>>
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> 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
>> >
>> >
>>
>>
>> --
>> Regards - Ernesto Reinaldo Barreiro
>>
>
>

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

There is no support for this, even in 7.x.
I remember Carl-Eric Menzel asking for the same functionality before ...
Behavior#onException() sounds like something similar but there is no way to
suppress the bubbling of the exception at the moment.
The bigger problem is that the rendering can fail in the middle, i.e. the
component can have written some response already and then fail. If the
written response is proper HTML then it is OKish. But if some tag is not
closed then the rendering of the complete page may fail.
So if we try to add this functionality we will have to use temporary
Response objects for the rendering of each component to be able to throw
away whatever it has produced before failing.

Usually the problem is related to the component's model. A workaround for
you could be to use a wrapper Model that returns "empty data" when the
underlying model throws an exception.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Hi,
>
> On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
> tobias.gierke@voipfuture.com> wrote:
>
> > Hi,
> >
> >> Wouldn't it be possible to "embed"  the failing prone porlets inside
> >> iframes so that each one is a Wicket page?
> >>
> > I already thought about this but the page uses quite a lot of fancy
> > CSS/Ajax/Javascript (portlets are rendered in a grid with configurable
> > row/column count, drag'n'drop to move them around etc.) and I'd rather
> not
> > touch the existing code if there's a Java-side only solution ;-)
> >
>
> I do not know of any :-(
>
> Another possibility is build each client entirely on JavaScript and use
> Wicket just as a service layer... not very Wicket like but you would not
> have this problem.
>
>
> >
> > Cheers,
> > Tobias
> >
> >
> >> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> >> tobias.gierke@voipfuture.com> wrote:
> >>
> >>  Hi,
> >>>
> >>> In our web application we have a dashboard-like homepage that displays
> a
> >>> number of user-configurable 'portlets' (which are really just ordinary
> >>> Wicket components and have nothing to do with the Portlet spec). I'm
> >>> looking for a way of preventing the application from becoming unusable
> in
> >>> case one or more of these portlets continuously fail to render because
> of
> >>> some internal error/bug.
> >>>
> >>> We're currently using a custom RequestCycleListener with the
> >>> onException()
> >>> method redirecting to a generic error page, thus when rendering of a
> >>> 'portlet' fails the user will never get to see the homepage and always
> >>> end
> >>> up on the error page - which is obviously not really desirable.
> >>>
> >>> Is there a way to to hook into Wicket's rendering cycle so that I can
> >>> provide some default markup in case rendering of a component (subtree)
> >>> fails with a RuntimeException ?
> >>>
> >>> I understand that this maybe be very tricky since the component subtree
> >>> might've rendered partially and thus internal state will be
> inconsistent.
> >>> It would probably require serializing the initial state of the
> component
> >>> (subtree) before rendering starts and reverting the wholle subtree to
> its
> >>> initial state once a RuntimeException is thrown.
> >>>
> >>> We're running Wicket 1.5.12.
> >>>
> >>> Thanks in advance,
> >>> Tobias
> >>>
> >>> --
> >>> Tobias Gierke
> >>> Development
> >>>
> >>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
> >>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> >>> Email tobias.gierke@voipfuture.com   Web http://www.voipfuture.com
> >>>   CEO Jan Bastian
> >>>
> >>> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
> >>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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
> >
> >
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,

On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
tobias.gierke@voipfuture.com> wrote:

> Hi,
>
>> Wouldn't it be possible to "embed"  the failing prone porlets inside
>> iframes so that each one is a Wicket page?
>>
> I already thought about this but the page uses quite a lot of fancy
> CSS/Ajax/Javascript (portlets are rendered in a grid with configurable
> row/column count, drag'n'drop to move them around etc.) and I'd rather not
> touch the existing code if there's a Java-side only solution ;-)
>

I do not know of any :-(

Another possibility is build each client entirely on JavaScript and use
Wicket just as a service layer... not very Wicket like but you would not
have this problem.


>
> Cheers,
> Tobias
>
>
>> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
>> tobias.gierke@voipfuture.com> wrote:
>>
>>  Hi,
>>>
>>> In our web application we have a dashboard-like homepage that displays a
>>> number of user-configurable 'portlets' (which are really just ordinary
>>> Wicket components and have nothing to do with the Portlet spec). I'm
>>> looking for a way of preventing the application from becoming unusable in
>>> case one or more of these portlets continuously fail to render because of
>>> some internal error/bug.
>>>
>>> We're currently using a custom RequestCycleListener with the
>>> onException()
>>> method redirecting to a generic error page, thus when rendering of a
>>> 'portlet' fails the user will never get to see the homepage and always
>>> end
>>> up on the error page - which is obviously not really desirable.
>>>
>>> Is there a way to to hook into Wicket's rendering cycle so that I can
>>> provide some default markup in case rendering of a component (subtree)
>>> fails with a RuntimeException ?
>>>
>>> I understand that this maybe be very tricky since the component subtree
>>> might've rendered partially and thus internal state will be inconsistent.
>>> It would probably require serializing the initial state of the component
>>> (subtree) before rendering starts and reverting the wholle subtree to its
>>> initial state once a RuntimeException is thrown.
>>>
>>> We're running Wicket 1.5.12.
>>>
>>> Thanks in advance,
>>> Tobias
>>>
>>> --
>>> Tobias Gierke
>>> Development
>>>
>>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
>>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
>>> Email tobias.gierke@voipfuture.com   Web http://www.voipfuture.com
>>>   CEO Jan Bastian
>>>
>>> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Tobias Gierke <to...@voipfuture.com>.
Hi,
> Wouldn't it be possible to "embed"  the failing prone porlets inside
> iframes so that each one is a Wicket page?
I already thought about this but the page uses quite a lot of fancy 
CSS/Ajax/Javascript (portlets are rendered in a grid with configurable 
row/column count, drag'n'drop to move them around etc.) and I'd rather 
not touch the existing code if there's a Java-side only solution ;-)

Cheers,
Tobias
>
> On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
> tobias.gierke@voipfuture.com> wrote:
>
>> Hi,
>>
>> In our web application we have a dashboard-like homepage that displays a
>> number of user-configurable 'portlets' (which are really just ordinary
>> Wicket components and have nothing to do with the Portlet spec). I'm
>> looking for a way of preventing the application from becoming unusable in
>> case one or more of these portlets continuously fail to render because of
>> some internal error/bug.
>>
>> We're currently using a custom RequestCycleListener with the onException()
>> method redirecting to a generic error page, thus when rendering of a
>> 'portlet' fails the user will never get to see the homepage and always end
>> up on the error page - which is obviously not really desirable.
>>
>> Is there a way to to hook into Wicket's rendering cycle so that I can
>> provide some default markup in case rendering of a component (subtree)
>> fails with a RuntimeException ?
>>
>> I understand that this maybe be very tricky since the component subtree
>> might've rendered partially and thus internal state will be inconsistent.
>> It would probably require serializing the initial state of the component
>> (subtree) before rendering starts and reverting the wholle subtree to its
>> initial state once a RuntimeException is thrown.
>>
>> We're running Wicket 1.5.12.
>>
>> Thanks in advance,
>> Tobias
>>
>> --
>> Tobias Gierke
>> Development
>>
>> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
>> Phone +49 40 688 900 164 Fax +49 40 688 900 199
>> Email tobias.gierke@voipfuture.com   Web http://www.voipfuture.com
>>   CEO Jan Bastian
>>
>> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Wouldn't it be possible to "embed"  the failing prone porlets inside
iframes so that each one is a Wicket page?

On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
tobias.gierke@voipfuture.com> wrote:

> Hi,
>
> In our web application we have a dashboard-like homepage that displays a
> number of user-configurable 'portlets' (which are really just ordinary
> Wicket components and have nothing to do with the Portlet spec). I'm
> looking for a way of preventing the application from becoming unusable in
> case one or more of these portlets continuously fail to render because of
> some internal error/bug.
>
> We're currently using a custom RequestCycleListener with the onException()
> method redirecting to a generic error page, thus when rendering of a
> 'portlet' fails the user will never get to see the homepage and always end
> up on the error page - which is obviously not really desirable.
>
> Is there a way to to hook into Wicket's rendering cycle so that I can
> provide some default markup in case rendering of a component (subtree)
> fails with a RuntimeException ?
>
> I understand that this maybe be very tricky since the component subtree
> might've rendered partially and thus internal state will be inconsistent.
> It would probably require serializing the initial state of the component
> (subtree) before rendering starts and reverting the wholle subtree to its
> initial state once a RuntimeException is thrown.
>
> We're running Wicket 1.5.12.
>
> Thanks in advance,
> Tobias
>
> --
> Tobias Gierke
> Development
>
> VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
> Phone +49 40 688 900 164 Fax +49 40 688 900 199
> Email tobias.gierke@voipfuture.com   Web http://www.voipfuture.com
>  CEO Jan Bastian
>
> Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro