custom widget

cancel
Showing results for 
Search instead for 
Did you mean: 
riadhazzouz
Active Member

custom widget

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"
and
url = "alfresco/s/test/file.json"
"
5 Replies
krutik_jayswal
Senior Member II

Re: custom widget

It seems that, you have created custom webscript, can you please add the code for same.

riadhazzouz
Active Member

Re: custom widget

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.

krutik_jayswal
Senior Member II

Re: custom widget

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

riadhazzouz
Active Member

Re: custom widget

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.

riadhazzouz
Active Member

Re: custom widget

I solved the problem .
Thanks.