356 CHAPTER (Web site development) 11 REST-BASED MODEL VIEW CONTROLLER
356 CHAPTER 11 REST-BASED MODEL VIEW CONTROLLER PATTERN While I was explaining the Extension pattern, I recommended that you use interfaces to perform typecasts, but in this case there are only the base Requestand Result interfaces. There are no SearchResult and SearchRequest interfaces because the classes SearchResult and SearchRequest are specific to the domain of searching. The likelihood that the classes SearchResult and SearchRequest would be used in a different context is fairly unlikely. Though we still want to implement the Extension pattern, we don t need to use an interface, but can use an interface and a class declaration. The other item to note is that both SearchResult and SearchRequest are immutable types. An immutable type is a type that once assigned cannot be modified. In the case of SearchResult and SearchRequest, the data members are assigned in the constructor. The only methods exposed allow the retrieval of the data members, but not modification or assignment. Putting All of the Pieces Together The final step after defining the architecture and implementing the individual pieces is to put everything together into a working solution that can be called a REST-Based Model View Controller pattern. From an architectural perspective, a Java servlet or ASP.NET handler will interact with a Parent implementation. The Parent implementation is what pulls everything together and defines the model, view, and controller. Putting it all together, the architecture would appear similar to Figure 11-8. Figure 11-8. Architecture with all of the pieces assembled The UML diagram in Figure 11-8 looks complicated, but it can be separated into two blocks of functionality. There is an inner circle of interfaces and an outer circle of implementations. The inner circle has the types Request, Result, Parent, and Command. The outer circle has the types Amazon, Google, SearchResult, SearchRequest, ParentImpl, HttpServlet, and AsynchronousServlet.
You want to have a cheap webhost for your apache application, then check apache web hosting services.