I followed this tutorial (https://ohej.github.io/alfresco-tutorials/tutorial/aikau/tutorial.html#bringing-it-all-together) to create the custom ajaxWidget. everything went good using this url in the js file :
var url = Alfresco.constants.PROXY_URI + "slingshot/doclib/treenode/node/alfresco/company/home";
but when I tried another one from my own webscript that return a json response, I got no results ?
I tried
var url = Alfresco.constants.PROXY_URI + "test/file.json"
andurl = "alfresco/s/test/file.json"
"
It seems that, you have created custom webscript, can you please add the code for same.
Yes I did, and I am trying to use the url of the webscript instead of the one used in the tutorial, and the webscript works good, here is the code :
public class GetAll extends DeclarativeWebScript {
protected Map<String, Object> executeImpl(WebScriptRequest req,
Status status, Cache cache) {
Map<String, Object> model = new HashMap<String, Object>();
model.put("firstname", "firstname",);
model.put("lastname", "lastname",);
model.put("username", "username");
return model;
}
}
ftl file :
{
"test" : [
{
"username" : "${username}",
"firstname" : "${firstname}",
"lastname" : "${lastname}",
}
]
}
desc file :
<webscript>
<shortname>Some shortname</shortname>
<description>some desc</description>
<url>/test/file.html</url>
<url>/test/file.json</url>
<authentication>user</authentication>
<format default="json"></format>
</webscript>
and I changed the name and description used in the tuto by username and firstname.
Thanks.
It seems that you missed back end bean , which is used for creating webscript.Its for linking controller to ftl.You can look in to below link for more details on repository webscript.
http://www.krutikjayswal.com/2016/10/alfresco-webscript-spring-webscript.html
No I didn't miss the bean, the webscript is working correctly, and i get the results when I navigate to alfresco/s/test/file.json .
Thanks.
I solved the problem .
Thanks.
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.