Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sending a response

 
Lucas Smith
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!
 
Ankit Garg
Sheriff
Posts: 9577
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 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)...
 
Niteen Patil
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?
 
Hasnain Javed Khan
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: 9577
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic