ResponseBody « MVC « Spring Q&A





1. Spring MVC 3 - How come @ResponseBody method renders a JSTLView?    stackoverflow.com

I have mapped one of my method in one Controller to return JSON object by @ResponseBody.

@RequestMapping("/{module}/get/{docId}")
public @ResponseBody Map<String, ? extends Object> get(@PathVariable String module,
        ...

2. How to use @ResponseBody and @RequestBody?    stackoverflow.com

I reading spring 3.0.x reference but I don't know how to use ,can you paste a full example?

3. @ResponseBody unexpected format    stackoverflow.com

I have a Spring MVC controller for my plain-old-xml web service with the following method:

@RequestMapping(
        value = "/trade/{tradeId}",
       ...

4. use spring mvc3 @ResponseBody had 415 Unsupported Media Type why?    stackoverflow.com

spring xml:

  <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
    <property name="mediaTypes">
        <map>
            <entry key="atom" ...

5. Spring configure @ResponseBody JSON format    stackoverflow.com

Imagine I have this annotated method in a Spring 3 @Controller

@RequestMapping("")
public @ResponseBody MyObject index(@RequestBody OtherObject obj) {
    MyObject result = ...;
    return result;
}
But I need ...

6. Spring MVC 3: Returning XML through @ResponseBody    stackoverflow.com

Pardon me for posting this noob question, but I have been debugging this problem for quite awhile now. I'm having a little problem trying to get the response to return the ...

7. Custom HttpMessageConverter with @ResponseBody to do Json things    stackoverflow.com

I don't like Jackson. I want to use ajax but with Google Gson. So I'm trying to figure out how to implement my own HttpMessageConverter to use it with @ResponseBody annotation. Can someone take ...

8. Spring-Returning json with @ResponseBody when the Accept header is */* throws HttpMediaTypeNotAcceptableException    stackoverflow.com

I'm using spring 3.0.0. I have an endpoint that returns an object that I want to be serialized to JSON. When the request comes in with Accept: application/json, it works correctly. ...

9. Spring MVC: using @ResponseStatus(reason = '') on a @ResponseBody exception handler in tomcat    stackoverflow.com

Does anybody know why I cannot use @ResponseStatus(reason = "My message") on an exception handler in spring MVC while still returning a @ResponseBody. What seems to happen is that if I ...





10. Spring MVC: How to return image in @ResponseBody?    stackoverflow.com

I'm getting image data (as byte[]) from DB. How to return this image in @ResponseBody ? EDIT I did it without @ResponseBody using HttpServletResponse as method parameter:

@RequestMapping("/photo1")
public void photo(HttpServletResponse response) throws IOException {
 ...

11. Spring MVC: strange @ResponseBody behavior    stackoverflow.com

Hello I've got hierarchy B extends A. A has property valueA, B has property valueB. Spring MVC example method public @ResponseBody A justTesting() {
...

12. Spring 3: @ResponseBody - How to control the response to get the XML or JSON?    stackoverflow.com

I'm using <mvc:annotation-driven /> Spring (3.0) configuration (without ContentNegotiatingViewResolver). According to the documentation Spring 3 supports JSON and XML. Using @ResponseBody on handler method like below gives ...

13. @ResponseBody Serialization Error using ArrayLists    stackoverflow.com

I am getting the following error trying to return my object as a JSON string using SpringMVC @ResponseBody: org.codehaus.jackson.map.JsonMappingException: No serializer found for class com.ResourceResultSetCol and no properties discovered to create BeanSerializer ...

14. How to force spring's @ResponseBody to use xmlConvertor    stackoverflow.com

When I return a single object from a controller like this,

@ResponseBody 
public MyClass module(...) {
...
}
I get the xml output on the client and log shows like this,
2011-09-07 18:22:06,963 [qtp1409490836-27] ...

15. Spring MVC @ResponseBody returning a Map produces "Error 406 NOT ACCEPTABLE"    stackoverflow.com

I'm having a problem trying to set up @ResponseBody to return a collection. I have JAXB jars in the classpath and I didn't set up any ContentNegotiatingViewResolver. This is my simple object:-

16. @ResponseBody not producing XML in Java 6    stackoverflow.com

I have a Spring MVC 3/J2EE Project. The jsp rendering controllers are working fine, but the one controller that renders XML for Ajax is not working. I am using ...





17. [Spring MVC] Extending JSON binding behavior with @ResponseBody    forum.springsource.org

[Spring MVC] Extending JSON binding behavior with @ResponseBody Hi to all, I'm currently using Spring MVC 3.0 with ExtJS and I'm trying to find a way to customize my JSON binding ...

18. spring-test-mvc and @Requestbody/@Responsebody    forum.springsource.org

spring-test-mvc and @Requestbody/@Responsebody I want to test a controller using the MockMvc class (which i installed from the spring-test-mvc project, as it is not yet included into the latest spring version) ...