java - Spring MVC Rest service consume JSON -


i trying create , rest api spring mvc consumes json:

controller:

@restcontroller public class crawlercontroller {   @requestmapping(value = "/checkformarfeelizablesite", method = requestmethod.post) public responser checkformarfeelizablesites(@requestbody list<entry> list) {      // response     responser responser = new responser();     responser.setoperationresult(operationresult.ok);      (entry entry : list) {         system.out.println("entry: " + entry);     }      return responser; } } 

entry.class

public class entry {  string url;  public string geturl() {     return url; }  public void seturl(string url) {     this.url = url; }} 

web.xml:

<web-app>  <display-name>marfeel marfeelizable checker</display-name>  <!-- spring context --> <context-param>     <param-name>contextconfiglocation</param-name>     <param-value>/web-inf/marfeel-context.xml</param-value> </context-param>  <listener>     <listener-class>         org.springframework.web.context.contextloaderlistener     </listener-class> </listener>  <!-- servlet --> <servlet>     <servlet-name>marfeel-crawler-api</servlet-name>     <servlet-class>org.springframework.web.servlet.dispatcherservlet     </servlet-class>     <load-on-startup>1</load-on-startup> </servlet>  <!-- mapping --> <servlet-mapping>     <servlet-name>marfeel-crawler-api</servlet-name>     <url-pattern>/*</url-pattern> </servlet-mapping>  <!-- welcome file list --> <welcome-file-list>     <welcome-file>index.html</welcome-file> </welcome-file-list> 

i've added jackson lib (jackson-mapper-asl) in pom.xml, i'm receiving http 415 error

this sample of json i'm sending:

[{"url": "c­and­a.com"},{"url": "toshiba.es"}] 


Comments