post error Content-Type must be 'text/plain' with 'charset=utf-8'

78 views
Skip to first unread message

wanghuapeng

unread,
Nov 29, 2006, 4:31:57 AM11/29/06
to Google Web Toolkit
help!
I'm a newer for GWT.
when I use FormPanel Class to post myServlet extend by
RemoteServiceServlet

Error below:
[WARN] StandardContext[]Exception while dispatching incoming RPC call
javax.servlet.ServletException: Content-Type must be 'text/plain' with
'charset=utf-8' (or unspecified charset)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.readPayloadAsUtf8(RemoteServiceServlet.java:552)

My question is :
Why And How to use Content-Type.

Thanks and sorry for my English!

Dan Morrill

unread,
Nov 30, 2006, 2:33:26 PM11/30/06
to Google-We...@googlegroups.com
Hello, wanghuapeng!

We can help you better if you give us more information about your problem.  Three things would help us out:

1.  What browser and operating system are you using?
2.  What language is your application written in?  (I ask because if your browser is sending something like UTF-16, that might be a problem.)
3.  Can you provide us a small sample of the code (both your client and server code) that is causing you problems?

Thanks!

- Dan Morrill

wanghuapeng

unread,
Dec 1, 2006, 12:37:53 AM12/1/06
to Google Web Toolkit
I'm very thank you Dan.
IE 7 and winXP sp2 for my system.
My language is Chinese,but I just use English in this project.
My client and server so simple almost use in the GWT samples.

Dan Morrill

unread,
Dec 1, 2006, 9:45:04 AM12/1/06
to Google-We...@googlegroups.com
No problem at all!

The error you are getting is from the RPC Servlet base class.  The RPC servlet requires that the data be of Content-Type text/plain with UTF-8 as the character encoding.  Normally the RPC client code will set that automatically, so probably the error is in where you are calling the server from the client, or in your Servlet implementation.

You don't seem to be using any particularly strange configurations.  So, I am guessing the problem is in how you are using the RPC code.  Can you show us the RPC Servlet you are using, and the method in your client where you are making the async request call?  That would help us see where the problem is.

- Dan Morrill

wanghuapeng

unread,
Dec 3, 2006, 8:47:43 AM12/3/06
to Google Web Toolkit
yeah,I do not configure about any ecode such as UTF-8.And my RPC
Servlet just extends Remote Servlet not any about ecode code.
Client is just a fileupload and post to the RPC Servlet.
Can you tell me how to set the Content-Type and ecode.

Dan Morrill

unread,
Dec 4, 2006, 11:14:45 AM12/4/06
to Google-We...@googlegroups.com

Hello again!

I don't know what you mean when you say "Client is just a fileupload and post to the RPC Servlet."  If you mean that you are posting a file upload to a URL mapped to an RPC Servlet, that would not work, because RPC Servlets will generally only be able to handle RPC calls.

If you can be more specific about what you are trying to do, we can try and help you out.

- Dan Morrill

Ian Bambury

unread,
Dec 4, 2006, 11:23:57 AM12/4/06
to Google-We...@googlegroups.com
You might need to go into Project | Properties and set text File Encoding to UTF-8 if you are using Eclipse since it seems to default everything to Cp1252
 
Ian
Reply all
Reply to author
Forward
0 new messages