POST Webscript

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2019 10:37 AM
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 ?
- Labels:
-
Alfresco Content Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2019 08:58 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2019 03:13 AM
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.
