jax-rs retrieve form parameters

前端 未结 1 1896
萌比男神i
萌比男神i 2021-01-03 22:17

I\'m trying to retrieve some parameters that are passed to jax-rs from a posted form with the HttpServletRequest. However, my request object is always returning null values

相关标签:
1条回答
  • 2021-01-03 22:41
    @POST
    @Path("/authenticate")
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public void authenticate(@FormParam("email") String email, @FormParam("password") String password) throws Exception {
    
        if (loginService.authenticate(email, password)) {
            response.sendRedirect("/app");
        } else {
            request.setAttribute("authenticationError", "Invalid email/password.");
    
        }
    }
    
    0 讨论(0)
提交回复
热议问题