|
From: <jue...@we...> - 2004-03-18 15:23:51
|
The problem is that DispatcherServlet doesn't know the bean name of the = handlers that a HandlerMapping returns: The handlers don't even have to = have names in the first place. =20 What you could do is let your Finder class implement BeanNameAware and = store the passed-in bean name there. In your HandlerInterceptor, check = for Finder and fetch the bean name from it. Alternatively, you could = also check the request URI directly. =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von Kopylenko, Dmitry Gesendet: Do 18.03.2004 16:14 An: 'spr...@li...' Betreff: RE: [Springframework-developer] Handler Interceptor I wouldn't mess around with changing the API at this point because this = API is used in production deployments =20 Dmitriy. -----Original Message----- From: Claudio D'Angelo [mailto:cla...@ob...]=20 Sent: Thursday, March 18, 2004 10:08 AM To: spr...@li... Subject: [Springframework-developer] Handler Interceptor =09 =09 Hi, I need of an Interceptor that controls the execution of workflow: The methods of the HandleInterceptor are: public boolean preHandle(javax.servlet.http.HttpServletRequest request, = javax.servlet.http.HttpServletResponse response, java.lang.Object = handler)=20 public void postHandle(javax.servlet.http.HttpServletRequest request, = javax.servlet.http.HttpServletResponse response, java.lang.Object = handler, ModelAndView modelAndView)=20 public void afterCompletion(javax.servlet.http.HttpServletRequest = request, javax.servlet.http.HttpServletResponse response, = java.lang.Object handler, java.lang.Exception ex)=20 =09 =09 In all method is passed the instance of Controller that must be execute = but I need to know about the bean name (id value of configuration file) = becouse I've have similar bean with different id: ie: =09 <bean name=3D"/find.do" class=3D"it.test.view.Finder"> ... <property name=3D"commandName"> = <value>command</value></property> <property = name=3D"formView"><value>.find.normal</value></property> <property = name=3D"successView"><value>.detail.Normal</value></property> </bean> <bean name=3D"/extendedFind.do" class=3D"it.test.view.Finder"> ... <property name=3D"commandName"> = <value>command</value></property> <property = name=3D"formView"><value>.find.extended</value></property> <property = name=3D"successView"><value>.detail.extended</value></property> </bean> =09 All becouse the Command is the same but the view is different. =09 Is possible change the interface ? in : public boolean preHandle(javax.servlet.http.HttpServletRequest request, = javax.servlet.http.HttpServletResponse response, java.lang.Object = handler, String beanName)=20 public void postHandle(javax.servlet.http.HttpServletRequest request, = javax.servlet.http.HttpServletResponse response, java.lang.Object = handler, String beanName, ModelAndView modelAndView)=20 public void afterCompletion(javax.servlet.http.HttpServletRequest = request, javax.servlet.http.HttpServletResponse response, = java.lang.Object handler, String beanName, java.lang.Exception ex)=20 =09 =09 =09 =09 Grazie e buon lavoro =09 ________________________________ Claudio D'Angelo Software Consultant ObjectWay S.p.A. Via G.A. Boltraffio 7 20159 Milano (MI) http://www.objectway.it <http://www.objectway.it/>=20 =09 =09 |