Non ascii characters in URL param in camel -
i using graph api of facebook , call through camel framework. query has non ascii characters (e.g. küçük). getting following exception:-
cause: org.apache.commons.httpclient.uriexception: invalid query @ org.apache.commons.httpclient.uri.parseurireference(uri.java:2049) @ org.apache.commons.httpclient.uri.<init>(uri.java:147) @ org.apache.commons.httpclient.httpmethodbase.geturi @ org.apache.commons.httpclient.httpclient.executemethod @ org.apache.commons.httpclient.httpclient.executemethod @ org.apache.camel.component.http.httpproducer.executemethod @ org.apache.camel.component.http.httpproducer.process @ org.apache.camel.util.asyncprocessorconverterhelper$processortoasyncprocessorbridge.process(asyncprocessorconverterhelper.java:61) @ org.apache.camel.util.asyncprocessorhelper.process(asyncprocessorhelper.java:73) @ org.apache.camel.processor.sendprocessor$2.doinasyncproducer(sendprocessor.java:122)
does camel support non ascii characters in uri? if not, other things can done?
example url: https://graph.facebook.com/?ids=http://www.example.com/küçük
so able fix issue.
in apache camel, http_uri component not accept special characters, after encoding them. bug in camel not yet closed.
fortunately us, special characters appear in query string of url , not main uri part. camel provides component http_query, can parse , understand encoded utf-8 characters. setting in header, able rid of issue.
so first encode url utf-8 , set http_query value query string. worked charm. e.g. (scala)
.setheader(exchange.http_query, _.in[httprequest].uri.split(?).head) .setheader(exchange.http_uri, _.in[httprequest].uri)
Comments
Post a Comment