Client is the king
We will allow third-party clients to retrieve the search results via a REST API. These results will be available either in JSON or XML.
We want to handle requests of the /api/search/mixed;keywords=springFramework
form. This is really similar to the search form we already made, except that the request path begins with api
. Every URI found in this namespace should return binary results.
Let's create a new SearchApiController
class in the search.api
package:
package masterSpringMvc.search.api; import masterSpringMvc.search.SearchService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.social.twitter.api.Tweet; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController ...
Get Spring MVC: Designing Real-World Web Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.