1 18 package org.apache.activemq.web.handler; 19 20 import org.apache.commons.logging.Log; 21 import org.apache.commons.logging.LogFactory; 22 import org.springframework.web.bind.ServletRequestDataBinder; 23 import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping; 24 25 import javax.servlet.http.HttpServletRequest ; 26 27 31 public class BindingBeanNameUrlHandlerMapping extends BeanNameUrlHandlerMapping { 32 private static final transient Log log = LogFactory.getLog(BindingBeanNameUrlHandlerMapping.class); 33 34 protected Object getHandlerInternal(HttpServletRequest request) throws Exception { 35 Object object = super.getHandlerInternal(request); 36 37 if (object instanceof String ) { 38 String handlerName = (String ) object; 39 object = getApplicationContext().getBean(handlerName); 40 } 41 42 ServletRequestDataBinder binder = new ServletRequestDataBinder(object, "request"); 43 binder.bind(request); 44 binder.setIgnoreUnknownFields(true); 45 if (log.isDebugEnabled()) { 46 log.debug("Bound POJO is now: " + object); 47 } 48 return object; 49 } 50 51 } 52 | Popular Tags |