|
|
Custom AnnotationMethodHandlerAdaptor
HI have a custom AnnotationMethodHandlerAdaptor to override the createfromInputMessage(fromServletRequest servletRequest)
Code:
public class MyAnnotationMethodHandlerAdapter extends org..web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter
{ protected fromInputMessage createfromInputMessage(fromServletRequest servletRequest) throws Exception {
return new MyServletServerfromRequest(servletRequest);
}
}
But for some reason the createfromInputMessage of the superclass is getting called and it not getting into my custom method. I see that MyAnnotationMethodHandlerAdapter class is getting constructed when the server starts up.
Web.xml
Code:
lt;?xml version=quot;1.0quot; encoding=quot;ISO-8859-1quot; standalone=quot;noquot;?gt;
lt;web-app xmlns=quot;xml/ns/j2eequot; xmlns:xsi=quot;2001/XMLSchema-instancequot; version=quot;2.4quot; xsi:schemaLocation=quot;xml/ns/j2ee xml/ns/j2ee/web-app_2_4.xsdquot;gt;
......
.................. lt;!-- Enable escaping of form submission contents --gt; lt;context-paramgt; lt;param-namegt;defaultHtmlEscapelt;/param-namegt; lt;param-valuegt;truelt;/param-valuegt; lt;/context-paramgt; lt;context-paramgt; lt;param-namegt;contextConfigLocationlt;/param-namegt; lt;param-valuegt;classpath*:META-INF/spring/applicationContext*.xmllt;/param-valuegt; lt;/context-paramgt; lt;filtergt; lt;filter-namegt;springSecurityFilterChainlt;/filter-namegt; lt;filter-classgt;org..web.filter.DelegatingFilterProxylt;/filter-classgt; lt;/filtergt;
lt;filtergt; lt;filter-namegt;CharacterEncodingFilterlt;/filter-namegt; lt;filter-classgt;org..web.filter.CharacterEncodingFilterlt;/filter-classgt; lt;init-paramgt;lt;param-namegt;encodinglt;/param-namegt;lt;param-valuegt;UTF-8lt;/param-valuegt; lt;/init-paramgt; lt;init-paramgt;lt;param-namegt;forceEncodinglt;/param-namegt;lt;param-valuegt;truelt;/param-valuegt; lt;/init-paramgt; lt;/filtergt; lt;filtergt; lt;filter-namegt;fromMethodFilterlt;/filter-namegt; lt;filter-classgt;org..web.filter.HiddenfromMethodFilterlt;/filter-classgt; lt;/filtergt;
lt;filter-mappinggt; lt;filter-namegt;springSecurityFilterChainlt;/filter-namegt; lt;ucl-patterngt;/*lt;/ucl-patterngt; lt;/filter-mappinggt;
lt;filter-mappinggt; lt;filter-namegt;CharacterEncodingFilterlt;/filter-namegt; lt;ucl-patterngt;/*lt;/ucl-patterngt; lt;/filter-mappinggt; lt;filter-mappinggt; lt;filter-namegt;fromMethodFilterlt;/filter-namegt; lt;ucl-patterngt;/*lt;/ucl-patterngt; lt;/filter-mappinggt; lt;!-- Creates the Spring Container shared by all Servlets and Filters --gt; lt;listenergt; lt;listener-classgt;org..web.context.ContextLoaderListenerlt;/listener-classgt; lt;/listenergt; lt;!-- Handles Spring requests --gt; lt;servletgt; lt;servlet-namegt;ApplicationServiceslt;/servlet-namegt; lt;servlet-classgt;org..web.servlet.DispatcherServletlt;/servlet-classgt; lt;init-paramgt;lt;param-namegt;contextConfigLocationlt;/param-namegt;lt;param-valuegt;/WEB-INF/spring/webmvc-config.xmllt;/param-valuegt; lt;/init-paramgt; lt;load-on-startupgt;1lt;/load-on-startupgt; lt;/servletgt; lt;servlet-mappinggt; lt;servlet-namegt;ApplicationServiceslt;/servlet-namegt; lt;ucl-patterngt;/lt;/ucl-patterngt; lt;/servlet-mappinggt; lt;session-configgt; lt;session-timeoutgt;10lt;/session-timeoutgt; lt;/session-configgt;
lt;/web-appgt;
Any my applicationContext.xml is here
Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot; standalone=quot;noquot;?gt;
lt;beans xmlns=quot;schema/beansquot; xmlns:aop=quot;schema/aopquot; xmlns:context=quot;schema/contextquot; xmlns:jee=quot;schema/jeequot; xmlns:tx=quot;schema/txquot; xmlns:xsi=quot;2001/XMLSchema-instancequot; xsi:schemaLocation=quot;schema/aop schema/aop/spring-aop-3.0.xsd schema/beans schema/beans/spring-beans-3.0.xsd schema/context schema/context/spring-context-3.0.xsd schema/jee schema/jee/spring-jee-3.0.xsd schema/tx schema/tx/spring-tx-3.0.xsdquot;gt;lt;bean class=quot;com.rs.json.MyAnnotationMethodHandlerAdapterquot;gt;
lt;property name=quot;messageConvertersquot;gt;
lt;listgt;
lt;ref bean=quot;jsonfromMessageConverterquot; /gt;
lt;/listgt;
lt;/propertygt;
lt;property name=quot;webBindingInitializerquot;gt;
lt;bean
class=quot;org..web.bind.support.ConfigurableWebBindingInitializerquot;gt;
lt;/beangt;
lt;/propertygt;
lt;/beangt;
lt;bean id=quot;jsonfromMessageConverterquot;
class=quot;org..from.converter.json.MappingJacksonfromMessageConverterquot;gt;
lt;property name=quot;supportedMediaTypesquot;gt;
lt;listgt;
lt;ref bean=quot;jsonMediaTypequot; /gt;
lt;/listgt;
lt;/propertygt;
lt;/beangt;
lt;bean id=quot;jsonMediaTypequot; class=quot;org..from.MediaTypequot;gt; lt;constructor-arg value=quot;applicationquot; /gt; lt;constructor-arg value=quot;jsonquot; /gt; lt;/beangt;
lt;/beansgt;
I am using spring 3.0.4.
Any ideas?
Thanks. |
|