Hi Malaka/Kevin, The legacy and other encoding didn't support for special characters in HTTP Endpoint. Temporarily I was able to resolve by replacing the special character with encoded values.
@@ -246,6 +246,22 @@ public class HTTPEndpoint extends AbstractEndpoint { try { URI uri = new URI(template.expand()); evaluatedUri = uri.toString(); + StringBuilder buf = null; + if (evaluatedUri != null) { + buf = new StringBuilder(evaluatedUri.length()); + char focus; + for (int i = 0; i < evaluatedUri.length(); i++) { + focus = evaluatedUri.charAt(i); + if (focus == '#') { + buf.append("%23"); + } else if (focus == '@') { + buf.append("%40"); + } else { + buf.append(focus); + } + } + evaluatedUri = buf.toString(); + } Thanks, Kathees On Sat, Dec 19, 2015 at 9:00 PM, Kevin Ratnasekera <ke...@wso2.com> wrote: > Hi Kathees, > Is there a specific reason to use the legacy-encoding prefix here in your > case? Have you tried without the legacy-encoding prefix? > Can you try the following with legacy prefix, > > <call> > <endpoint> > <http method="post" > > uri-template="legacy-encoding:{uri.var.apiUrl}/1.1/statuses/update.json? > status={uri.var.status}"/> > </endpoint> > </call> > > Regards > Kevin > > On Fri, Dec 18, 2015 at 8:56 PM, Malaka Silva <mal...@wso2.com> wrote: > >> Hi Kathees, >> >> Can you try debugging [1] and try to figure out the issues? >> >> May be the issues it in 'String decodedString = >> URLDecoder.decode(template.expand(), "UTF-8");' >> >> [1] >> https://github.com/wso2/wso2-synapse/blob/master/modules/core/src/main/java/org/apache/synapse/endpoints/HTTPEndpoint.java >> >> On Fri, Dec 18, 2015 at 4:59 PM, Kathees Rajendram <kath...@wso2.com> >> wrote: >> >>> Hi, >>> >>> I created uri.var.status property and used the property in url-template with >>> legacy encoding. Remaining part of URL is removed with the special >>> character. >>> >>> <call> >>> <endpoint> >>> <http method="post" >>> >>> uri-template="legacy-encoding:{uri.var.apiUrl}/1.1/statuses/update.json?{uri.var.status}"/> >>> </endpoint> >>> </call> >>> >>> *Request* - sample #test >>> >>> *Output* >>> >>> [2015-12-18 16:45:47,269] DEBUG - wire << "POST >>> /1.1/statuses/update.json?status=sample%20 HTTP/1.1[\r][\n]" >>> [2015-12-18 16:45:47,269] DEBUG - wire << "Accept-Language: >>> en-US,en;q=0.8[\r][\n]" >>> >>> *Expected output* >>> >>> [2015-12-18 16:45:47,269] DEBUG - wire << "POST >>> /1.1/statuses/update.json?status=sample%20%23test HTTP/1.1[\r][\n]" >>> [2015-12-18 16:45:47,269] DEBUG - wire << "Accept-Language: >>> en-US,en;q=0.8[\r][\n]" >>> >>> What could be the reason? >>> >>> Thanks, >>> Kathees >>> >>> -- >>> Kathees >>> Software Engineer, >>> email: kath...@wso2.com >>> mobile: +94772596173 >>> >> >> >> >> -- >> >> Best Regards, >> >> Malaka Silva >> Senior Tech Lead >> M: +94 777 219 791 >> Tel : 94 11 214 5345 >> Fax :94 11 2145300 >> Skype : malaka.sampath.silva >> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77 >> Blog : http://mrmalakasilva.blogspot.com/ >> >> WSO2, Inc. >> lean . enterprise . middleware >> http://www.wso2.com/ >> http://www.wso2.com/about/team/malaka-silva/ >> <http://wso2.com/about/team/malaka-silva/> >> https://store.wso2.com/store/ >> >> Save a tree -Conserve nature & Save the world for your future. Print this >> email only if it is absolutely necessary. >> >> _______________________________________________ >> Dev mailing list >> Dev@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > -- Kathees Software Engineer, email: kath...@wso2.com mobile: +94772596173
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev