I'm newbie on creating web services with Jersey and I'm facing with this problem:
@GET
@Path("/logoutUser")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public Response logoutUser(@QueryParam("userName") String userName) {
if (userName.equalsIgnoreCase("jmart") || userName.equalsIgnoreCase("jromero")) {
return Response.status(Response.Status.OK).entity("Logout realizado").type(MediaType.APPLICATION_JSON).build();
}else {
throw new CustomNotFoundException("No se ha podido realizar el logout del usuario " + userName);
}
}
@GET
@Path("/logoutUser")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public Response logoutUser(@QueryParam("idUsuario") int idUsuario) {
if (idUsuario == 1 || idUsuario == 2) {
return Response.status(Response.Status.OK).entity("Logout realizado").type(MediaType.APPLICATION_JSON).build();
}else {
throw new CustomNotFoundException("No se ha podido realizar el logout del usuario " + idUsuario);
}
}
Obviously when I'm trying to call any of the two methods my server throws an exception.
Is there any solution of implementing the same method with different parameter on the same path?