• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GET method

 
agrah upadhyay
Ranch Hand
Posts: 579
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone explain the reason behind following--
(1).When using a PrintWriter object to return the response, set the content type 'before' accessing the PrintWriter object.

Also can't unicode be sent from FET method?
(2).Only ASCII (text) data can be sent to server with GET method.
 
Pranav Shukla
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Original Message Posted by : agrah upadhyay

Can anyone explain the reason behind following--
(1).When using a PrintWriter object to return the response, set the content type 'before' accessing the PrintWriter object.



Servlet container may commit the response output to the client when the response buffer is filled. But the servlet container providers may choose not to implement buffering at all. See the following quote from Servlet Spec 2.4 Section SRV.5.1 page 43.


A servlet container is allowed, but not required, to buffer output going to the client
for efficiency purposes. Typically servers that do buffering make it the default, but
allow servlets to specify buffering parameters.


So, if as a servlet developer you are not setting the content type before writing to your output stream the container may commit the response and subsequently your call for setting the content-type will be ignored by the container as the response has already been committed.

Can't get the answer for your second question.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for your second question, you hhave to try it out. Since parameters are appended to the URL for GET requests, try typing in unocode characters(either in ther URL or in form parametsrs) and see what happens.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic