Interface Resource


  • public interface Resource
    A Resource provides an abstraction of any given object that can be retrieved using a HTTP request. The reason for having this abstraction is to simplify the interface with any given Resource.

    This is similar in design to a Container, however this is intended to handle a single resource. At any time a container may manage many resources all of which are resolved using a ResourceEngine implementation. So in essence this is used to identify a component that can handle a HTTP request routed by a resource engine.

    Author:
    Niall Gallagher
    • Method Detail

      • handle

        void handle​(Request req,
                    Response resp)
        This acts as the main processing method for the resources. Implementations are required to provide the functions that will process the Request and generate a suitable response for that request. This method is also responsible for closing and comitting the Response unless handed (chained) to another Resource.
        Parameters:
        req - the Request to be processed
        resp - the Response to be processed