Reading JSON input in spring MVC application - Issue with emaild -
am trying pass emaild in request params..
while reading in controller class getting below exception..
[ catch exception : error message: unexpected end-of-input: expecting closing quote string value @ [source: java.io.stringreader@200a200a; line: 1, column: 195] ] http://localhost:8080/appln/fetch/ ipdata={"date":"2013-10-05","emailid":"my.email.com@gmail.com"} if have emailid "myemailcom@gmailcom" ..it works well...
my controller code looks kind of ..
objectmapper mapper = new objectmapper(); mapper.readvalue(ipdatastring,inputrequestbean.class); --
what getting is...
{"date":"2013-10-05","emailid":"my
and bean
public class inputrequestbean { private string date; private string emailid; /** * @return date */ public string getdate() { return date; } /** * @param date date set */ public void setdate(string date) { this.date = date; } /** * @return emailid */ public string getemailid() { return emailid; } /** * @param emailid emailid set */ public void setemailid(string emailid) { this.emailid = emailid; } }
did googling..and fix worked..
@requestmapping(value = "/appln/fetch/{ipdata:.+}", method = requestmethod.get)
spring doc...: http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping-uri-templates-regex
Comments
Post a Comment