Working with Spring REST | RESTful Services with Spring

Next-Level Spring: Explore Best Practices for Writing RESTful Services in Java using Spring Boot

TT3358

Intermediate

2 Days

Course Overview

Spring REST focuses on providing an understanding of the fundamental principles and technologies that are used in the development of RESTful services and clients.  This understanding is critical to being able to diagnose, troubleshoot, tune, and perform other lifecycle activities.

Working with Spring REST is a two-day, fast-paced coding course geared for experienced developers who have prior working knowledge of Java.  Throughout the course students learn the best practices for writing Restful services in Java using Spring Boot. The course provides an in-depth view of the APIs provided by Spring to develop both the REST service and the REST client.

Learning Objectives

This “skills-centric” course is about 50% hands-on lab and 50% lecture, designed to train attendees in core Cucumber and web testing skills, coupling the most current, effective techniques with the soundest industry practices. Working within in an engaging, hands-on learning environment, guided by our expert team, attendees will:

  • Learn the request-response cycle of REST requests
  • Implement a REST controller using Spring
  • Map URLs to service endpoints
  • Use Spring's template class to develop a REST client
  • Bootstrap a Spring REST applications
  • Return different media types for a service
  • Setting the response headers
  • Discuss Exceptions and HTTP Status codes
  • Handle exceptions thrown by a service

Need different skills or topics?  If your team requires different topics or tools, additional skills or custom approach, this course may be further adjusted to accommodate.  We offer additional Spring, Java / JEE programming, Microservices / Services, REST, TDD / testing, design, application security and other related topics that may be blended with this course for a track that best suits your needs.

Course Objectives

This “skills-centric” course is about 50% hands-on lab and 50% lecture, designed to train attendees in core Cucumber and web testing skills, coupling the most current, effective techniques with the soundest industry practices. Working within in an engaging, hands-on learning environment, guided by our expert team, attendees will:

  • Learn the request-response cycle of REST requests
  • Implement a REST controller using Spring
  • Map URLs to service endpoints
  • Use Spring's template class to develop a REST client
  • Bootstrap a Spring REST applications
  • Return different media types for a service
  • Setting the response headers
  • Discuss Exceptions and HTTP Status codes
  • Handle exceptions thrown by a service

Need different skills or topics?  If your team requires different topics or tools, additional skills or custom approach, this course may be further adjusted to accommodate.  We offer additional Spring, Java / JEE programming, Microservices / Services, REST, TDD / testing, design, application security and other related topics that may be blended with this course for a track that best suits your needs.

Course Prerequisites

This in an intermediate-level Java development course geared for students experienced with Java and Spring programming essentials.  This course does not cover Java or Spring development basics.

Please see the Related Courses tab for specific Pre-Requisite courses, Related Courses that offer similar skills or topics, and next-step Learning Path recommendations.

Course Agenda

Please note that this list of topics is based on our standard course offering, evolved from typical industry uses and trends. We’ll work with you to tune this course and level of coverage to target the skills you need most.

Session: Implementing REST with Spring

Lesson: REST principles

  • Introduce the six architectural constraints of REST
  • Introduce Resources and Resource representations
  • Best practices for defining Resource URIs
  • Tutorial: Setup Eclipse for Using Maven

Lesson: Introduction to RESTful Services in Spring

  • Discuss the request-response cycle of REST requests
  • Defining a REST Controller in Spring
  • Explain the @ResponseBody annotation
  • Define request mappings
  • Use path variables
  • Lab: Working with Spring REST

Lesson: Introduction to REST Clients in Spring

  • Introduce RestTemplate class
  • Making GET, POST, PUT, HEAD, OPTIONS and DELETE requests
  • Introduce the UriTemplate class
  • Using HttpEntity and RequestEntity
  • Use the exchange method to define ‘complex’ requests
  • Process requests and responses using callback
  • Configure the RestTemplate
  • Lab: Implementing the Spring REST Client

Lesson: Bootstrapping the REST application

  • Describe steps needed to bootstrap Spring REST application
  • Configure Content Representation libraries
  • Configure Spring MVC and map the Dispatcher Servlet
  • Explain the advantages of using Spring Boot to setup the REST project
  • Setup a Spring REST application using Spring Boot
  • Lab: Spring Hotel Reservation
  • Lab: Spring Hotel Reservation Client

Lesson: Content Representation

  • Returning different media types from service
  • Introduce negotiated resource representation
  • Configure Message Converters
  • Lab: Spring REST Content Negotiation

Lesson: Implementing the REST Service

  • Process for Spring REST Implementation
  • The Domain object
  • Using Project Lombok to define the domain object
  • (Not) Using Data Transfer Objects
  • ResponseEntity builder interfaces
  • Setting Location header using UriComponentsBuilder
  • Lab: Spring REST Services

Lesson: Error Handling

  • Handling Exceptions and HTTP Status codes
  • Using @ResponseStatus
  • Exception handler methods in controller
  • Using Controller advices to handle exception
  • The ResponseStatusException class
  • Lab: Spring REST Exceptions

Session: Security and RESTful Services

Lesson: Securing Untrusted Input

  • Input Data Attacks
  • Protecting a Web Service
  • Tenacious D
  • Responding to Error State

Lesson: Defending RESTful Services

  • How Attackers See REST
  • Factors that Increase Attack Surface
  • Data Tampering
  • Cross Site Scripting
  • Bridging and its potential Problems
  • Dangerous Developer Assumptions
  • Three Basic Tenets for Safe RESTfulness

Course Materials

Student Materials: Each participant will receive a digital Student Guide and/or Course Notes, code samples, software tutorials, step-by-step written lab instructions (as applicable), diagrams and related reference materials and resource links. Students will also receive the project files (or code, if applicable) and solutions required for the hands-on work.

Hands-On Setup Made Simple! Our dedicated tech team will work with you to ensure our ‘easy-access’ cloud-based course environment, or local installation, is accessible, fully-tested and verified as ready to go well in advance of the course start date, ensuring a smooth start to class and effective learning experience for all participants. In some cases we can also help you install this course locally if preferred. Please inquire for details and options.

Every-Course Extras = High-Value & Long-Term Learning Support! All Public Schedule courses include our unique EveryCourse Extras package (Course Recordings, Live Instructor Follow-on Support, Free *Live* Course Refresh Re-Takes, early access to Special Offers, Free Courses & more). Please inquire for details.

Raise the bar for advancing technology skills

Attend a Class!

Live scheduled classes are listed below or browse our full course catalog anytime

Special Offers

We regulary offer discounts for individuals, groups and corporate teams. Contact us

Custom Team Training

Check out custom training solutions planned around your unique needs and skills.

EveryCourse Extras

Exclusive materials, ongoing support and a free live course refresh with every class.

Mix, Match & Master!
2FOR1: Two Courses, One Price!

Enroll in *any* two public courses (for 2023 *OR* 2024 dates!) by December 31, for one price!  Learn something new, or share the promo!

Click for Details & Additional Offers

Learn. Explore. Advance!

Extend your training investment! Recorded sessions, free re-sits and after course support included with Every Course
Trivera MiniCamps
Gain the skills you need with less time in the classroom with our short course, live-online hands-on events
Trivera QuickSkills: Free Courses and Webinars
Training on us! Keep your skills current with free live events, courses & webinars
Trivera AfterCourse: Coaching and Support
Expert level after-training support to help organizations put new training skills into practice on the job

The voices of our customers speak volumes

Special Offers
Limited Offer for most courses.

SAVE 50%

Learn More