java - How is HTTP Header set in Spring RestTemplate? -


i wanted plain string, not json. code @ client side:

httpheaders headers = new httpheaders();  headers.setaccept(collections.singletonlist(mediatype.text_plain)); httpentity<string> entity = new httpentity<string>("", headers); resttemplate resttemplate = new resttemplate();  responseentity<string> tickerresponse = resttemplate.exchange(servicebase, httpmethod.get, entity,string.class); 

it works in local unit test. log looks like:

08:24:46,291 debug resttemplate:598 - setting request accept header [text/plain, /]

however, doesn't work in tomcat, log was:

08:20:48,362 debug resttemplate:598 - setting request accept header [application/json, application/*+json, text/plain, /]

i guess resttemplate set accept header json default when running in tomcat 8. how clean default settings?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -