<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=benoit.heurter" rel="nofollow">Benoit Heurter</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-3640?redirect=false" rel="nofollow">SPR-3640</a></strong> and commented</p>
<p dir="auto">Method buildTypedStringValueForMap of class BeanDefinitionParserDelegate is private.  Because of that, i cannot create a sub-class of BeanDefinitionParserDelegate with my slightly modified version of parseMapElement method.</p>
<p dir="auto">It's not blocker as i duplicated whole te code but it seems easier if i could re-use original methods</p>
<p dir="auto">Could you please change methods below to protected ?</p>
<p dir="auto">buildTypedStringValueForMap<br>
buildTypedStringValue</p>
<p dir="auto">Thank you in advance</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.6</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=brucelowe" rel="nofollow">Bruce Lowe</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6833?redirect=false" rel="nofollow">SPR-6833</a></strong> and commented</p>
<p dir="auto">I have a controller with a methods defined as such</p>
<p dir="auto"><code class="notranslate">@RequestMapping</code>(value = "/services/{serviceName}/scenes/", method = RequestMethod.POST)<br>
public void addScene(<code class="notranslate">@PathVariable</code>("serviceName") String serviceName,<br>
<code class="notranslate">@RequestBody</code> SceneTO receivedSceneTO, HttpServletRequest request, HttpServletResponse response)<br>
{<br>
...<br>
}</p>
<p dir="auto">It is designed to be able to POST "SceneTO"s to.   I have made a smart custom message converters so people can submit VideoScenes, AudioScenes, TextScenes etc.  The convertor will create the appropriate SceneTO inheriting object.</p>
<p dir="auto">However, i get this exception:</p>
<p dir="auto">java.lang.IllegalArgumentException: argument type mismatch<br>
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br>
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br>
at java.lang.reflect.Method.invoke(Method.java:597)<br>
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)<br>
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)<br>
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)<br>
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)<br>
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)<br>
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)<br>
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)<br>
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)<br>
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)<br>
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)<br>
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)<br>
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)<br>
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:71)<br>
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)<br>
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)<br>
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)<br>
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)<br>
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)<br>
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)<br>
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)<br>
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)<br>
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)<br>
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)<br>
at org.mortbay.jetty.Server.handle(Server.java:324)<br>
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)<br>
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)<br>
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)<br>
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)<br>
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)<br>
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)<br>
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)</p>
<p dir="auto">If I change my convertor to ONLY create SceneTO objects (instead of an inheriting one), it works fine. The method clearly does not support inheritance</p>
<p dir="auto">We can currently work around the problem by doing this</p>
<p dir="auto"><code class="notranslate">@RequestMapping</code>(value = "/services/{serviceName}/scenes/video", method = RequestMethod.POST)<br>
public void addScene(<code class="notranslate">@PathVariable</code>("serviceName") String serviceName,<br>
<code class="notranslate">@RequestBody</code> VideoTO receivedSceneTO, HttpServletRequest request, HttpServletResponse response)<br>
and<br>
<code class="notranslate">@RequestMapping</code>(value = "/services/{serviceName}/scenes/audio", method = RequestMethod.POST)<br>
public void addScene(<code class="notranslate">@PathVariable</code>("serviceName") String serviceName,<br>
<code class="notranslate">@RequestBody</code> AudioTO receivedSceneTO, HttpServletRequest request, HttpServletResponse response)</p>
<p dir="auto">But it does seem less clean and results in much duplicated code.  Allowing inheritance would seem much more elegant.  (I imagine some other people may want interfaces as well)</p>
<hr>
<p dir="auto">No further details from <a href="https://jira.spring.io/browse/SPR-6833?redirect=false" rel="nofollow">SPR-6833</a></p>