cancel
Showing results for 
Search instead for 
Did you mean: 

POST Webscript

riadhazzouz
Confirmed Champ
Confirmed Champ

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}&amp;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 ?

2 REPLIES 2

roberto_gamiz
Star Contributor
Star Contributor

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?}&amp;username={username?}</url> with the question mark.
Thanks.