BUG: Improper usage of setStatus in RemoteServiceServlet

12 views
Skip to first unread message

pra$anth..

unread,
Aug 9, 2006, 11:21:58 AM8/9/06
to Google Web Toolkit
Google RemoteServiceServlet sets the status of the servlet response
after writing the data into the servlet.

code snippet:


593 // Send the reply.
594 //
595 response.setContentLength(reply.length);
596 response.setContentType(contentType);
597 response.getOutputStream().write(reply);
598 response.setStatus(HttpServletResponse.SC_OK); <-- Is this a
right way to set response after writing into output stream ?


I should have been like this


595 response.setContentLength(reply.length);
596 response.setContentType(contentType);
597 response.setStatus(HttpServletResponse.SC_OK);
598 response.getOutputStream().write(reply);


There is no meaning in setting status after writing the data into the
response
Let me know if this is a right way to do this ?

ash

unread,
Aug 9, 2006, 7:41:55 PM8/9/06
to Google Web Toolkit
with the dav subversion server and webdav server that i built i made it
a practice to set the status first before writing anything else to the
response stream.

however, as far as i can tell the jee/jsp/servlet spec has been loose
on this and has not formalised a contract. therefore, as an implementor
you may discover that an issue may crop up based on the application
server/container running the application.

maybe those folks that have deployed gwt-rpc to following servers can
speak up:
- websphere
- weblogic
- jboss
- jetty
- etc

rgds ash
http://www.gworks.com.au/

self help sources:
1. http://javaongems.org/ -> http://code.google.com/p/javaongems/
2. http://code.google.com/p/gems-gwt-user/
3. http://code.google.com/p/juls/

mP

unread,
Aug 9, 2006, 9:22:57 PM8/9/06
to Google Web Toolkit
This has been discussed before. Under websphere setting the status
clears / resets the response, therefore the order is important.

pra$anth..

unread,
Aug 10, 2006, 12:31:30 AM8/10/06
to Google Web Toolkit
Yes the order is important , There will be no meaning in setting status
after data being written in the output stream
and moreover it resets/clears the response. 1) the status need to set
next 2) data is not be written
i was not able make a successfull rpc call bcos of this problem,
I have changed the order manually and compiled and things worked.
Please consider this PROBLEM and make changes
Its a simple change. just swapping of the lines

GWT developement team leads/memebers PLEASE TAKE A NOTE OF THIS PROBLEM

pra$anth..

unread,
Aug 19, 2006, 7:38:49 AM8/19/06
to Google Web Toolkit
GWT Team any updates on the problem ?

Scott Blum

unread,
Aug 19, 2006, 12:11:37 PM8/19/06
to Google-We...@googlegroups.com
On 8/19/06, pra$anth.. <v.k.pr...@gmail.com> wrote:
> GWT Team any updates on the problem ?

This is fixed in 1.1.0.

Scott

pra$anth..

unread,
Aug 21, 2006, 12:44:50 AM8/21/06
to Google Web Toolkit
gr8 thanks
-=Prasanth=-

Reply all
Reply to author
Forward
0 new messages