You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Adam Winer <aw...@gmail.com> on 2007/05/21 18:34:29 UTC

Re: How to override ResponseWriter

It'd help if you told us what you were trying to do,
as there's more than one possible answer.

-- Adam


On 5/21/07, mario.buonopane@accenture.com <ma...@accenture.com> wrote:
>
>
>
>
> Hi, is there a way to override the default ResponseWriter? How can I
> configure it?
>
>
>
> Thanks in advance
>
> Mario Buonopane
>
>
>
>
>
>
>
>
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the email by you is prohibited.

RE: How to override ResponseWriter

Posted by ma...@accenture.com.
Ok, I'll do it! 

Thanks
Mario 

-----Original Message-----
From: Adam Winer [mailto:awiner@gmail.com] 
Sent: 22 maggio 2007 14.58
To: MyFaces Discussion
Subject: Re: How to override ResponseWriter

Create a component.
Place it around everything else in the tree.
In your component's encodeBegin(), write:

  ResponseWriter oldWriter = context.getResponseWriter();
  // You almost always want to at least partially delegate
  ResponseWriter myWriter = new MyWriter(oldWriter);
  context.setResponseWriter(myWriter);

and in encodeEnd():

  MyWriter writer = (MyWriter) context.getResponseWriter();
  context.setResponseWriter(writer.getOldResponseWriter());

-- Adam





On 5/22/07, mario.buonopane@accenture.com
<ma...@accenture.com> wrote:
>
>
>
>
> Adam sorry for my response vague....
>
> What I need is that the method getResponseWriter of FacesContext
return a my
> implementation of ResponseWriter.
>
>
>
> I there any way to configure my implementation of ResponseWriter?
>
>
>
> Thanks in advance
>
> Mario
>
>
>
>  ________________________________
>
>
> From: Adam Winer [mailto:awiner@gmail.com]
>  Sent: 22 maggio 2007 00.40
>
>  To: MyFaces Discussion
>  Subject: Re: How to override ResponseWriter
>
>
>
>
> That's awfully vague... At any rate, I'd consider inserting
>  a custom component inside f:view but as a parent of everything
>  else, and making that custom component install a decorating
>  ResponseWriter.  If you're using a Facelets template for your
>  pages, that's easy enough.
>
>  -- Adam
>
>
>
>
> On 5/21/07, mario.buonopane@accenture.com <
mario.buonopane@accenture.com>
> wrote:
>
> I need to execute some code for all html renderers before default
>  startElement.
>
>  -----Original Message-----
>  From: Adam Winer [mailto:awiner@gmail.com]
>  Sent: 21 maggio 2007 18.34
>  To: MyFaces Discussion
>  Subject: Re: How to override ResponseWriter
>
>  It'd help if you told us what you were trying to do,
>  as there's more than one possible answer.
>
>  -- Adam
>
>
>  On 5/21/07, mario.buonopane@accenture.com
>  <ma...@accenture.com> wrote:
>  >
>  >
>  >
>  >
>  > Hi, is there a way to override the default ResponseWriter? How can
I
>  > configure it?
>  >
>  >
>  >
>  > Thanks in advance
>  >
>  > Mario Buonopane
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  > This message is for the designated recipient only and may contain
>  > privileged, proprietary, or otherwise private information. If you
have
>  > received it in error, please notify the sender immediately and
delete
>  the
>  > original. Any other use of the email by you is prohibited.
>
>
>  This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information.  If you
have
> received it in error, please notify the sender immediately and delete
the
> original.  Any other use of the email by you is prohibited.
>
>
>
>
>
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information. If you have
> received it in error, please notify the sender immediately and delete
the
> original. Any other use of the email by you is prohibited.


This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.

Re: How to override ResponseWriter

Posted by Adam Winer <aw...@gmail.com>.
Create a component.
Place it around everything else in the tree.
In your component's encodeBegin(), write:

  ResponseWriter oldWriter = context.getResponseWriter();
  // You almost always want to at least partially delegate
  ResponseWriter myWriter = new MyWriter(oldWriter);
  context.setResponseWriter(myWriter);

and in encodeEnd():

  MyWriter writer = (MyWriter) context.getResponseWriter();
  context.setResponseWriter(writer.getOldResponseWriter());

-- Adam





On 5/22/07, mario.buonopane@accenture.com <ma...@accenture.com> wrote:
>
>
>
>
> Adam sorry for my response vague….
>
> What I need is that the method getResponseWriter of FacesContext return a my
> implementation of ResponseWriter.
>
>
>
> I there any way to configure my implementation of ResponseWriter?
>
>
>
> Thanks in advance
>
> Mario
>
>
>
>  ________________________________
>
>
> From: Adam Winer [mailto:awiner@gmail.com]
>  Sent: 22 maggio 2007 00.40
>
>  To: MyFaces Discussion
>  Subject: Re: How to override ResponseWriter
>
>
>
>
> That's awfully vague... At any rate, I'd consider inserting
>  a custom component inside f:view but as a parent of everything
>  else, and making that custom component install a decorating
>  ResponseWriter.  If you're using a Facelets template for your
>  pages, that's easy enough.
>
>  -- Adam
>
>
>
>
> On 5/21/07, mario.buonopane@accenture.com < mario.buonopane@accenture.com>
> wrote:
>
> I need to execute some code for all html renderers before default
>  startElement.
>
>  -----Original Message-----
>  From: Adam Winer [mailto:awiner@gmail.com]
>  Sent: 21 maggio 2007 18.34
>  To: MyFaces Discussion
>  Subject: Re: How to override ResponseWriter
>
>  It'd help if you told us what you were trying to do,
>  as there's more than one possible answer.
>
>  -- Adam
>
>
>  On 5/21/07, mario.buonopane@accenture.com
>  <ma...@accenture.com> wrote:
>  >
>  >
>  >
>  >
>  > Hi, is there a way to override the default ResponseWriter? How can I
>  > configure it?
>  >
>  >
>  >
>  > Thanks in advance
>  >
>  > Mario Buonopane
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  > This message is for the designated recipient only and may contain
>  > privileged, proprietary, or otherwise private information. If you have
>  > received it in error, please notify the sender immediately and delete
>  the
>  > original. Any other use of the email by you is prohibited.
>
>
>  This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information.  If you have
> received it in error, please notify the sender immediately and delete the
> original.  Any other use of the email by you is prohibited.
>
>
>
>
>
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the email by you is prohibited.

RE: How to override ResponseWriter

Posted by ma...@accenture.com.
Adam sorry for my response vague....

What I need is that the method getResponseWriter of FacesContext return
a my implementation of ResponseWriter.

 

I there any way to configure my implementation of ResponseWriter?

 

Thanks in advance

Mario 

 

________________________________

From: Adam Winer [mailto:awiner@gmail.com] 
Sent: 22 maggio 2007 00.40
To: MyFaces Discussion
Subject: Re: How to override ResponseWriter

 

That's awfully vague... At any rate, I'd consider inserting
a custom component inside f:view but as a parent of everything
else, and making that custom component install a decorating
ResponseWriter.  If you're using a Facelets template for your 
pages, that's easy enough.

-- Adam



On 5/21/07, mario.buonopane@accenture.com <
mario.buonopane@accenture.com> wrote:

I need to execute some code for all html renderers before default
startElement.

-----Original Message-----
From: Adam Winer [mailto:awiner@gmail.com]
Sent: 21 maggio 2007 18.34
To: MyFaces Discussion
Subject: Re: How to override ResponseWriter

It'd help if you told us what you were trying to do,
as there's more than one possible answer.

-- Adam


On 5/21/07, mario.buonopane@accenture.com
<ma...@accenture.com> wrote:
>
>
>
>
> Hi, is there a way to override the default ResponseWriter? How can I 
> configure it?
>
>
>
> Thanks in advance
>
> Mario Buonopane
>
>
>
>
>
>
>
>
>
>
> This message is for the designated recipient only and may contain 
> privileged, proprietary, or otherwise private information. If you have
> received it in error, please notify the sender immediately and delete
the
> original. Any other use of the email by you is prohibited. 


This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information.  If you have
received it in error, please notify the sender immediately and delete
the original.  Any other use of the email by you is prohibited. 

 



This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.

Re: How to override ResponseWriter

Posted by Adam Winer <aw...@gmail.com>.
That's awfully vague... At any rate, I'd consider inserting
a custom component inside f:view but as a parent of everything
else, and making that custom component install a decorating
ResponseWriter.  If you're using a Facelets template for your
pages, that's easy enough.

-- Adam


On 5/21/07, mario.buonopane@accenture.com <ma...@accenture.com>
wrote:
>
> I need to execute some code for all html renderers before default
> startElement.
>
> -----Original Message-----
> From: Adam Winer [mailto:awiner@gmail.com]
> Sent: 21 maggio 2007 18.34
> To: MyFaces Discussion
> Subject: Re: How to override ResponseWriter
>
> It'd help if you told us what you were trying to do,
> as there's more than one possible answer.
>
> -- Adam
>
>
> On 5/21/07, mario.buonopane@accenture.com
> <ma...@accenture.com> wrote:
> >
> >
> >
> >
> > Hi, is there a way to override the default ResponseWriter? How can I
> > configure it?
> >
> >
> >
> > Thanks in advance
> >
> > Mario Buonopane
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > This message is for the designated recipient only and may contain
> > privileged, proprietary, or otherwise private information. If you have
> > received it in error, please notify the sender immediately and delete
> the
> > original. Any other use of the email by you is prohibited.
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information.  If you have
> received it in error, please notify the sender immediately and delete the
> original.  Any other use of the email by you is prohibited.
>

RE: How to override ResponseWriter

Posted by ma...@accenture.com.
I need to execute some code for all html renderers before default
startElement. 

-----Original Message-----
From: Adam Winer [mailto:awiner@gmail.com] 
Sent: 21 maggio 2007 18.34
To: MyFaces Discussion
Subject: Re: How to override ResponseWriter

It'd help if you told us what you were trying to do,
as there's more than one possible answer.

-- Adam


On 5/21/07, mario.buonopane@accenture.com
<ma...@accenture.com> wrote:
>
>
>
>
> Hi, is there a way to override the default ResponseWriter? How can I
> configure it?
>
>
>
> Thanks in advance
>
> Mario Buonopane
>
>
>
>
>
>
>
>
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information. If you have
> received it in error, please notify the sender immediately and delete
the
> original. Any other use of the email by you is prohibited.


This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.