I wrote a post webscript :
JAVA Controller :
protected Map<String, Object> executeImpl(WebScriptRequest req,
Status status) {
String id = (String) req.getParameter("id");
String username = (String) req.getParameter("username");
System.out.println(username);
System.out.println(id);
//OTHER STUFF
model.put("id", id);
model.put("username", username);
return model;
}
Descriptor :
<webscript>
<shortname>Change status</shortname>
<description>Change status</description>
<url>/pfe/status?id={id}&username={username}</url>
<format default="json">extension</format>
<authentication runas="admin">guest</authentication>
<transaction>required</transaction>
</webscript>
Template
{"ChangeStatus" :
{
"id" : "${id}",
"username" : "${username}"
}
}
And I'm always getting username = null and id = null ?
Is your controller in java executed?
Are you sure that the id of your backed web script bean match the package, name an HTTP Method of the webscript definition?
To ensure that you are configured correctly the Java Backed Web Script you can access the info page of your web script in the Alfresco Webscript Home and check that the property calledl implementation is pointing to your class.
The problem was in the descriptor, in the url tag
It needs to be like this <url>/pfe/status?id={id?}&username={username?}</url> with the question mark.
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.