Text after
, using spring:
from the list & lt; HttpMessageConverter & lt; & Gt; & Gt; MessageConverters = restTemplate.getMessageConverters (); {HttpMessageConverter httpMessageConverter: messageConverters} for {System.out.println (httpMessageConverter); Response I & lt; ProductList & gt; ProductList = restTemplate.getForEntity (Product DataUrl, ProductList.class);
I
org.springframework.http.converter.ByteArrayHttpMessageConverter@34649ee4 org.springframework.http.converter.StringHttpMessageConverter@39fba59b org.springframework.http. Knwartrkresursehttpmessgesonvertr @ 383580da org.स्प्रिंगफरमेवोर्क.एचटीटीपी.कनवर्टर.क्मल.सौरसेह्तटप्मेस्सगेसोन्वेर्टर@409e850a org.स्प्रिंगफरमेवोर्क.एचटीटीपी.कनवर्टर.सपोर्ट.अलंकपसिन्गफोरमह्त्तपमेस्सगेसोनवेर्टर@673074aa org.स्प्रिंगफरमेवोर्क.एचटीटीपी.कनवर्टर.क्मल.जस्ब2RootElementHttpMessageConverter@1e3b79d3 Orgkspringfrmevork.actiteepi. Converter.json.MappingJackson2HttpMessageConverter @ 52bb1b26 org.springframework.web.client.RestClientException: The response could not be isolated: found text for a suitable HttpMessageConverter response type [class com.mycopmany.ProductList] and content type [text / html ; Charset = UTF-8]
A piece of POJO:
@XmlRootElement (name = "TheProductList") public class productlist {@XmlElement (expected = True, name = "date") Private local data e-importdate;
From a spring point of view, Any If you can control the server response, then it will be sent from If you do not control the server response, you will need to register and register any of the HttpMessageConverter
In the examples registered with RestTemplate
, you can convert text / html
content to ProductList
objects. The method of interest can be http messaging converter # can read (class, mediatype)
. Implementation for all the above returns is false
, which includes Jaxb2RootElementHttpMessageConverter
. HttpMessageConverter
can read your HTTP response, processing with no exception fails. content-type
to application / xml
, text / xml
, Or some mailing application / * + xml
. HttpMessageConverter for your own
(can expand the spring classes, see For AbstractXmlHttpMessageConverter
and its sub class) which can read and change text / html
.
Comments
Post a Comment