• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

sending a response

 
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Is there something like double buffering?
 
Niteen Patil
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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.
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic