Java:
@POST
@Path("/post")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response createPost(@FormParam("type") String type, @FormParam("content") String content) {
postEJB.createPostUserRest(type, content);
URI userURI = uriInfo.getAbsolutePathBuilder().build();
return Response.created(userURI).build();
}
Curl:
curl -X POST -d type=Link -d content=www -i -u pepe:pepe http://localhost:8080/web-0.0.1-SNAPSHOT/api/user/post