REST-101 Flashcards
Which is the default factory to create the RestTemplate?
ClientHttpRequestFactory
What is GingerBread?
It is Google API for RTemp
Does RTemp supports GZIP Compression trxn
Yes
What is Google GSON
It is a Object to JSON marshalling
What is required for RTemp construction?
A MessageConvertor and a factory, Offcourse both choice has defaults set
What is the default Exception Handler ?
RestClientException
Does all HTTP methods throws REstClientException?
Yes
How do RTemp supports the GZIP compression?
By adding Accept-Encoding in the headers
For all HTTP methoda what are the general return types?
T, ResponseEntity, URI,
Just say the different Methid types?
GET, PUT, POST, OPTIONS, HEAD, POST
Why we require HttpMessageConverter
The Object are to and from converted to HTTPRequest to HTTPResponse
Say the methods of HttpMessageConverter?
boolean canRead(Class> clazz , Mediatype type) boolean canWrite(Class> clazz, MediaType type) List getSupportedMediaTypes() T read(Class> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException
T write(Class> clazz, HttpOutputMessage ouptputMessage) throws IOException, HttpMessageNotWritableException
How can you register your own MessageConverter?
By using messageconverters prop
Name the main MessageCoverters type?
ByteArrayHttpMessageConverter StringHttpMessageConverter ResourceHttpMessageConverter XmlAwareFormHttpMessageConverter FormHttpMessageConverter SimpleXmlHttpMessageConverter MappingJackson2HttpMessageConverter MappingJacksonHttpMessageConverter
Does by default all messagecoverters available?
Nope, by default, ByteArray,String & ResourceHttpMessageCoverter is available
Generally which MessageConverters is used as interface?
HttpMessageConverter
What does ByteArraymessageConverter does?
It supports the converter that read and write byte arrays ito and from Http Request-Response.
What is the content-type for ByteArraymessageConverter ?
application/octet-stream
Can we override the ByteArraymessageConverter meda type?
Yes you can override the supportedMedia Types and override getContentType(byte[])
Whish converter helps for eriting to and fro for the form data in http request-response cycle?
FormHttpmessageConverter
How does a form data is read -write in http request-response cycle?
MultiValueMap
What is the content-type for FormHttpMessageConverter?
application/x-www-form-urlencoded
How can we have XMLMessgaeConverter?
You can have XMLAwareFormHttpMessageConverter, add support through SourceHttpMessageConverter
what is default way of showing all content-type
text/*, text/plain as output