Callback failed after setting response type to UTF-8

View: New views
4 Messages — Rating Filter:   Alert me  

Callback failed after setting response type to UTF-8

by nayela :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

After adding the character encoding filter in Web.xml file the dwr callback failed, method is executing properly but no return value. The code added in web.xml is given below:

<!-- Filter Configuration for UTF-8 character encoding -->
        <filter>
          <filter-name>CharacterEncodingFilter</filter-name>
            <filter-class>com.airsanchay.util.CharacterEncodingFilter</filter-class>
            <init-param>
              <param-name>encoding</param-name>
              <param-value>UTF-8</param-value>
            </init-param>
        </filter>

        <filter-mapping>
          <filter-name>CharacterEncodingFilter</filter-name>
          <url-pattern>/*</url-pattern>
        </filter-mapping>

Thanks

Re: Callback failed after setting response type to UTF-8

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sounds like an issue with the filter, not DWR.  Where did you get it?  I
have never heard of that package.  I would suggest using a more
mainstream filter like the one in Spring:
http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/filter/CharacterEncodingFilter.html

nayela wrote:

> Hello,
>
> After adding the character encoding filter in Web.xml file the dwr callback
> failed, method is executing properly but no return value. The code added in
> web.xml is given below:
>
> <!-- Filter Configuration for UTF-8 character encoding -->
>         <filter>
>           <filter-name>CharacterEncodingFilter</filter-name>
>            
> <filter-class>com.airsanchay.util.CharacterEncodingFilter</filter-class>
>             <init-param>
>               <param-name>encoding</param-name>
>               <param-value>UTF-8</param-value>
>             </init-param>
>         </filter>
>
>         <filter-mapping>
>           <filter-name>CharacterEncodingFilter</filter-name>
>           <url-pattern>/*</url-pattern>
>         </filter-mapping>
>
> Thanks
>  



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4478 (20091003) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Callback failed after setting response type to UTF-8

by nayela :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Actually i have the filter class written in my project. Following is the class code:


public class CharacterEncodingFilter implements Filter
{

        private FilterConfig fc;

        public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException
        {

                HttpServletRequest request = (HttpServletRequest) req;
                HttpServletResponse response = (HttpServletResponse) res;

                response.setContentType("text/html; charset=UTF-8");
                request.setCharacterEncoding("UTF-8");

                chain.doFilter(request, response);        //do it again, since JSPs will set it to the default

                response.setContentType("text/html; charset=UTF-8");
                request.setCharacterEncoding("UTF-8");
        }

        public void init(FilterConfig filterConfig)
        {
                this.fc = filterConfig;
        }

        public void destroy()
        {
                this.fc = null;
        }
}


davidmarginian wrote:
Sounds like an issue with the filter, not DWR.  Where did you get it?  I
have never heard of that package.  I would suggest using a more
mainstream filter like the one in Spring:
http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/filter/CharacterEncodingFilter.html

nayela wrote:
> Hello,
>
> After adding the character encoding filter in Web.xml file the dwr callback
> failed, method is executing properly but no return value. The code added in
> web.xml is given below:
>
> <!-- Filter Configuration for UTF-8 character encoding -->
>         <filter>
>           <filter-name>CharacterEncodingFilter</filter-name>
>            
> <filter-class>com.airsanchay.util.CharacterEncodingFilter</filter-class>
>             <init-param>
>               <param-name>encoding</param-name>
>               <param-value>UTF-8</param-value>
>             </init-param>
>         </filter>
>
>         <filter-mapping>
>           <filter-name>CharacterEncodingFilter</filter-name>
>           <url-pattern>/*</url-pattern>
>         </filter-mapping>
>
> Thanks
>  



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4478 (20091003) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
For additional commands, e-mail: users-help@dwr.dev.java.net

Re: Callback failed after setting response type to UTF-8

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The filter doesn't look right to me.  I would suggest looking at another
filter that is known to work.

nayela wrote:

> Actually i have the filter class written in my project. Following is the
> class code:
>
>
> public class CharacterEncodingFilter implements Filter
> {
>
> private FilterConfig fc;
>
> public void doFilter(ServletRequest req, ServletResponse res, FilterChain
> chain) throws IOException, ServletException
> {
>
> HttpServletRequest request = (HttpServletRequest) req;
> HttpServletResponse response = (HttpServletResponse) res;
>
> response.setContentType("text/html; charset=UTF-8");
> request.setCharacterEncoding("UTF-8");
>
> chain.doFilter(request, response);        //do it again, since JSPs will
> set it to the default
>
> response.setContentType("text/html; charset=UTF-8");
> request.setCharacterEncoding("UTF-8");
> }
>
> public void init(FilterConfig filterConfig)
> {
> this.fc = filterConfig;
> }
>
> public void destroy()
> {
> this.fc = null;
> }
> }
>
>
>
> davidmarginian wrote:
>  
>> Sounds like an issue with the filter, not DWR.  Where did you get it?  I
>> have never heard of that package.  I would suggest using a more
>> mainstream filter like the one in Spring:
>> http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/filter/CharacterEncodingFilter.html
>>
>> nayela wrote:
>>    
>>> Hello,
>>>
>>> After adding the character encoding filter in Web.xml file the dwr
>>> callback
>>> failed, method is executing properly but no return value. The code added
>>> in
>>> web.xml is given below:
>>>
>>> <!-- Filter Configuration for UTF-8 character encoding -->
>>>         <filter>
>>>           <filter-name>CharacterEncodingFilter</filter-name>
>>>            
>>> <filter-class>com.airsanchay.util.CharacterEncodingFilter</filter-class>
>>>             <init-param>
>>>               <param-name>encoding</param-name>
>>>               <param-value>UTF-8</param-value>
>>>             </init-param>
>>>         </filter>
>>>
>>>         <filter-mapping>
>>>           <filter-name>CharacterEncodingFilter</filter-name>
>>>           <url-pattern>/*</url-pattern>
>>>         </filter-mapping>
>>>
>>> Thanks
>>>  
>>>      
>>
>> __________ Information from ESET NOD32 Antivirus, version of virus
>> signature database 4478 (20091003) __________
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>
>>    
>
>  



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4481 (20091005) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...