Announcement Announcement Module
Collapse
No announcement yet.
ContentNegotiatingViewResolver with multiple mediaTypes Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ContentNegotiatingViewResolver with multiple mediaTypes

    I want my restful server to support both json & xml data mapping - currently I am using the JacksonToJson Serializer for the json conversions - how would I define a xml serializer for the same data objects that are used in the json conversion?
    my servelt.xml looks like this:
    Code:
    <mvc:annotation-driven />
    	<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
    		<property name="mediaTypes">
    		  	<map>
    		          <entry key="json" value="application/json"/>
    		       </map> 	
    		</property>  
    		<property name="viewResolvers">
    			<list>
    				<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
    				<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    				   <property name="viewClass" value="org.springframework.web.servlet.view.JstlView">     </property>
    				   <property name="prefix" value="/WEB-INF/jsp/"/>
    				   <property name="suffix" value=".jsp"/>
    			        </bean>
    			</list>
    		</property>
    	</bean>
    Thanks
Working...
X