I honestly thought I knew how to do this, apparently not.
Here is my basic resource for creating a user.
@POST
@Path("create")
@Timed
@UnitOfWork
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public long createUser(@PathParam("username") String username,
@PathParam("password") String password)
{
User userToCreate = new User();
System.out.println("**********************************************");
System.out.println(username + " " + password);
System.out.println("**********************************************");
userToCreate.setUsername(username);
userToCreate.setPassword(password);
// Save to database.
return userDAO.create(userToCreate);
}
Very simple, the System.out lines are just to help me debug, they will be removed when this works (and yes, I will add encryption, too!)
Anyways, it turns out, that no matter what I seem to do - when sending data to this via PostMan, the value for username and password are ALWAYS null... I have no idea what the hell is going on.
I send the fields "username" and "password" as raw json withid the body of the request.
Am I missing something?