Announcement Announcement Module
Collapse
No announcement yet.
SourceHttpMessageConverter doesn't work with transform sublcasses Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SourceHttpMessageConverter doesn't work with transform sublcasses

    I'm writing a simple project using Spring MVC. I have a Controller with a handler method annotated with @ResponseBody that returns a javax.xml.transform.Source. In my handler method, I return a org.apache.axiom.om.impl.jaxp.OMSource object. OMSource extends javax.xml.transform.sax.SAXSource. After I return this result, I see org.springframework.http.converter.xml.SourceHttpM essageConverter check to see if it supports my result (all as expected so far). However, SourceHttpMessageConverter checks whether it can support the result by checking to see if the concrete class is one of DOMSource, SAXSource, StreamSource, or Source. Its checks look like:

    Code:
    return DOMSource.class.equals(clazz) || SAXSource.class.equals(clazz) || StreamSource.class.equals(clazz) ||
    				Source.class.equals(clazz);
    This fails since my result's concrete class is not one of these, though my result's class does extend one of these (SAXSource). Should SourceHttpMessageConverter work with subclasses of the types mentioned above?

    Thanks very much in advance!
Working...
X