HomeController { @PermitAll @POST @Path("/login") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.TEXT_PLAIN }) public Response login(UserLogin userLogin) { String userToken = DefaultUserService.getInstance().login(userLogin); if (userToken != null) { return Response.status(200).entity(userToken).build(); } else { return Response.status(406).entity("login failed").build(); } }  @RateLimiter(base = RateLimiter.Base.General, permits = 2, timeUnit = TimeUnit.MINUTES) @PermitAll @GET @Path("/world/{id}") @Produces("application/json") Response helloworld(@Context HttpHeaders headers); @PermitAll @GET @Path("/error") @Produces("application/json") Response error(); @PermitAll @POST @Path("/login") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.TEXT_PLAIN }) Response login(UserLogin userLogin); @PermitAll @AntiDefacement @POST @Path("/loginecho") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) Response loginecho(UserLogin userLogin); @RolesAllowed({ "USER", "MAIN_FORCES" }) @POST @Path("/singlesave") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) Response save(Article article); @RolesAllowed("MAIN_FORCES") @POST @Path("/multisave") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) List<Article> save(@QueryParam("multi") boolean isMulti, List<Article> articles);  }
@Test public void testLogin() { ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(buildUrl("hello/login")); UserLogin userLogin = new UserLogin("003","xyz"); Response response = target.request().post(Entity.entity(userLogin,MediaType.APPLICATION_JSON)); String userToken = response.readEntity(String.class); System.out.println(userToken); response.close(); }