No doubts java.io.EOFException
appears on the server side. If you use keep-alive on your server side - switch it off like this:
HttpHeaders headers = new HttpHeaders();
headers.set("Connection", "Close");
or this: System.setProperty("http.keepAlive", "false");
Another solution is changing the http client.In Spring for Android the default HTTP Client for a RestTemplate
is determined by the version of Android on the device. API 9 or newer uses HttpURLConnection
, older uses HTTPClient
. To explicitly set the client to the old one, use
yourRestTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory());
Please refer this:http://static.springsource.org/spring-android/docs/1.0.1.RELEASE/reference/htmlsingle/#d4e34
Spring RestTemplate
is not an ideal REST client and unfortunately there are a lot of problems with it in production code.