UTF-8 Support
danny_hon Aug 31, 2005 9:10 PMI am using JBoss Portal 2.0, and I need to support UTF-8. I can display UTF-8 characters, but I can't make the HTTP POST to work with UTF-8 data.
In a normal web application, I can use request.setCharacterEncoding("UTF-8") to set the encoding of the request InputStream.
Within a portlet, I got the following exception by calling the ActionRequest's setCharacterEncoding() method.
20:02:07,560 ERROR [CoreServlet] An error occured during the action request : called after the body has been read
java.lang.IllegalStateException: called after the body has been read
at org.jboss.portal.portlet.impl.ActionRequestImpl.setCharacterEncoding(ActionRequestImpl.java:80)
at com.ge.health.portal.weather.WeatherPortlet.processAction(Unknown Source)
at org.jboss.portal.portlet.invocation.DispatcherInterceptor.invokeAction(DispatcherInterceptor.java:110)
at org.jboss.portal.portlet.invocation.DispatcherInterceptor.invoke(DispatcherInterceptor.java:191)
at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
at org.jboss.portal.portlet.invocation.PreferencesInterceptor.invoke(PreferencesInterceptor.java:93)
at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
at org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor$InvokeNextCommand.execute(ContextDi
spatcherInterceptor.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.portal.server.servlet.CommandServlet.doGet(CommandServlet.java:49)
at org.jboss.portal.server.servlet.CommandServlet.doPost(CommandServlet.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:539)
I tried to set the character encoding using an interceptor, but it still doesn't work either.
Has anyone done this before? Any help is appreciated.