Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you will start to implement a simple RESTful server using Java Spring. The service for this assignment is to return - a

image text in transcribed

In this assignment you will start to implement a simple RESTful server using Java Spring. The service for this assignment is to return - a list of objects of the User class described below; and - a single string which is the name of a user, upon receiving the user's ID as input. The assignment involves three classes: xxxApplication, xxxController and User, where xxx is to be replaced with your choice of the project name. The xxxApplication class is generated by IntelliJ once you create your project. The User class should have id and name as instance variables - id should be an integer and name a String. Provide a constructor for the class and getters and setters for id and name. The Controller class should have, as a private instance variable, a Hash Map where the keys are the IDs of users and the value associated with each key is the User object whose id instance variable matches the key. For this assignment, initialize the map with a few entries (key-value pairs) when you declare it. The hash map will be used by the methods of the Controller class. For this assignment, the Controller class should include the following two methods: - A getUsers method which returns a list consisting of all User objects stored in the hash map. Be sure to create a proper URI for the method. - A getName method which takes as input an integer for ID and returns a string which is the name of the associated User object if the user exists. Otherwise, the method should throw a ResponseStatusException with a proper error message. The getName method should use the same URI for the getUsers method and extend it with the ID of the user that you search for. Be sure that the Controller class and its methods have the proper annotations to allow the server to function correctly. Deliverables Submit the following files to D2L: - The Java files for the Application, Controller and User classes. - Screenshots of your Postman or ARC results for the getUsers and getName methods in the Controller class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions