• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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: 9708
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: 9708
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.
 
Just let me do the talking. Ahem ... so ... you see ... we have this tiny ad...
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic