i have need use httpclient set parameters while using spring's resttemplate.
i via:
httpclient httpclient = new httpclient(); httpclient.getparams().setsotimeout(prefs.getservertimeout()); httpclient.getparams().setconnectionmanagertimeout(3000); httpclient.getparams().setcontentcharset("utf-8"); httpclient.getparams().setcredentialcharset("iso-8859-1", ) ... commonsclienthttprequestfactory requestfactory = new commonsclienthttprequestfactory(httpclient); requestfactory.setreadtimeout(prefs.getservertimeout()); resttemplate resttemplate = new resttemplate(requestfactory);
the httpclient used everywhere, , example in
httpcomponentsclienthttprequestfactory.gethttpclient()
is pointing deprecated 1 shipped android.
since it's deprecated, , removed android in 6.0, how go continuing use httpclient object resttemplate?
since share same package (org.apache.http.client), i'm not sure how make work in pre/post 6.0.
(i tried using httpclient-android , httpcomponentsclienthttprequestfactory without setting httpclient, , seems using closeablehttpclient. method signature deprecated httpclient mentioned.)
pointers appreciated.
you can add it's dependency explicitly in gradle or add jar try considering modern options volley 'com.android.volley:volley:1.0.0'
or okhttp 'com.squareup.okhttp3:okhttp:3.4.1'
or can use rest-template android 'org.springframework.android:spring-android-rest-template:2.0.0.m3'
.
Comments
Post a Comment