Skip to content

Instantly share code, notes, and snippets.

@rokon12
Created March 12, 2013 08:57
Show Gist options
  • Save rokon12/5141291 to your computer and use it in GitHub Desktop.
Save rokon12/5141291 to your computer and use it in GitHub Desktop.
<bean
class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes">
<map>
<entry key="json" value="application/json"/>
<entry key="xml" value="text/xml"/>
<entry key="htm" value="text/html"/>
</map>
</property>
<property name="favorParameter" value="true"/>
<property name="favorPathExtension" value="false"/>
<property name="ignoreAcceptHeader" value="true"/>
<property name="defaultContentType" value="application/json"/>
</bean
@RequestMapping(method = RequestMethod.GET, produces = "application/json")
@ResponseBody
public List<Content> findAll() {
return contentService.getAllContents();
}
dependency :
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.12</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.12</version>
</dependency>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment