Hello All,
I am calling a java webscript from a ftl.
var uri = Alfresco.constants.PROXY_URI+"/vs/insurancetype?" + encodeURIComponent("company="+companyValue+"&insurancetype="+insuranceValue);
this.register = function () {
Alfresco.util.Ajax.jsonGet({
url: uri,
successCallback: {
fn: this.updateSubInsuranceType,
scope: this
},
failureCallback: {
fn: function(){},
scope: this
}
});
Passing Parameter:
var companyValue = "A&B Company";
var insuranceValue = "R&K insurance"
Request URL:
When I get the request in Java Webscript.
final String insuranceCompany = req.getParameter("company"); ///companyValue= A
final String insurancetype = req.getParameter("insurancetype"); /// insuranceValue=R
Basically, I am not getting right parameter from the request object.
Please suggest...
You should not be encoding the entire URL arguments via encodeURIComponent. It is more appropriate to encode only the values individually before combining them into the URL. So the URL should look more like
(Note: You also do not need the leading slash in your URL addition since the PROXY_URI already ends with a slash)
Hello Thanks for reply.
I have already tried this way too...Only encode value "A&B Company" but still in WebScriptRequest I am getting full path and parameters value without encoding. I have tried to decode as well in java webscript as well.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.