spring - restTemplate java.lang.IllegalArgumentException: "None" does not contain '/' -


ok first of code (its mega simple):

@controller @requestmapping("/")  public class hellocontroller {  private final static logger logger = logger.getlogger(hellocontroller.class); @requestmapping(method = requestmethod.get) public string printwelcome(modelmap model) {      logger.info("elo elo");     model.addattribute("message", "hello world!");      resttemplate resttemplate = new resttemplate();      string url = "http://192.168.0.200:8000/gpio/11/function/in";     //string url = "http://192.168.0.200:8000/gpio/11/function";     //resttemplate.getforobject(url, string.class);     string test = "";      resttemplate.postforobject(url, null, string.class);        logger.info(test);     return "hello"; } 

next example i'm not crazy man here response postman (chrome):

enter image description here

and @ end full error log:

type exception report

message request processing failed; nested exception java.lang.illegalargumentexception: "none" not contain '/'

description server encountered internal error prevented fulfilling request.

exception

org.springframework.web.util.nestedservletexception: request processing failed; nested exception java.lang.illegalargumentexception: "none" not contain '/' org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:927) org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:811) javax.servlet.http.httpservlet.service(httpservlet.java:618) org.springframework.web.servlet.frameworkservlet.service(frameworkservlet.java:796) javax.servlet.http.httpservlet.service(httpservlet.java:725) org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) root cause

java.lang.illegalargumentexception: "none" not contain '/' org.springframework.http.mediatype.parsemediatype(mediatype.java:697) org.springframework.http.httpheaders.getcontenttype(httpheaders.java:305) org.springframework.web.client.httpmessageconverterextractor.getcontenttype(httpmessageconverterextractor.java:113) org.springframework.web.client.httpmessageconverterextractor.extractdata(httpmessageconverterextractor.java:84) org.springframework.web.client.resttemplate.doexecute(resttemplate.java:492) org.springframework.web.client.resttemplate.execute(resttemplate.java:447) org.springframework.web.client.resttemplate.postforobject(resttemplate.java:295) pl.piquarium.mvc.hellocontroller.printwelcome(hellocontroller.java:35) sun.reflect.nativemethodaccessorimpl.invoke0(native method) sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) java.lang.reflect.method.invoke(method.java:606) org.springframework.web.bind.annotation.support.handlermethodinvoker.invokehandlermethod(handlermethodinvoker.java:176) org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter.invokehandlermethod(annotationmethodhandleradapter.java:439) org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter.handle(annotationmethodhandleradapter.java:427) org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:925) org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:856) org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:915) org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:811) javax.servlet.http.httpservlet.service(httpservlet.java:618) org.springframework.web.servlet.frameworkservlet.service(frameworkservlet.java:796) javax.servlet.http.httpservlet.service(httpservlet.java:725) org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) note full stack trace of root cause available in apache tomcat/8.0.3 logs.

request headers:

accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 accept-encoding:gzip,deflate,sdch accept-language:pl-pl,pl;q=0.8,en-us;q=0.6,en;q=0.4 cache-control:max-age=0 connection:keep-alive cookie:__utma=212787668.2094541430.1400264829.1400264829.1400268775.2; __utmz=212787668.1400264829.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) host:192.168.0.200:8000 user-agent:mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/34.0.1847.137 safari/537.36 

response headers:

cache-control:no-cache content-length:2 content-type:none date:fri, 16 may 2014 22:37:16 gmt server:webiopi/0.7.0/python3.2 

did try setting headers below,

 httpheaders headers = new httpheaders();  headers.setcontenttype(mediatype.multipart_form_data);//or other required  httpentity request = new httpentity(null, headers);  resttemplate resttemplate = new resttemplate();  string url = "http://192.168.0.200:8000/gpio/11/function/in";  string response = resttemplate.postforobject(url,request,string.class); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -