You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jysemel <jy...@qq.com> on 2014/05/16 07:30:11 UTC

请问中文传递参数

exchange.getOut().setHeader(Exchange.HTTP_QUERY,json),这个json里面包含中文的, 
结果就报 
org.apache.commons.httpclient.URIException: Invalid query 
        at
org.apache.commons.httpclient.URI.parseUriReference(URI.java:2049) 
        at org.apache.commons.httpclient.URI.<init>(URI.java:147) 
        at
org.apache.commons.httpclient.HttpMethodBase.getURI(HttpMethodBase.java:265) 
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:383) 
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) 
        at
org.apache.camel.component.http.HttpProducer.executeMethod(HttpProducer.java:244) 
        at
org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:144) 
        at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) 
        at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:113) 
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) 
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398) 
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) 
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:118) 
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:80) 
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) 
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105) 
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87) 
        at
org.apache.camel.component.http.CamelServlet.service(CamelServlet.java:127) 



--
View this message in context: http://camel.465427.n5.nabble.com/-tp5751205.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re:请问中文传递参数

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

You need to make sure the json String is encoded with UTF-8.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On May 18, 2014 at 11:53:34 AM, jysemel (jysemel@qq.com) wrote:
> exchange.getOut().setHeader(Exchange.HTTP_QUERY,json),这个json里面包含中文的,
> 结果就报
> org.apache.commons.httpclient.URIException: Invalid query
> at
> org.apache.commons.httpclient.URI.parseUriReference(URI.java:2049)
> at org.apache.commons.httpclient.URI.(URI.java:147)
> at
> org.apache.commons.httpclient.HttpMethodBase.getURI(HttpMethodBase.java:265)  
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:383)  
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)  
> at
> org.apache.camel.component.http.HttpProducer.executeMethod(HttpProducer.java:244)  
> at
> org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:144)  
> at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)  
> at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:113)  
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)  
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)  
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)  
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)  
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)  
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)  
> at
> org.apache.camel.component.http.CamelServlet.service(CamelServlet.java:127)  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/-tp5751205.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>