DataService is called with null parameter;
pnakaska Nov 5, 2014 5:46 PMThe DataService is failing to receive the parameter passed from the client.
The parameter received by the service method implementation only gets null for 'value'
-------------------
// The Main Page uses call() to send request:
@EventHandler("searchButton")
public void onSearchButtonPress(ClickEvent e) {
String discarded = dataService.call(searchCallback).search( "thisIsAParamValue");
// I know dataService does not return ant values b.c.it is asynchronous, response arrives via the callback, thus named 'discarded'
}
-------------------
// The callback, then, should receive response:
final ResponseCallback searchCallback = new ResponseCallback() {
@Override
public void callback(Response response) {
Window.alert("HTTP status code: " + response.getStatusCode());
// The response value 'A String result' is received by this callback, as sent by the service as the response.
Window.alert("HTTP response body: " + response.getText());
}
};
-------------------
A basic data service to receive some queries; currently it receives only a 'String' value as a parameter:
@Path("search")
public interface DataService {
@POST
@Produces({"application/json"})
public String search (String queryString);
}
-------------------
// The implementation attempts to show the parameter 'value'
// but the 'value' is null, It's value should be 'thisIsAParamValue'.
// The callback does properly return the string result 'A String result' back to the client.
public class DataServiceImpl implements DataService
{
@Override
public String search (String value) {
if (value != null) {
System.out.println("DataServiceImpl:dummySearch:received: value="+value);
} else {
System.out.println("DataServiceImpl:dummySearch:null value received");
}
return "A String result";
}
...
}
The POM is based on the errai-jaxrs-demo-crud. But it is eventually got to work with Elastic search and a few other things, so there are some additional dependencies in the POM.
I've included the POM. Could some of the dependencies included be interfering with the JAXRS marshaling, somehow?
At runtime, there are no errors that I can detect during the request.
-
pom.xml 22.4 KB