Appendix C. Chapter 7 server-side setup and summary

 

This appendix covers

  • Working with server objects and tasks
  • Setting up Spring MVC for the chapter 7 project
  • Using Spring annotations in the chapter 7 project

As mentioned in chapter 7, you can choose to use any server-side technology you want for the end-of-the-chapter project. If you’re interested in setting up Spring MVC for that project, this appendix provides details. It also covers the annotations used. The complete code is available for download.

In case you decide to use a completely different tech stack, this appendix also summarizes the task(s) each call is performing so it’s easier to make the translation. Keep in mind that the project uses RESTful services, so the back-end technology you use must support REST either directly or indirectly via a third-party library/plugin.

C.1. Server-side objects

Only two data objects are used in the project: a ShoppingCart object and a Game object. Each shopping cart holds a collection of games (see figure C.1). The Game object is standalone and can be used independently of the ShoppingCart object.

Figure C.1. The shopping cart has a list of items that holds a number of games ranging from 0 to n.

You also use an object on the server to hold information about any errors that occur (see figure C.2). The message field is for any error that’s OK to display to the user. In addition to any server-side exception handling, exceptions are sent back to the UI in the exceptionText field.

C.2. Summary of server-side calls

C.3. The project