I have the following code always returning null when calling getParameter()`
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import javax.ws.rs.Path;
@Path("/path")
public class MyResource {
protected ResponseBuilder response;
protected HttpServletRequest request;
public MyResource(@Context HttpServletRequest request) {
this.request = request;
this.response = Response.ok();
}
@POST
public Response postTest() {
JSONObject responseObj = new JSONObject();
String test = request.getParameter("test");
log.debug(test);
return response.entity(responseObj.toString()).build();
}
}
I'm using this curl to trigger it:
curl -X POST -H "Cache-Control: no-cache" -H "Postman-Token: b7a3801f-b9d7-c7a1-004e-ac70b835d436" -H "Content-Type: application/x-www-form-urlencoded" -d 'test=12345' 'http://localhost:8180/path'
What am I doing wrong?