Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

sending a response

 
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a little bit confused with sending a response to a client.

When does it take place?

I thought that after:



But please consider an example (I attach only an important part of JSP file):

Output in my webbrowser:
Some text after flush

So it can not be send after out.flush().

Another:

Nothing is printed.

Another:

"Some text" is printed.

Please, tell me when a response is sent to an user? And please give me some details about buffering (I think that page is double buffered - through JSPWriter and through PrintWriter of ServletResponse).

Thanks for your time!
 
Sheriff
Posts: 9695
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lucas output is sent to the client when you call the flush method. But that doesn't mean that no output can be sent after that. If you don't flush the output stream, then its automatically flushed when the output buffer is full (of course if autoFlush attribute of page directive is set to true)...
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens when the autoFlush="true" and the buffer is not full.Isn't the output sent to the client?
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lucas,

This thread might help

Flush()

Kind Regards.
Hasnain.
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankit Garg wrote:Lucas output is sent to the client when you call the flush method. But that doesn't mean that no output can be sent after that. If you don't flush the output stream, then its automatically flushed when the output buffer is full (of course if autoFlush attribute of page directive is set to true)...



And at the end of JSP page evaluation - out.close() is invoked?
 
Ankit Garg
Sheriff
Posts: 9695
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lucas Smith wrote:And at the end of JSP page evaluation - out.close() is invoked?


Yes the output stream to the client is closed, which will automatically flush the output stream...
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there something like double buffering?
 
Niteen Patil
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lucas,

This thread might help

Flush()

Kind Regards.
Hasnain.

Went through the thread.It means that the response is committed after the service method completes, if the buffer is not full. If the buffer is full and flush=true, then the response is committed when the buffer is full.
Am i right.
Thanks.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic