Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-15 Thread Yuan Gao

 Thanks for the comment. Yes. The caller will call responseComplete().

Thanks,
-Yuan

On 3/14/2011 4:09 PM, Scott O'Bryan wrote:

So the caller would do the responseComplete after rendering the noop,
right?  If so, that looks MUCH better to me..  +1

On Mar 14, 2011, at 5:06 PM, Yuan Gaoyuan@oracle.com  wrote:


hi,

I agree that we are trying to do too much in a method. Also talked with Blake 
about it. How about we leave the script and redirect to the caller, in this 
method we only do the noop writing? We don't do the complete response either. 
How do you like this then?

  /**
   * This method writes anoop/  to the response.
   *
   * @param context the FacesContext
   * @throws IOException
   */
  public static void renderNoopResponse(FacesContext context)   throws 
IOException

Thanks,
-Yuan

On 3/14/2011 7:17 AM, Scott O'Bryan wrote:

Yes, I agree Andy.  That proposed API scared me a bit because it
seemed that we were trying to do to much in a single method call.
There was a redirect message, a script and noop params.  If we can
separate them and use the real redirect functionality built into the
EC, I'm good.  :D

On Mar 14, 2011, at 7:50 AM, Andy Schwartzandy.g.schwa...@gmail.com   wrote:


Hi Yuan -

On Mon, Mar 14, 2011 at 3:10 AM, Yuan Gaoyuan@oracle.com   wrote:

I like your comments. As for the names, how about
renderNoopAndCompleteResponse()?

That's definitely the clearest of the names that we have discussed. :-)

If we go with render, I can see three options:

1.  renderNoopAndCompleteResponse()
2.  renderNoopResponse()
3.  renderNoop()

I prefer the more concise forms (#2 or #3), though I think this mostly
comes down to personal taste.  Any of these are fine by me.

I am curious about some of the questions that Scott raised, eg:

- Should we consider just having FacesContext.responseComplete()
detect the empty response and automatically send a noop response?
(Interesting idea, though I am worried that  this might be just a bit
too much magic.  Think I like the idea of having an explicit API to
call.)

- Do we need a new method for the redirect case?  (Seems like this is
sufficiently covered by ExternalContext.redirect()).

Andy


Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-14 Thread Yuan Gao

 hi, Andy,

I like your comments. As for the names, how about 
renderNoopAndCompleteResponse()?


Thanks,
-Yuan

On 3/13/2011 7:48 AM, Andy Schwartz wrote:

Hi Bernd -

I am a bit hesitant about the names as well.  Three possible options:

1. completeNoopResponse()/completeScriptResponse()/completeRedirectResponse().
2. renderNoopResponse()/renderScriptResponse()/renderRedirectResponse().
3. sendNoopResponse()/sendScriptResponse()/sendRedirectResponse().

Think #2 and #3 read better than #1.  If we go with #2 or #3 we would
make it clear that these complete the response by documenting that
FaceContext.responseComplete() is called.

Andy


Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-14 Thread Andy Schwartz
Hi Yuan -

On Mon, Mar 14, 2011 at 3:10 AM, Yuan Gao yuan@oracle.com wrote:
 I like your comments. As for the names, how about
 renderNoopAndCompleteResponse()?

That's definitely the clearest of the names that we have discussed. :-)

If we go with render, I can see three options:

1.  renderNoopAndCompleteResponse()
2.  renderNoopResponse()
3.  renderNoop()

I prefer the more concise forms (#2 or #3), though I think this mostly
comes down to personal taste.  Any of these are fine by me.

I am curious about some of the questions that Scott raised, eg:

- Should we consider just having FacesContext.responseComplete()
detect the empty response and automatically send a noop response?
(Interesting idea, though I am worried that  this might be just a bit
too much magic.  Think I like the idea of having an explicit API to
call.)

- Do we need a new method for the redirect case?  (Seems like this is
sufficiently covered by ExternalContext.redirect()).

Andy


Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-14 Thread Scott O'Bryan
Yes, I agree Andy.  That proposed API scared me a bit because it
seemed that we were trying to do to much in a single method call.
There was a redirect message, a script and noop params.  If we can
separate them and use the real redirect functionality built into the
EC, I'm good.  :D

On Mar 14, 2011, at 7:50 AM, Andy Schwartz andy.g.schwa...@gmail.com wrote:

 Hi Yuan -

 On Mon, Mar 14, 2011 at 3:10 AM, Yuan Gao yuan@oracle.com wrote:
 I like your comments. As for the names, how about
 renderNoopAndCompleteResponse()?

 That's definitely the clearest of the names that we have discussed. :-)

 If we go with render, I can see three options:

 1.  renderNoopAndCompleteResponse()
 2.  renderNoopResponse()
 3.  renderNoop()

 I prefer the more concise forms (#2 or #3), though I think this mostly
 comes down to personal taste.  Any of these are fine by me.

 I am curious about some of the questions that Scott raised, eg:

 - Should we consider just having FacesContext.responseComplete()
 detect the empty response and automatically send a noop response?
 (Interesting idea, though I am worried that  this might be just a bit
 too much magic.  Think I like the idea of having an explicit API to
 call.)

 - Do we need a new method for the redirect case?  (Seems like this is
 sufficiently covered by ExternalContext.redirect()).

 Andy


Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-14 Thread Yuan Gao

 hi,

I agree that we are trying to do too much in a method. Also talked with 
Blake about it. How about we leave the script and redirect to the 
caller, in this method we only do the noop writing? We don't do the 
complete response either. How do you like this then?


  /**
   * This method writes a noop/ to the response.
   *
   * @param context the FacesContext
   * @throws IOException
   */
  public static void renderNoopResponse(FacesContext context)   throws 
IOException


Thanks,
-Yuan

On 3/14/2011 7:17 AM, Scott O'Bryan wrote:

Yes, I agree Andy.  That proposed API scared me a bit because it
seemed that we were trying to do to much in a single method call.
There was a redirect message, a script and noop params.  If we can
separate them and use the real redirect functionality built into the
EC, I'm good.  :D

On Mar 14, 2011, at 7:50 AM, Andy Schwartzandy.g.schwa...@gmail.com  wrote:


Hi Yuan -

On Mon, Mar 14, 2011 at 3:10 AM, Yuan Gaoyuan@oracle.com  wrote:

I like your comments. As for the names, how about
renderNoopAndCompleteResponse()?

That's definitely the clearest of the names that we have discussed. :-)

If we go with render, I can see three options:

1.  renderNoopAndCompleteResponse()
2.  renderNoopResponse()
3.  renderNoop()

I prefer the more concise forms (#2 or #3), though I think this mostly
comes down to personal taste.  Any of these are fine by me.

I am curious about some of the questions that Scott raised, eg:

- Should we consider just having FacesContext.responseComplete()
detect the empty response and automatically send a noop response?
(Interesting idea, though I am worried that  this might be just a bit
too much magic.  Think I like the idea of having an explicit API to
call.)

- Do we need a new method for the redirect case?  (Seems like this is
sufficiently covered by ExternalContext.redirect()).

Andy


Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-14 Thread Scott O'Bryan
So the caller would do the responseComplete after rendering the noop,
right?  If so, that looks MUCH better to me..  +1

On Mar 14, 2011, at 5:06 PM, Yuan Gao yuan@oracle.com wrote:

 hi,

 I agree that we are trying to do too much in a method. Also talked with Blake 
 about it. How about we leave the script and redirect to the caller, in this 
 method we only do the noop writing? We don't do the complete response either. 
 How do you like this then?

  /**
   * This method writes a noop/ to the response.
   *
   * @param context the FacesContext
   * @throws IOException
   */
  public static void renderNoopResponse(FacesContext context)   throws 
 IOException

 Thanks,
 -Yuan

 On 3/14/2011 7:17 AM, Scott O'Bryan wrote:
 Yes, I agree Andy.  That proposed API scared me a bit because it
 seemed that we were trying to do to much in a single method call.
 There was a redirect message, a script and noop params.  If we can
 separate them and use the real redirect functionality built into the
 EC, I'm good.  :D

 On Mar 14, 2011, at 7:50 AM, Andy Schwartzandy.g.schwa...@gmail.com  wrote:

 Hi Yuan -

 On Mon, Mar 14, 2011 at 3:10 AM, Yuan Gaoyuan@oracle.com  wrote:
 I like your comments. As for the names, how about
 renderNoopAndCompleteResponse()?
 That's definitely the clearest of the names that we have discussed. :-)

 If we go with render, I can see three options:

 1.  renderNoopAndCompleteResponse()
 2.  renderNoopResponse()
 3.  renderNoop()

 I prefer the more concise forms (#2 or #3), though I think this mostly
 comes down to personal taste.  Any of these are fine by me.

 I am curious about some of the questions that Scott raised, eg:

 - Should we consider just having FacesContext.responseComplete()
 detect the empty response and automatically send a noop response?
 (Interesting idea, though I am worried that  this might be just a bit
 too much magic.  Think I like the idea of having an explicit API to
 call.)

 - Do we need a new method for the redirect case?  (Seems like this is
 sufficiently covered by ExternalContext.redirect()).

 Andy


Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-13 Thread Bernd Bohmann
Hello,

completed is the right term? Is something else in the response?

Perhaps 'render' is the better alternative.

Regards

Bernd

On Sun, Mar 13, 2011 at 2:44 AM, Scott O'Bryan darkar...@gmail.com wrote:
 +1 to all of these comments..

 On Mar 12, 2011, at 10:57 AM, Andy Schwartz andy.g.schwa...@gmail.com wrote:

 Yuan -

 The documentation/contract isn't especially clear:

   * This method completes the PPR request and writes a noop/ to the
 response.
   * it also handles script and redirect

 I find the first statement is misleading.  In the event that a script
 or redirect is specified, this method won't generate a noop/
 response, right?  So seems like the doc should be more along the lines
 of completes a ppr response in one of three ways

 However, wouldn't it be clearer to break this up into three methods, maybe:

 - completeNoopResponse()
 - completeRedirectResponse()
 - completeScriptResponse()

 The PPR aspect is implied since these static methods live in
 PartialPageUtils, so we don't need to duplicate that information in
 the method names.

 If the idea is that these methods are only meant to be used for
 responding to ppr requests, we should enforce this by spec'ing that an
 IllegalStateException is thrown for non-ppr requests.

 Andy



Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-13 Thread Andy Schwartz
Hi Bernd -

I am a bit hesitant about the names as well.  Three possible options:

1. completeNoopResponse()/completeScriptResponse()/completeRedirectResponse().
2. renderNoopResponse()/renderScriptResponse()/renderRedirectResponse().
3. sendNoopResponse()/sendScriptResponse()/sendRedirectResponse().

Think #2 and #3 read better than #1.  If we go with #2 or #3 we would
make it clear that these complete the response by documenting that
FaceContext.responseComplete() is called.

Andy


Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-13 Thread Andy Schwartz
Btw - another variant would be to drop the Response suffix from the method 
names.

Andy

On Mar 13, 2011, at 10:48 AM, Andy Schwartz andy.g.schwa...@gmail.com wrote:

 Hi Bernd -
 
 I am a bit hesitant about the names as well.  Three possible options:
 
 1. completeNoopResponse()/completeScriptResponse()/completeRedirectResponse().
 2. renderNoopResponse()/renderScriptResponse()/renderRedirectResponse().
 3. sendNoopResponse()/sendScriptResponse()/sendRedirectResponse().
 
 Think #2 and #3 read better than #1.  If we go with #2 or #3 we would
 make it clear that these complete the response by documenting that
 FaceContext.responseComplete() is called.
 
 Andy


Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-13 Thread Scott O'Bryan
I like the idea of having three more simple API's although I think the
redirect is unnecessary..  That should be handled correctly by
ExtenalContext.redirect, even in PPR environments.

On Mar 13, 2011, at 8:57 AM, Andy Schwartz andy.g.schwa...@gmail.com wrote:

 Btw - another variant would be to drop the Response suffix from the method 
 names.

 Andy

 On Mar 13, 2011, at 10:48 AM, Andy Schwartz andy.g.schwa...@gmail.com wrote:

 Hi Bernd -

 I am a bit hesitant about the names as well.  Three possible options:

 1. 
 completeNoopResponse()/completeScriptResponse()/completeRedirectResponse().
 2. renderNoopResponse()/renderScriptResponse()/renderRedirectResponse().
 3. sendNoopResponse()/sendScriptResponse()/sendRedirectResponse().

 Think #2 and #3 read better than #1.  If we go with #2 or #3 we would
 make it clear that these complete the response by documenting that
 FaceContext.responseComplete() is called.

 Andy


Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-13 Thread Scott O'Bryan
Also, I'm wondering if we might be able to do something Wih the no-op
as well.  For instance, can our XmlHttpResponseWriter detect whether
content has been rendered before the response complete and? If it
hasn't, send the noop response.

Don't know if it's possible but simply needing to set
FacesContext.responseComplete() to do the noop would be less error
prone.

On Mar 13, 2011, at 9:18 AM, Scott O'Bryan darkar...@gmail.com wrote:

 I like the idea of having three more simple API's although I think the
 redirect is unnecessary..  That should be handled correctly by
 ExtenalContext.redirect, even in PPR environments.

 On Mar 13, 2011, at 8:57 AM, Andy Schwartz andy.g.schwa...@gmail.com wrote:

 Btw - another variant would be to drop the Response suffix from the method 
 names.

 Andy

 On Mar 13, 2011, at 10:48 AM, Andy Schwartz andy.g.schwa...@gmail.com 
 wrote:

 Hi Bernd -

 I am a bit hesitant about the names as well.  Three possible options:

 1. 
 completeNoopResponse()/completeScriptResponse()/completeRedirectResponse().
 2. renderNoopResponse()/renderScriptResponse()/renderRedirectResponse().
 3. sendNoopResponse()/sendScriptResponse()/sendRedirectResponse().

 Think #2 and #3 read better than #1.  If we go with #2 or #3 we would
 make it clear that these complete the response by documenting that
 FaceContext.responseComplete() is called.

 Andy


Re: propose a new utility API in PartialPageUtils to complate the response

2011-03-12 Thread Scott O'Bryan
+1 to all of these comments..

On Mar 12, 2011, at 10:57 AM, Andy Schwartz andy.g.schwa...@gmail.com wrote:

 Yuan -

 The documentation/contract isn't especially clear:

   * This method completes the PPR request and writes a noop/ to the
 response.
   * it also handles script and redirect

 I find the first statement is misleading.  In the event that a script
 or redirect is specified, this method won't generate a noop/
 response, right?  So seems like the doc should be more along the lines
 of completes a ppr response in one of three ways

 However, wouldn't it be clearer to break this up into three methods, maybe:

 - completeNoopResponse()
 - completeRedirectResponse()
 - completeScriptResponse()

 The PPR aspect is implied since these static methods live in
 PartialPageUtils, so we don't need to duplicate that information in
 the method names.

 If the idea is that these methods are only meant to be used for
 responding to ppr requests, we should enforce this by spec'ing that an
 IllegalStateException is thrown for non-ppr requests.

 Andy