myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Robinson" <andrew.rw.robin...@gmail.com>
Subject Re: Custom UIViewRoot
Date Sun, 16 Sep 2007 15:52:40 GMT
FYI, if that doesn't work, you can customize the ViewHandler and set
it there using the method:

public abstract void renderView(javax.faces.context.FacesContext
context, javax.faces.component.UIViewRoot viewToRender)



On 9/16/07, Andrew Robinson <andrew.rw.robinson@gmail.com> wrote:
> I haven't actually tried it, but I think the easiest way would be to
> have a PhaseListener set it in the before render phase. There are
> wrappers on the ResponseWriter you can use to decorate the existing
> one (see ResponseWriterWrapper in shared_tomahawk).
>
> It is as simple as FacesContext.getCurrentInstance().setResponseWriter(obj);
>
> On 9/16/07, Manfred K. <aidev@chello.at> wrote:
> >
> > Andrew, thanks for your hint!
> >
> > How can I register a custom responsewriter (in faces-config.xml)? I cannot
> > create a custom component, place it around all other jsf tags in the pages
> > and use the new responsewriter in the encodebegin method. Unfortunately it's
> > not possible to modify the existing pages for this requirement.
> >
> >
> >
> > Andrew Robinson-5 wrote:
> > >
> > > You could replace the responsewriter and have full control over the output
> > >
> > > On 9/15/07, Manfred K. <aidev@chello.at> wrote:
> > >>
> > >> Thank you for your reply!
> > >>
> > >> We are using myfaces (1.1.5).
> > >> I just had a look at the standard ViewHandler implementation, but I don't
> > >> think that this is the right place for our needs. We have to modify the
> > >> generated html output of the UIViewRoot (e.g. remove html, head, body
> > >> tags
> > >> if present, add javascript code and log the modified html code). How can
> > >> we
> > >> achieve this (what is the right place for this functionallity and how can
> > >> we
> > >> access the generated html markup)?
> > >>
> > >> Thanks!
> > >>
> > >>
> > >>
> > >> Volker Weber-5 wrote:
> > >> >
> > >> > Hi,
> > >> >
> > >> > Did you use RI or myfaces? RI 1.1 did not support replacing the
> > >> > UIViewRoot component. Than you need to replace the ViewHandler like
we
> > >> > did in tobago.
> > >> >
> > >> >
> > >> > Regards,
> > >> >     Volker
> > >> >
> > >> >
> > >> >
> > >> >
> > >> > 2007/9/15, Manfred K. <aidev@chello.at>:
> > >> >>
> > >> >> Hi all,
> > >> >>
> > >> >> I implemented a custom UIViewRoot because I need to override the
> > >> >> encodeBegin
> > >> >> and encodeEnd methods. Unfortunately my methods never get called!?
> > >> >>
> > >> >> I declared my UIViewRoot class in faces-config as new component:
> > >> >>
> > >> >> <component>
> > >> >>   <component-type>javax.faces.ViewRoot</component-type>
> > >> >>   <component-class>test.TestUIViewRoot</component-class>
> > >> >> </component>
> > >> >>
> > >> >> The class:
> > >> >>
> > >> >> public class TestUIViewRoot extends UIViewRoot {
> > >> >>         public TestUIViewRoot() {
> > >> >>                 super();
> > >> >>         }
> > >> >>
> > >> >>         public void encodeBegin(FacesContext context) throws
> > >> IOException
> > >> >> {
> > >> >>                 //do some stuff
> > >> >>                 super.encodeBegin(context);
> > >> >>         }
> > >> >>
> > >> >>         public void encodeEnd(FacesContext context) throws IOException
> > >> {
> > >> >>                 //do some stuff
> > >> >>                 super.encodeEnd(context);
> > >> >>         }
> > >> >> ...
> > >> >> }
> > >> >>
> > >> >> What I'm doing wrong?
> > >> >>
> > >> >> THANX!
> > >> >> --
> > >> >> View this message in context:
> > >> >> http://www.nabble.com/Custom-UIViewRoot-tf4447158.html#a12688634
> > >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> > >> >>
> > >> >>
> > >> >
> > >> >
> > >>
> > >> --
> > >> View this message in context:
> > >> http://www.nabble.com/Custom-UIViewRoot-tf4447158.html#a12694553
> > >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> > >>
> > >>
> > >
> > >
> >
> > --
> > View this message in context: http://www.nabble.com/Custom-UIViewRoot-tf4447158.html#a12698560
> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >
> >
>

Mime
View raw message