vendredi 12 février 2016

How to retrieve a modelAttribute from HandlerInterceptorAdapter

I have a class that extends HandlerInterceptorAdapter:

public class AreaRiservataInterceptorAdapter extends HandlerInterceptorAdapter {        
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception 
    {}
}

I need it since I have to "edit" the object Utente, that you can see as parameter in this controller; with HandlerInterceptorAdapter I intercept the request before it is sent to this controller

    @Controller
    public class AreaRiservata{
    @RequestMapping("/prv/areaRiservataPost")
        public String areaRiservataPost(Model model, Utente utente){}   
   }

As I told before, I have to "edit" the object Utente inside the method preHandle of the class that extends HandlerInterceptorAdapter. I don't understand where I can retrieve the object Utente. From the request? Form Object handler?

It's easy to do it in the method postHandle, since I can get it from the parameter ModelAndView, but I don't know how to do it inside preHandle.

Thank you





Aucun commentaire:

Enregistrer un commentaire