vendredi 17 avril 2015

spring The request sent by the client was syntactically incorrect() issue

I am getting exception mentioned in subject line. Could you please explain what is wrong:



package mvc;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/req")
public class Req {
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public String get(@RequestBody String body) {
return body;
}
}


SpringMVC-servlet.xml



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
xmlns:xsi="http://ift.tt/ra1lAU"
xmlns:util="http://ift.tt/OGfeTW"
xmlns:context="http://ift.tt/GArMu7"
xmlns:mvc="http://ift.tt/1bHqwjR"
xsi:schemaLocation="http://ift.tt/GArMu6 http://ift.tt/1jdM0fG
http://ift.tt/OGfeTW http://ift.tt/1feTls0
http://ift.tt/GArMu7 http://ift.tt/1jdLYo7
http://ift.tt/1bHqwjR http://ift.tt/JWpJWM">
<!--It tells the Spring framework to look for annotations and then do appropriate dependency injections.-->
<context:annotation-config/>
<!--used to provide base package to scan components-->
<context:component-scan base-package="mvc"/>

<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>


</beans>


When i tries to access http://localhost:8080/SpringMVC/req



HTTP Status 400 -

type Status report

message

description The request sent by the client was syntactically incorrect ().
Apache Tomcat/7.0.16


Kindly help me in figure out the cause of this issue.


Thanks, Sandip


Aucun commentaire:

Enregistrer un commentaire