Exam 2v0-7222 All QuestionsBrowse all questions from this exam
Question 19

Which two statements are true regarding the RestTemplate class? (Choose two.)

    Correct Answer: B, C

    The RestTemplate class is designed to facilitate communication with HTTP servers, making it easier to send and receive data over the network. It automatically supports sending and receiving Java objects by leveraging message converters, which can handle serialization and deserialization to various formats such as JSON and XML. Additionally, RestTemplate provides convenience methods for making RESTful HTTP requests, such as GET, POST, PUT, and DELETE, which simplifies the process of writing REST clients.

Discussion
EymetOptions: BC

B. It automatically supports sending and receiving Java objects. True. RestTemplate is designed to work with Java objects and can automatically serialize and deserialize them to and from HTTP request and response bodies using message converters. You can configure it to work with different data formats such as JSON or XML. C. It provides convenience methods for writing REST clients. True. RestTemplate provides various convenience methods for making HTTP requests to RESTful services, including GET, POST, PUT, DELETE, etc. It simplifies the process of making REST calls.

james2033Options: BC

E is wrong. See https://www.baeldung.com/rest-template . Custom header RestTemplate https://stackoverflow.com/a/32623548/3728901 https://www.baeldung.com/rest-template#exchange_post-1 Admin please correct "Correct Answer".

qqooOptions: BC

Answer is BC

zakupowerOptions: BC

RestTemplate supports sending custom headers using exchange method with HttpEntity object.