File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding Http response header and response commited

 
Brij Garg
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTTP response consists of the status line, one or
more headers, a blank line, and the actual document, in that order

and

In HTTP version 2.2 with buffering enabled, you can
set headers until the buffer fills up and is actually sent to the client.

Keep these two point in mind,
my code is


In this code I am setting response header after response has been committed.Therefore this code should give IllegalStateException.

But i am getting output as "garg".

Need your comments on my understanding of this concept.
Thanks
[ August 21, 2008: Message edited by: Bear Bibeault ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're assumption is that the setContentType method will throw the Exception if the reponse is already commited, but the API says otherwise (namely)

Sets the content type of the response being sent to the client, if the response has not been committed yet.


Therefore the content type just gets missed, but no error is reported.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, there is no "HTTP 2.2"; the latest HTTP version is 1.1. Do you mean Servlet API version? If so, that's been obsolete for many years; we're at 2.5 now.
[ August 21, 2008: Message edited by: Ulf Dittmer ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic