├── 9781484274767.jpg ├── Chapter10 ├── Chapter_10_Postman_Collection.json └── quick-poll-ch10-final │ ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── encodings.xml │ ├── jarRepositories.xml │ ├── misc.xml │ └── runConfigurations.xml │ ├── pom.xml │ ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── apress │ │ │ ├── QuickPollApplication.java │ │ │ ├── controller │ │ │ ├── ComputeResultController.java │ │ │ ├── PollController.java │ │ │ └── VoteController.java │ │ │ ├── domain │ │ │ ├── Option.java │ │ │ ├── Poll.java │ │ │ └── Vote.java │ │ │ ├── dto │ │ │ ├── OptionCount.java │ │ │ └── VoteResult.java │ │ │ └── repository │ │ │ ├── OptionRepository.java │ │ │ ├── PollRepository.java │ │ │ └── VoteRepository.java │ │ └── resources │ │ ├── application.properties │ │ ├── import.sql │ │ ├── static │ │ └── .keep │ │ └── templates │ │ └── .keep │ └── target │ └── classes │ ├── application.properties │ ├── com │ └── apress │ │ ├── QuickPollApplication.class │ │ ├── controller │ │ ├── ComputeResultController.class │ │ ├── PollController.class │ │ └── VoteController.class │ │ ├── domain │ │ ├── Option.class │ │ ├── Poll.class │ │ └── Vote.class │ │ ├── dto │ │ ├── OptionCount.class │ │ └── VoteResult.class │ │ └── repository │ │ ├── OptionRepository.class │ │ ├── PollRepository.class │ │ └── VoteRepository.class │ ├── import.sql │ ├── static │ └── .keep │ └── templates │ └── .keep ├── Chapter3 └── hello-rest-ch3-final │ ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── encodings.xml │ ├── jarRepositories.xml │ ├── misc.xml │ └── runConfigurations.xml │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── apress │ │ └── hellorest │ │ └── HelloWorldRestApplication.java │ └── resources │ ├── application.properties │ ├── static │ └── .keep │ └── templates │ └── .keep ├── Chapter4 ├── Chapter4_Postman_Collection.json └── quick-poll-ch4-final │ ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── encodings.xml │ ├── jarRepositories.xml │ ├── misc.xml │ └── runConfigurations.xml │ ├── pom.xml │ ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── apress │ │ │ ├── QuickPollApplication.java │ │ │ ├── controller │ │ │ ├── ComputeResultController.java │ │ │ ├── PollController.java │ │ │ └── VoteController.java │ │ │ ├── domain │ │ │ ├── Option.java │ │ │ ├── Poll.java │ │ │ └── Vote.java │ │ │ ├── dto │ │ │ ├── OptionCount.java │ │ │ └── VoteResult.java │ │ │ └── repository │ │ │ ├── OptionRepository.java │ │ │ ├── PollRepository.java │ │ │ └── VoteRepository.java │ │ └── resources │ │ ├── application.properties │ │ ├── static │ │ └── .keep │ │ └── templates │ │ └── .keep │ └── target │ └── classes │ ├── application.properties │ ├── com │ └── apress │ │ ├── QuickPollApplication.class │ │ ├── controller │ │ ├── ComputeResultController.class │ │ ├── PollController.class │ │ └── VoteController.class │ │ ├── domain │ │ ├── Option.class │ │ ├── Poll.class │ │ └── Vote.class │ │ ├── dto │ │ ├── OptionCount.class │ │ └── VoteResult.class │ │ └── repository │ │ ├── OptionRepository.class │ │ ├── PollRepository.class │ │ └── VoteRepository.class │ ├── static │ └── .keep │ └── templates │ └── .keep ├── Chapter5 ├── Chapter_5_Postman_Collection.json └── quick-poll-ch5-final │ ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── encodings.xml │ ├── jarRepositories.xml │ ├── misc.xml │ └── runConfigurations.xml │ ├── pom.xml │ ├── quick-poll-ch4-final.iml │ ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── apress │ │ │ ├── QuickPollApplication.java │ │ │ ├── controller │ │ │ ├── ComputeResultController.java │ │ │ ├── PollController.java │ │ │ └── VoteController.java │ │ │ ├── domain │ │ │ ├── Option.java │ │ │ ├── Poll.java │ │ │ └── Vote.java │ │ │ ├── dto │ │ │ ├── OptionCount.java │ │ │ ├── VoteResult.java │ │ │ └── error │ │ │ │ ├── ErrorDetail.java │ │ │ │ └── ValidationError.java │ │ │ ├── exception │ │ │ └── ResourceNotFoundException.java │ │ │ ├── handler │ │ │ └── RestExceptionHandler.java │ │ │ └── repository │ │ │ ├── OptionRepository.java │ │ │ ├── PollRepository.java │ │ │ └── VoteRepository.java │ │ └── resources │ │ ├── application.properties │ │ ├── messages.properties │ │ ├── static │ │ └── .keep │ │ └── templates │ │ └── .keep │ └── target │ ├── classes │ ├── application.properties │ ├── messages.properties │ ├── static │ │ └── .keep │ └── templates │ │ └── .keep │ └── maven-status │ └── maven-compiler-plugin │ └── compile │ └── default-compile │ ├── createdFiles.lst │ └── inputFiles.lst ├── Chapter6 └── quick-poll-ch6-final │ ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── encodings.xml │ ├── jarRepositories.xml │ ├── misc.xml │ ├── runConfigurations.xml │ └── uiDesigner.xml │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── apress │ │ │ ├── QuickPollApplication.java │ │ │ ├── SwaggerConfiguration.java │ │ │ ├── controller │ │ │ ├── ComputeResultController.java │ │ │ ├── PollController.java │ │ │ └── VoteController.java │ │ │ ├── domain │ │ │ ├── Option.java │ │ │ ├── Poll.java │ │ │ └── Vote.java │ │ │ ├── dto │ │ │ ├── OptionCount.java │ │ │ ├── VoteResult.java │ │ │ └── error │ │ │ │ ├── ErrorDetail.java │ │ │ │ └── ValidationError.java │ │ │ ├── exception │ │ │ └── ResourceNotFoundException.java │ │ │ ├── handler │ │ │ └── RestExceptionHandler.java │ │ │ └── repository │ │ │ ├── OptionRepository.java │ │ │ ├── PollRepository.java │ │ │ └── VoteRepository.java │ └── resources │ │ ├── application.properties │ │ ├── messages.properties │ │ ├── static │ │ ├── .keep │ │ └── swagger-ui │ │ │ ├── css │ │ │ ├── reset.css │ │ │ └── screen.css │ │ │ ├── images │ │ │ ├── explorer_icons.png │ │ │ ├── logo_small.png │ │ │ ├── pet_store_api.png │ │ │ ├── throbber.gif │ │ │ └── wordnik_api.png │ │ │ ├── index.html │ │ │ ├── lib │ │ │ ├── backbone-min.js │ │ │ ├── handlebars-1.0.0.js │ │ │ ├── highlight.7.3.pack.js │ │ │ ├── jquery-1.8.0.min.js │ │ │ ├── jquery.ba-bbq.min.js │ │ │ ├── jquery.slideto.min.js │ │ │ ├── jquery.wiggle.min.js │ │ │ ├── shred.bundle.js │ │ │ ├── shred │ │ │ │ └── content.js │ │ │ ├── swagger-oauth.js │ │ │ ├── swagger.js │ │ │ └── underscore-min.js │ │ │ ├── o2c.html │ │ │ ├── swagger-ui.js │ │ │ └── swagger-ui.min.js │ │ └── templates │ │ └── .keep │ └── test │ └── java │ └── com │ └── apress │ └── QuickPollApplicationTests.java ├── Chapter7 ├── Chapter7_Postman_Collection.json ├── import.sql └── quick-poll-ch7-final │ ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── encodings.xml │ ├── jarRepositories.xml │ ├── misc.xml │ └── runConfigurations.xml │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── apress │ │ │ ├── QuickPollApplication.java │ │ │ ├── QuickPollMvcConfigAdapter.java │ │ │ ├── SwaggerConfiguration.java │ │ │ ├── domain │ │ │ ├── Option.java │ │ │ ├── Poll.java │ │ │ └── Vote.java │ │ │ ├── dto │ │ │ ├── OptionCount.java │ │ │ ├── VoteResult.java │ │ │ └── error │ │ │ │ ├── ErrorDetail.java │ │ │ │ └── ValidationError.java │ │ │ ├── exception │ │ │ └── ResourceNotFoundException.java │ │ │ ├── handler │ │ │ └── RestExceptionHandler.java │ │ │ ├── repository │ │ │ ├── OptionRepository.java │ │ │ ├── PollRepository.java │ │ │ └── VoteRepository.java │ │ │ ├── v1 │ │ │ └── controller │ │ │ │ ├── ComputeResultController.java │ │ │ │ ├── PollController.java │ │ │ │ └── VoteController.java │ │ │ └── v2 │ │ │ └── controller │ │ │ ├── ComputeResultController.java │ │ │ ├── PollController.java │ │ │ └── VoteController.java │ └── resources │ │ ├── application.properties │ │ ├── import.sql │ │ ├── messages.properties │ │ ├── static │ │ ├── .keep │ │ └── swagger-ui │ │ │ ├── css │ │ │ ├── reset.css │ │ │ └── screen.css │ │ │ ├── images │ │ │ ├── explorer_icons.png │ │ │ ├── logo_small.png │ │ │ ├── pet_store_api.png │ │ │ ├── throbber.gif │ │ │ └── wordnik_api.png │ │ │ ├── index.html │ │ │ ├── lib │ │ │ ├── backbone-min.js │ │ │ ├── handlebars-1.0.0.js │ │ │ ├── highlight.7.3.pack.js │ │ │ ├── jquery-1.8.0.min.js │ │ │ ├── jquery.ba-bbq.min.js │ │ │ ├── jquery.slideto.min.js │ │ │ ├── jquery.wiggle.min.js │ │ │ ├── shred.bundle.js │ │ │ ├── shred │ │ │ │ └── content.js │ │ │ ├── swagger-oauth.js │ │ │ ├── swagger.js │ │ │ └── underscore-min.js │ │ │ ├── o2c.html │ │ │ ├── swagger-ui.js │ │ │ └── swagger-ui.min.js │ │ └── templates │ │ └── .keep │ └── test │ └── java │ └── com │ └── apress │ └── QuickPollApplicationTests.java ├── Chapter8 ├── Chapter8_Postman_Collection.json ├── import.sql └── quick-poll-ch8-final-basic-auth │ ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── encodings.xml │ ├── jarRepositories.xml │ ├── misc.xml │ └── runConfigurations.xml │ ├── pom.xml │ ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── apress │ │ │ │ ├── QuickPollApplication.java │ │ │ │ ├── QuickPollMvcConfigAdapter.java │ │ │ │ ├── SecurityConfig.java │ │ │ │ ├── SwaggerConfiguration.java │ │ │ │ ├── domain │ │ │ │ ├── Option.java │ │ │ │ ├── Poll.java │ │ │ │ ├── User.java │ │ │ │ └── Vote.java │ │ │ │ ├── dto │ │ │ │ ├── OptionCount.java │ │ │ │ ├── VoteResult.java │ │ │ │ └── error │ │ │ │ │ ├── ErrorDetail.java │ │ │ │ │ └── ValidationError.java │ │ │ │ ├── exception │ │ │ │ └── ResourceNotFoundException.java │ │ │ │ ├── handler │ │ │ │ └── RestExceptionHandler.java │ │ │ │ ├── repository │ │ │ │ ├── OptionRepository.java │ │ │ │ ├── PollRepository.java │ │ │ │ ├── UserRepository.java │ │ │ │ └── VoteRepository.java │ │ │ │ ├── security │ │ │ │ └── QuickPollUserDetailsService.java │ │ │ │ ├── v1 │ │ │ │ └── controller │ │ │ │ │ ├── ComputeResultController.java │ │ │ │ │ ├── PollController.java │ │ │ │ │ └── VoteController.java │ │ │ │ ├── v2 │ │ │ │ └── controller │ │ │ │ │ ├── ComputeResultController.java │ │ │ │ │ ├── PollController.java │ │ │ │ │ └── VoteController.java │ │ │ │ └── v3 │ │ │ │ └── controller │ │ │ │ ├── ComputeResultController.java │ │ │ │ ├── PollController.java │ │ │ │ └── VoteController.java │ │ └── resources │ │ │ ├── application.properties │ │ │ ├── import.sql │ │ │ ├── messages.properties │ │ │ ├── static │ │ │ ├── .keep │ │ │ └── swagger-ui │ │ │ │ ├── css │ │ │ │ ├── reset.css │ │ │ │ └── screen.css │ │ │ │ ├── images │ │ │ │ ├── explorer_icons.png │ │ │ │ ├── logo_small.png │ │ │ │ ├── pet_store_api.png │ │ │ │ ├── throbber.gif │ │ │ │ └── wordnik_api.png │ │ │ │ ├── index.html │ │ │ │ ├── lib │ │ │ │ ├── backbone-min.js │ │ │ │ ├── handlebars-1.0.0.js │ │ │ │ ├── highlight.7.3.pack.js │ │ │ │ ├── jquery-1.8.0.min.js │ │ │ │ ├── jquery.ba-bbq.min.js │ │ │ │ ├── jquery.slideto.min.js │ │ │ │ ├── jquery.wiggle.min.js │ │ │ │ ├── shred.bundle.js │ │ │ │ ├── shred │ │ │ │ │ └── content.js │ │ │ │ ├── swagger-oauth.js │ │ │ │ ├── swagger.js │ │ │ │ └── underscore-min.js │ │ │ │ ├── o2c.html │ │ │ │ ├── swagger-ui.js │ │ │ │ └── swagger-ui.min.js │ │ │ └── templates │ │ │ └── .keep │ └── test │ │ └── java │ │ └── com │ │ └── apress │ │ └── UserGenerator.java │ └── target │ ├── classes │ ├── application.properties │ ├── com │ │ └── apress │ │ │ ├── QuickPollApplication.class │ │ │ ├── QuickPollMvcConfigAdapter.class │ │ │ ├── SecurityConfig.class │ │ │ ├── SwaggerConfiguration.class │ │ │ ├── domain │ │ │ ├── Option.class │ │ │ ├── Poll.class │ │ │ ├── User.class │ │ │ └── Vote.class │ │ │ ├── dto │ │ │ ├── OptionCount.class │ │ │ ├── VoteResult.class │ │ │ └── error │ │ │ │ ├── ErrorDetail.class │ │ │ │ └── ValidationError.class │ │ │ ├── exception │ │ │ └── ResourceNotFoundException.class │ │ │ ├── handler │ │ │ └── RestExceptionHandler.class │ │ │ ├── repository │ │ │ ├── OptionRepository.class │ │ │ ├── PollRepository.class │ │ │ ├── UserRepository.class │ │ │ └── VoteRepository.class │ │ │ ├── security │ │ │ └── QuickPollUserDetailsService.class │ │ │ ├── v1 │ │ │ └── controller │ │ │ │ ├── ComputeResultController.class │ │ │ │ ├── PollController.class │ │ │ │ └── VoteController.class │ │ │ ├── v2 │ │ │ └── controller │ │ │ │ ├── ComputeResultController.class │ │ │ │ ├── PollController.class │ │ │ │ └── VoteController.class │ │ │ └── v3 │ │ │ └── controller │ │ │ ├── ComputeResultController.class │ │ │ ├── PollController.class │ │ │ └── VoteController.class │ ├── import.sql │ ├── messages.properties │ ├── static │ │ ├── .keep │ │ └── swagger-ui │ │ │ ├── css │ │ │ ├── reset.css │ │ │ └── screen.css │ │ │ ├── images │ │ │ ├── explorer_icons.png │ │ │ ├── logo_small.png │ │ │ ├── pet_store_api.png │ │ │ ├── throbber.gif │ │ │ └── wordnik_api.png │ │ │ ├── index.html │ │ │ ├── lib │ │ │ ├── backbone-min.js │ │ │ ├── handlebars-1.0.0.js │ │ │ ├── highlight.7.3.pack.js │ │ │ ├── jquery-1.8.0.min.js │ │ │ ├── jquery.ba-bbq.min.js │ │ │ ├── jquery.slideto.min.js │ │ │ ├── jquery.wiggle.min.js │ │ │ ├── shred.bundle.js │ │ │ ├── shred │ │ │ │ └── content.js │ │ │ ├── swagger-oauth.js │ │ │ ├── swagger.js │ │ │ └── underscore-min.js │ │ │ ├── o2c.html │ │ │ ├── swagger-ui.js │ │ │ └── swagger-ui.min.js │ └── templates │ │ └── .keep │ └── test-classes │ └── com │ └── apress │ └── UserGenerator.class ├── Chapter9 └── quick-poll-ch9-final │ ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── encodings.xml │ ├── jarRepositories.xml │ ├── misc.xml │ └── runConfigurations.xml │ ├── pom.xml │ ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── apress │ │ │ │ ├── QuickPollApplication.java │ │ │ │ ├── QuickPollMvcConfigAdapter.java │ │ │ │ ├── SecurityConfig.java │ │ │ │ ├── SwaggerConfiguration.java │ │ │ │ ├── client │ │ │ │ ├── PageWrapper.java │ │ │ │ ├── QuickPollClient.java │ │ │ │ ├── QuickPollClientJdk.java │ │ │ │ ├── QuickPollClientV2.java │ │ │ │ └── QuickPollClientV3BasicAuth.java │ │ │ │ ├── domain │ │ │ │ ├── Option.java │ │ │ │ ├── Poll.java │ │ │ │ ├── User.java │ │ │ │ └── Vote.java │ │ │ │ ├── dto │ │ │ │ ├── OptionCount.java │ │ │ │ ├── VoteResult.java │ │ │ │ └── error │ │ │ │ │ ├── ErrorDetail.java │ │ │ │ │ └── ValidationError.java │ │ │ │ ├── exception │ │ │ │ └── ResourceNotFoundException.java │ │ │ │ ├── handler │ │ │ │ └── RestExceptionHandler.java │ │ │ │ ├── repository │ │ │ │ ├── OptionRepository.java │ │ │ │ ├── PollRepository.java │ │ │ │ ├── UserRepository.java │ │ │ │ └── VoteRepository.java │ │ │ │ ├── security │ │ │ │ └── QuickPollUserDetailsService.java │ │ │ │ ├── v1 │ │ │ │ └── controller │ │ │ │ │ ├── ComputeResultController.java │ │ │ │ │ ├── PollController.java │ │ │ │ │ └── VoteController.java │ │ │ │ ├── v2 │ │ │ │ └── controller │ │ │ │ │ ├── ComputeResultController.java │ │ │ │ │ ├── PollController.java │ │ │ │ │ └── VoteController.java │ │ │ │ └── v3 │ │ │ │ └── controller │ │ │ │ ├── ComputeResultController.java │ │ │ │ ├── PollController.java │ │ │ │ └── VoteController.java │ │ └── resources │ │ │ ├── application.properties │ │ │ ├── import.sql │ │ │ ├── messages.properties │ │ │ ├── static │ │ │ ├── .keep │ │ │ └── swagger-ui │ │ │ │ ├── css │ │ │ │ ├── reset.css │ │ │ │ └── screen.css │ │ │ │ ├── images │ │ │ │ ├── explorer_icons.png │ │ │ │ ├── logo_small.png │ │ │ │ ├── pet_store_api.png │ │ │ │ ├── throbber.gif │ │ │ │ └── wordnik_api.png │ │ │ │ ├── index.html │ │ │ │ ├── lib │ │ │ │ ├── backbone-min.js │ │ │ │ ├── handlebars-1.0.0.js │ │ │ │ ├── highlight.7.3.pack.js │ │ │ │ ├── jquery-1.8.0.min.js │ │ │ │ ├── jquery.ba-bbq.min.js │ │ │ │ ├── jquery.slideto.min.js │ │ │ │ ├── jquery.wiggle.min.js │ │ │ │ ├── shred.bundle.js │ │ │ │ ├── shred │ │ │ │ │ └── content.js │ │ │ │ ├── swagger-oauth.js │ │ │ │ ├── swagger.js │ │ │ │ └── underscore-min.js │ │ │ │ ├── o2c.html │ │ │ │ ├── swagger-ui.js │ │ │ │ └── swagger-ui.min.js │ │ │ └── templates │ │ │ └── .keep │ └── test │ │ └── java │ │ └── com │ │ └── apress │ │ ├── ExampleTest.java │ │ ├── QuickPollApplicationTests.java │ │ ├── UserGenerator.java │ │ ├── it │ │ └── PollControllerIT.java │ │ └── unit │ │ ├── PollControllerTest.java │ │ └── PollControllerTestMock.java │ └── target │ ├── classes │ ├── application.properties │ ├── com │ │ └── apress │ │ │ ├── QuickPollApplication.class │ │ │ ├── QuickPollMvcConfigAdapter.class │ │ │ ├── SecurityConfig.class │ │ │ ├── SwaggerConfiguration.class │ │ │ ├── client │ │ │ ├── PageWrapper.class │ │ │ ├── QuickPollClient$1.class │ │ │ ├── QuickPollClient.class │ │ │ ├── QuickPollClientJdk.class │ │ │ ├── QuickPollClientV2$1.class │ │ │ ├── QuickPollClientV2.class │ │ │ └── QuickPollClientV3BasicAuth.class │ │ │ ├── domain │ │ │ ├── Option.class │ │ │ ├── Poll.class │ │ │ ├── User.class │ │ │ └── Vote.class │ │ │ ├── dto │ │ │ ├── OptionCount.class │ │ │ ├── VoteResult.class │ │ │ └── error │ │ │ │ ├── ErrorDetail.class │ │ │ │ └── ValidationError.class │ │ │ ├── exception │ │ │ └── ResourceNotFoundException.class │ │ │ ├── handler │ │ │ └── RestExceptionHandler.class │ │ │ ├── repository │ │ │ ├── OptionRepository.class │ │ │ ├── PollRepository.class │ │ │ ├── UserRepository.class │ │ │ └── VoteRepository.class │ │ │ ├── security │ │ │ └── QuickPollUserDetailsService.class │ │ │ ├── v1 │ │ │ └── controller │ │ │ │ ├── ComputeResultController.class │ │ │ │ ├── PollController.class │ │ │ │ └── VoteController.class │ │ │ ├── v2 │ │ │ └── controller │ │ │ │ ├── ComputeResultController.class │ │ │ │ ├── PollController.class │ │ │ │ └── VoteController.class │ │ │ └── v3 │ │ │ └── controller │ │ │ ├── ComputeResultController.class │ │ │ ├── PollController.class │ │ │ └── VoteController.class │ ├── import.sql │ ├── messages.properties │ ├── static │ │ ├── .keep │ │ └── swagger-ui │ │ │ ├── css │ │ │ ├── reset.css │ │ │ └── screen.css │ │ │ ├── images │ │ │ ├── explorer_icons.png │ │ │ ├── logo_small.png │ │ │ ├── pet_store_api.png │ │ │ ├── throbber.gif │ │ │ └── wordnik_api.png │ │ │ ├── index.html │ │ │ ├── lib │ │ │ ├── backbone-min.js │ │ │ ├── handlebars-1.0.0.js │ │ │ ├── highlight.7.3.pack.js │ │ │ ├── jquery-1.8.0.min.js │ │ │ ├── jquery.ba-bbq.min.js │ │ │ ├── jquery.slideto.min.js │ │ │ ├── jquery.wiggle.min.js │ │ │ ├── shred.bundle.js │ │ │ ├── shred │ │ │ │ └── content.js │ │ │ ├── swagger-oauth.js │ │ │ ├── swagger.js │ │ │ └── underscore-min.js │ │ │ ├── o2c.html │ │ │ ├── swagger-ui.js │ │ │ └── swagger-ui.min.js │ └── templates │ │ └── .keep │ ├── maven-status │ └── maven-compiler-plugin │ │ ├── compile │ │ └── default-compile │ │ │ ├── createdFiles.lst │ │ │ └── inputFiles.lst │ │ └── testCompile │ │ └── default-testCompile │ │ ├── createdFiles.lst │ │ └── inputFiles.lst │ └── test-classes │ └── com │ └── apress │ ├── ExampleTest.class │ ├── QuickPollApplicationTests.class │ ├── UserGenerator.class │ ├── it │ └── PollControllerIT.class │ └── unit │ ├── PollControllerTest.class │ └── PollControllerTestMock.class ├── Contributing.md ├── LICENSE.txt ├── README.md └── errata.md /9781484274767.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/spring-rest-2e/ef1ddc4da88194adc49d2cfe78b1269968247c03/9781484274767.jpg -------------------------------------------------------------------------------- /Chapter10/quick-poll-ch10-final/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter10/quick-poll-ch10-final/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | -------------------------------------------------------------------------------- /Chapter10/quick-poll-ch10-final/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter10/quick-poll-ch10-final/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /Chapter10/quick-poll-ch10-final/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Chapter10/quick-poll-ch10-final/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /Chapter10/quick-poll-ch10-final/src/main/java/com/apress/QuickPollApplication.java: -------------------------------------------------------------------------------- 1 | package com.apress; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class QuickPollApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(QuickPollApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Chapter10/quick-poll-ch10-final/src/main/java/com/apress/controller/VoteController.java: -------------------------------------------------------------------------------- 1 | package com.apress.controller; 2 | 3 | import javax.inject.Inject; 4 | 5 | import org.springframework.http.HttpHeaders; 6 | import org.springframework.http.HttpStatus; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestMethod; 12 | import org.springframework.web.bind.annotation.RestController; 13 | import org.springframework.web.servlet.support.ServletUriComponentsBuilder; 14 | 15 | import com.apress.domain.Vote; 16 | import com.apress.repository.VoteRepository; 17 | 18 | @RestController 19 | public class VoteController { 20 | 21 | @Inject 22 | private VoteRepository voteRepository; 23 | 24 | @RequestMapping(value="/polls/{pollId}/votes", method=RequestMethod.POST) 25 | public ResponseEntity createVote(@PathVariable Long pollId, @RequestBody Vote vote) { 26 | vote = voteRepository.save(vote); 27 | 28 | // Set the headers for the newly created resource 29 | HttpHeaders responseHeaders = new HttpHeaders(); 30 | responseHeaders.setLocation(ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(vote.getId()).toUri()); 31 | 32 | return new ResponseEntity<>(null, responseHeaders, HttpStatus.CREATED); 33 | } 34 | 35 | @RequestMapping(value="/polls/{pollId}/votes", method=RequestMethod.GET) 36 | public Iterable getAllVotes(@PathVariable Long pollId) { 37 | return voteRepository.findByPoll(pollId); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Chapter10/quick-poll-ch10-final/src/main/java/com/apress/domain/Option.java: -------------------------------------------------------------------------------- 1 | package com.apress.domain; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.GeneratedValue; 6 | import javax.persistence.Id; 7 | 8 | @Entity 9 | public class Option { 10 | 11 | @Id 12 | @GeneratedValue 13 | @Column(name="OPTION_ID") 14 | private Long id; 15 | 16 | @Column(name="OPTION_VALUE") 17 | private String value; 18 | 19 | public Long getId() { 20 | return id; 21 | } 22 | public void setId(Long id) { 23 | this.id = id; 24 | } 25 | public String getValue() { 26 | return value; 27 | } 28 | public void setValue(String value) { 29 | this.value = value; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return getId() + "," + getValue(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Chapter10/quick-poll-ch10-final/src/main/java/com/apress/domain/Poll.java: -------------------------------------------------------------------------------- 1 | package com.apress.domain; 2 | 3 | import org.springframework.hateoas.RepresentationModel; 4 | 5 | import java.util.Set; 6 | 7 | import javax.persistence.CascadeType; 8 | import javax.persistence.Column; 9 | import javax.persistence.Entity; 10 | import javax.persistence.GeneratedValue; 11 | import javax.persistence.Id; 12 | import javax.persistence.JoinColumn; 13 | import javax.persistence.OneToMany; 14 | import javax.persistence.OrderBy; 15 | 16 | 17 | @Entity 18 | public class Poll extends RepresentationModel { 19 | 20 | @Id 21 | @GeneratedValue 22 | @Column(name="POLL_ID") 23 | private Long id; 24 | 25 | @Column(name="QUESTION") 26 | private String question; 27 | 28 | @OneToMany(cascade=CascadeType.ALL) 29 | @JoinColumn(name="POLL_ID") 30 | @OrderBy 31 | private Set