@POST
@Path("/userlogin")
@Consumes(MediaType.APPLICATION_JSON)
public Response userlogin(Users user){
System.out.printf("the %s",user.getEmail());
Query q = em.createQuery("select u from Users u where u.email = :email and u.password = :password");
q.setParameter("email",user.getEmail());
q.setParameter("password",user.getPassword());
try{
Users u = (Users)q.getSingleResult();
if( u.getStatus().equals("UN-VERIFIED")){
try {
throw new UnVerifiedUserException("hi "+u.getFirstName()+", you haven't verified account");
} catch (UnVerifiedUserException ex) {
return Response.status(Response.Status.FORBIDDEN).entity(ex.getUsermessage()).build();
}
}
else{
return Response.ok(u, MediaType.APPLICATION_JSON).build();
}
}
catch(NoResultException no){
return Response.status(Response.Status.NOT_FOUND).build();
}
}
since it comes with a payload, i did a CN1 client as this ;
Hashtable user = new Hashtable();
user.put("email",tx1.getText());
user.put("password", tx2.getText());
final String payload = Result.fromContent(user).toString();
ConnectionRequest con = new ConnectionRequest(){
@Override
protected void buildRequestBody(OutputStream os) throws IOException {
os.write(payload.getBytes("UTF-8"));
}
};
con.setPost(true);
con.setContentType("application/json");
con.addRequestHeader("Accept", "application/json");
NetworkManager.getInstance().addToQueue(con);
}
}
when i click the button to login ,i expect it to make a post request to login, but it returns a 404 with Dialog, method or uri not found,i dont want to write a queryparam method where i can easily set the argument query to login, i intend to maintain an SOA architecture where all consumers of this api share the same method
so when i click this
button.it seems the api method is not reached because i dont see any log on the method been invocated. please help