As with previously defined classes, we will define a responder class, RestResponder, which resides under web.responder.rest. One of our first tasks is to determine the HTTP request method and the content type accepted by the client making the request. We can do this easily by examining the headers in the incoming request.
Our new REST responder activates a strategy that returns the response using the desired JSON formatting. So, before diving into the responder class, let's digress and examine the base class and three strategy classes, which reside under web.responder.strategy.
Please refer to the following links for more information:
- HTTP request method: https://tools.ietf.org/html/rfc2616#section-5.1.1
- Strategy pattern: https://en.wikipedia.org/wiki/Strategy_pattern