
Explore the nine sections of this curriculum overview, from REST basics, validation and exceptions, and response objects to dependency injection, security, JAX-RS client and server APIs, and setup.
Begin hands-on with practical RESTful web services by applying what you learned, using the repository to run a server, and exploring Java EE 8 with JAX-RS 2.1.
Run the sample code to see the app in action. Inspect how RESTful endpoints return JSON for an employee with id, name, salary, social security, and department.
Demonstrates running a sample rest call to fetch a single employee by id, illustrating dynamic runtime data and how the request returns one entity from the database.
learn how a jpa entity class models an employee with id, name, salary, and ssn, links to a department via many-to-one, and shows the department's employee list via doctoress api.
Extend the JAX-RS application class in Java EE 8, register resource classes and providers, and define the application path to expose REST resources under a primary API path.
Learn how a JAX-RS resource class exposes REST endpoints, handling GET requests via @GET, using @Path with dynamic braces for runtime IDs, and inheriting base paths for employee resources.
Use dynamic path segments and the @PathParam annotation to pass an id, inject it at runtime, and fetch either a list of employees or a single employee from the database.
Understand how the @Produces annotation sets the media type for REST resources, at class or method level, and override behavior when returning employee lists.
Learn to annotate a Java EE REST resource to produce XML from an employee list and test the XML return media type via class and method level annotations.
Test a single entity JSON return type by querying a dynamic employee id, and verify content type and response behavior in a Java EE 8 JAX-RS 2.1 RESTful service.
Create a JAX-RS REST API by extending the Application class, setting the application path, and exposing resource classes with path and produces annotations.
Explore how to post data to a RESTful web service in Java EE 8 (JAX-RS 2.1), observe a 200 response, and receive a new id returned by the backend.
Explore post sample code run by sending valid and invalid data to a rest endpoint, observe 200 and precondition validation errors, and inspect backend validation messages.
Explore how a RESTful post from the front end to the employee resource stores data in the database and returns results after validation.
Investigate the post resource method in the employee resource class, where a front-end posts JSON to create an employee; the REST runtime maps JSON to Employee and saves it.
Learn how the @Valid annotation enables runtime validation of entity objects by applying declarative constraints to incoming front end data and surfacing constraint violations as errors.
Explore how the @Valid annotation triggers validation and cascading constraints on objects, and how ConstraintViolationException conveys data about violations to front-end and back-end systems.
Explore bean validation constraints on the employee entity, including not empty, size limits, and custom messages, and learn how constraint violations surface to the front end via exception mappers.
Explore how to map exceptions from server to client using JAX-RS exception mappers, handling constraint violations and other errors to craft appropriate API responses.
Explore how JAX-RS exception mappers translate constraint violations into client responses, using runtime exceptions to send meaningful messages via a mapped response.
Learn how JAX-RS exception mappers convert constraint violations into structured responses by extracting the violated property path, assembling a map of field messages, and building a response with fluent interface.
Register a JAX-RS interface implementation with @Provider to auto-register at runtime, so the runtime can invoke your exception handler for constraint violation exceptions.
Learn to map constraint violations to a property-to-message structure, wrap them in an exception, and send meaningful error details to rest clients in Java EE 8 restful services.
Understand how the JAX-RS response object, an abstract class, passes data and headers to clients, supports entities and metadata, and uses factory methods to build responses, including constraint violation details.
Explore the JAX-RS response object and its methods for accepting content, attaching an entity, retaining an employee object by ID, and handling post-requests with redirects in restful services.
Operate with the JAX-RS Response object to fetch an employee by id using a dynamic path parameter and return the proper status and entity to the client.
build and return responses with the jax-rs 2.1 response object in java ee 8, by computing the absolute path and id to form a valid resource location.
Test restful web services with Java EE 8 by posting to the API, observe no entity in response body, and verify the absolute location of the created employee via get.
Demonstrate using JAX-RS to build a get request with a dynamic path, fetch an employee by id, and return the employee entity via a response object.
Review how we built a post request API with validation, handle constraint violations and responses, and explore data response objects and API interfaces to create robust, maintainable RESTful web services.
Learn how dependency injection inverts control by shifting object creation to a container, which injects declared dependencies and manages lifecycle via the CDI framework.
Learn how to inject dependencies using @Inject with the CDI framework in a Java EE 8 JAX-RS 2.1 context, wiring query and persistence services into resource classes.
Learn how @Inject wires application dependencies such as EJB services and the persistence context via an entity manager, enabling injected dependencies and database access in Java EE 8.
Examine CDI injection configuration in Java EE 8 using producers to create injectable beans, declare and inject dependencies with dependent scope to manage lifecycles within the application.
Explore how to inject JAX-RS utility objects with @Context to access request-specific context and HTTP headers inside resource classes.
JAX-RS @Context documentation shows how context indexes information into a class field, property, or method parameter to inject dependencies within the API.
Explore the JAX-RS UriInfo documentation as an injectable interface that exposes access to application and request information, helping you retrieve resource details for restful web services.
Explore the JAX-RS HttpHeaders interface and its methods to access HTTP headers, including acceptable media types and cookies, and see how it weaves with Java EE APIs for RESTful services.
Grabbing Form Fields with @FormParam demonstrates posting form data to a resource, consuming the media type, and injecting values into method parameters for processing.
demonstrates a sample run posting form data to a JAX-RS resource using @FormParam, with content-type application/x-www-form-urlencoded, extracting fields like name, employee, class, salary, and ssn for processing.
See a JAX-RS FormParam sample run that posts a form with name, salary, and ssn, injects values from form fields, headers, and cookies into a restful Java EE 8 API.
Aggregate multiple injection points with @BeanParam annotation to inject fields into a single object, enabling cleaner parameter handling in rest resources.
Explore how the JAX-RS BeanParam annotation injects request data into POJOs within resource classes, instantiating value objects and preparing fields for resource methods.
Learn how @BeanParam aggregates multiple injection points in a JAX-RS resource, injecting an employee object, initializing it, and printing its properties from a method that handles posted data.
demonstrates running a JAX-RS @BeanParam sample, showcasing bean parameter binding with form data, REST client interactions, and inspecting request and response flow.
Review dependency injection attacks and how to inject dependencies into applications, clarify the distinction between related concepts, and introduce filters for the next topic.
Explore JAX-RS filters intro, learn how to intercept requests and modify headers, apply filters for security, and develop middleware extension points in REST services.
Learn how to implement a container request filter with ContainerRequestFilter to intercept and inspect requests using ContainerRequestContext, log the calling method and absolute path, and prepare for security checks.
Explore the JAX-RS container request filter documentation, focusing on the filter method, its role in intercepting requests to resources, and the prematch and post-match extension points.
Explore the JAX-RS container request context documentation and learn how to access and modify request-scoped properties, headers, cookies, and runtime settings via the ContainerRequestContext interface.
Register filters in Java EE 8 using @Provider, and enable pre-matching with @PreMatching to intercept every API request before resource matching.
Order multiple filters in Java EE 8 RESTful services using the @Priority annotation, assigning integer values to control execution order for security and request-modifying filters.
Explore the JAX-RS @Priority documentation and how the priority annotation orders classes. Learn that it takes an integer value and that frameworks may supply predefined constants to control interceptor ordering.
Discover how JAX-RS @Priorities constants and the X-Priority annotation manage authentication and authorization, using the priorities class and built-in constants to order requests, where higher integer values mean lower priority.
Learn how to order filters in a Java EE 8 restful service using the @Priority annotation, prioritizing authentication and controlling the filter chain with X-Priority values.
Learn how the container request filter uses the container request context to read X-HTTP-Method-Override and adjust the HTTP method for security and behavior behind a firewall.
Implement the filter method of a container request filter to read a header value, override the HTTP method as needed, and use pre-match logic to route to the correct resource method.
Run a server request filter sample to validate REST requests in Java EE 8 (JAX-RS 2.1), using a key from the department resource to identify the method and observe responses.
Explore server request filters in restful web services with Java EE 8 (JAX-RS 2.1) through a runnable sample: header manipulation, runtime method changes, and interceptor prioritization for extensions.
Explore how to implement response filters with the ContainerResponseFilter interface to handle the response after a resource method executes, using two parameters: a container context and a container response context.
Explore the ContainerResponseFilter documentation, compare it to the container request interface, and learn about the ContainerResponseContext interface and how to add content and context in responses.
Examine the ContainerResponseContext documentation to learn how its mutable interface exposes message headers, entity, and properties, and how to modify the response delivered to clients within a filter.
Learn to use the CacheControl class in Java EE 8 (JAX-RS 2.1), modeled on the HDTV reference spec, to configure response caching and apply it to client responses.
Explore the CacheControl class in JAX-RS 2.1, an abstraction over the HTTP cache-control directives, showing how to set caching behavior in response headers.
Use the CacheControl class in Java EE 8 (JAX-RS 2.1) to set cache directives and max-age for responses, ensuring the client cache behavior is controlled by the server.
Discover how to cache a resource method's response with cache control and a cache key, storing the result for a set number of seconds and validating retrieval.
Demonstrate a get request to the department resource and a server response filter, with cache-control headers revealing the class's max directives after four and a half seconds.
Implement a server response filter for Java EE 8 JAX-RS to intercept requests and responses, caching GET responses via request context to determine message type and apply cache attributes.
Examine how filters act as API constructs for cross-cutting concerns like security and bind them to specific resource methods so they run only when those methods are invoked.
Explore server filter binding using the dynamic feature interface in JAX-RS 2.1 for Java EE 8, enabling runtime filters on annotated resource methods via configure and future context.
Discover how the dynamic feature interface enables dynamic registration of post matching providers to intercept resource methods at runtime, using annotations to register provider instances and control prematch behavior.
Explore how the ResourceInfo interface provides access to resource classes via injectable metadata and how annotations expose method metadata to map requests to the correct resource method.
Learn how the feature context interface and dynamic feature interface enable configuring filters for resources in Java EE 8 (JAX-RS 2.1), via a two-parameter configure method.
Register and implement a dynamic feature interface to bind server filters to specific REST methods, configuring method-level behavior at runtime and applying caching in responses.
Bind a server filter with the DynamicFeature interface in a JAX-RS 2.1 setup, implementing a container response using context and cache duration concepts to control max age behavior.
Explore binding server filters to individual JAX-RS resource methods using the DynamicFeature interface, inspecting methods and annotations to instantiate and register a dynamic response filter for targeted API methods.
Bind server filters with the DynamicFeature interface in Java EE 8, inspecting resource methods for annotations, dynamically instantiating responses, and registering the behavior at runtime.
Learn how to bind server filters to resources with the DynamicFeature interface in Java EE 8, using a departments endpoint and 3600-second response caching.
Implement a server side filter using the DynamicFeature interface and run a sample to apply a cache-control max-age set to 3600 on a get method, illustrating extension creation.
Bind filters to specific resources with a dynamic feature interface, replacing blanket filters with per-method caching rules. Use max-age cache-control annotations and register filters via the feature context.
Explore authentication and authorization essentials in JAX-RS security and how container or third-party implementations support secure restful web services, with a disclaimer that this course is not comprehensive security training.
Implement security using filters and a secure annotation bound to resource methods; the filter checks for a bearer token in the request header and allows or rejects the call accordingly.
Explore security for restful web services with Java EE 8 and JAX-RS 2.1, including sign up, login credentials, and token-based access to protected resources.
Explore how json web tokens provide a compact, standardized way to validate the sender between client and server, using header, payload, and signature, and note that jwt is not encryption.
The lecture demonstrates making an authenticated request to a protected resource, showing how missing authorization is denied and how signing up and providing username and password enables subsequent requests.
Sign up by posting a user payload to the user resource, receive a created response with the new user path, then log in to authenticate for subsequent requests.
Sign in to the application by posting username and password to the login resource, receive a 200 response with a Bearer token, and use it to access the department resource.
Demonstrates authenticating with a bearer token in the authorization header to access a protected rest resource, validating the token, and securing methods with a login-driven security flow.
Map a user entity to a database table with JPA annotations, include queries by email and by email and password, and enforce validation and password hashing.
Persist the user entity by encoding the password with a security class, then save the user via the entity manager in a Java EE 8 JAX-RS context.
Explore JAX-RS security in Java EE 8 with the SecurityUtil class, demonstrating password hashing, using the Java security API, and password verification against a database.
Learn how the @Secure name-binding annotation enforces JAX-RS security by attaching to methods or a resource class, using a filter to enforce access and return errors for unauthorized requests.
Define and bind name binding annotations in JAX-RS, then apply them to resources and use a security filter to enforce access.
Create and register a security request filter using a content request context, binding with a custom X secure annotation to enforce authentication in JAX-RS.
Demonstrate how to implement a JAX-RS security request filter by injecting CDI beans, managing a per-session bean, and handling an encrypted password within the security flow.
Implement a JAX-RS security request filter that reads the authorization header from the request context, validates the token, and throws an unauthorized exception for missing or invalid credentials.
Explore the JAX-RS security request filter implementation, handling authorization checks, parsing the request header for substrings, and integrating a session store with encrypted passwords.
Explore how JWT-based authentication is validated by signing with a key, the server verifies the signature, and handles signing errors with try-catch in a security request filter.
Explore securing RESTful resources with a JAX-RS security request filter, handling authorization responses, managing the security context, and overriding the request's security context to control access.
Explore how the JAX-RS security context interface exposes authentication scheme and the currently executing principal, enabling secure access checks and role-aware responses for REST resources.
Learn to customize a JAX-RS security context by overriding the request’s security context to set a custom principal, subject, and claims for resources.
Explore how to implement a JAX-RS security request filter and override the security context for bearer JWT. Learn about annotations, container binding, runtime behavior, and stateless security in RESTful services.
Explore how a JAX-RS user resource class creates users via a resource method, uses CDI to inject dependencies, and builds resource paths with getAbsolutePath for REST endpoints.
This lecture explains how the login resource method handles post requests to authenticate a user, generate an authorization token, manage sessions, and protect passwords from plaintext storage.
Authenticate the user by querying credentials with email and password, compare the plaintext password, and throw a security exception on failure, noting the use of proper security mechanisms in practice.
Explore how the get token resource method generates a key and a time-limited token with issuer, audience, and 15-minute expiration, then returns the signed token in the header.
Authenticate user credentials, email and password, in a JAX-RS resource and generate a signed token with subject, issuer, expiration, and audience. Use the token in headers to protect subsequent requests.
Learn how JAX-RS secures a resource method by using annotations and a filter to validate a JWT in the request header, granting access when authentication succeeds.
Recap the key ideas of securing JAX-RS applications: validate requests through a security layer and implement authentication and authorization with the Java security API or third-party libraries.
Demonstrates using the JAX-RS client API to query the Have I Been Pwned API endpoint and determine if an email has been breached.
Learn how to run sample code with the JAX-RS client API, construct requests with query parameters like email, and interpret server responses about account compromise.
Instantiate and reuse a heavy-weight JAX-RS client via a factory, configure base paths and dynamic targets, then build requests, process responses, and stream results using templates.
Use the JAX-RS client API to call RESTful services in Java EE 8, iterate responses, extract values from returned objects, and collect results for processing.
Explore restful web services with Java EE 8 (JAX-RS 2.1), set up GlassFish v5 as the reference implementation, and learn features that enable you to develop powerful applications.
Explore rest endpoints in Java EE 8 using JAX-RS 2.1, including file upload and download and content negotiation. Learn about asynchronous processing and server push to clients with JAX-RS 2.1.
Discover the latest Java EE 8 updates and production ready features, and learn to download the SDK, with GlassFish as the reference implementation.
Check out the advanced api use branch of the sample code, clone the repo, and study the code line by line to understand api constructs and reading code.
Upgrade the project to Java EE 8 by following vendor guidance, removing the old annotation API dependencies, and replacing them with updated dependencies to complete the upgrade.
Download GlassFish 5 as the reference implementation for Java EE 8, choose web profile, download and unzip, then add to your IDE.
Install GlassFish 5 in NetBeans by downloading the zip, extracting it to a location, naming the server, and finishing the setup.
Create an employee via post with name, salary, and SSN, capture the location header, and then upload a picture to that employee.
Upload a binary image to the employee resource via post in jax-rs 2.1, associating the picture with the employee id and handling application octet-stream data.
Upload an employee picture and download it through a JAX-RS 2.1 RESTful API in Java EE 8, using the employee-pic resource with the employee ID to fetch the binary image.
Demonstrate JAX-RS binary file upload and download by creating an employee via POST, persisting it, and returning cookies for the employee ID and name.
Explore how to implement a jax-rs file upload endpoint that accepts a binary image for an employee by id, using application/octet-stream, marshaling to Java objects, and saving to the database.
Explore a JAX-RS file download resource method that serves binary data as an octet-stream, fetches an employee's picture from the database, and returns it to the client for download.
Learn how content negotiation lets a single resource method return different representations based on client requests. The lecture demonstrates creating an employee resource with POST and observing the negotiated response.
Practice jax-rs content negotiation by issuing get requests to employee resources with dynamic paths, retrieving an employee's id, name, and salary.
Explore how JAX-RS content negotiation serves different media types from the same resource method based on client requests, using dynamic path parameters and browser testing.
Learn how JAX-RS 2.1 uses content negotiation with q-values in the Accept header to select the media type for a resource like /employees/{id}, defaulting to 1 when q is absent.
Explore asynchronous processing in JAX-RS 2.1 with completion stage and async response, demonstrating how to offload heavy payroll tasks to a separate thread within a managed resource.
Explore the JAX-RS Async ManagedExecutorService in Java EE 8, and learn how it submits and manages asynchronous tasks with built-in resource and concurrency handling.
Explore the JAX-RS AsyncResponse interface for injectable asynchronous server-side responses, using suspend to manage, update, and cancel suspended client requests with example resource code.
Explains how to use the @Suspended annotation to inject AsyncResponse and suspend requests in JAX-RS, defining suspend time (including indefinite) and resuming processing when a response is available.
Learn how JAX-RS async resource methods handle RESTful POST and PUT requests with the suspended annotation, using a separate thread to process work and respond to the original client thread.
Implement a JAX-RS async resource method that delegates a computationally expensive task to a processing thread, suspends the original request, and resumes with an async response.
Demonstrates how to implement JAX-RS async resource methods by suspending the original request, processing on a separate thread, and resuming with AsyncResponse to send a final result after a delay.
Explore JAX-RS asynchronous processing with a sample run that suspends a thread during an expensive operation, then returns a delayed response after five seconds to the post resource.
Explore JAX-RS async processing in which a request starts in one thread, processes in a separate thread, and resumes the original thread to return a response.
Trace the Jakarta EE transition from Java EE to a foundation-led open platform, detailing licensing, rebranding, and its impact on the Java ecosystem.
This lecture updates students on what is new with Jakarta EE, the future successor to Java EE
This lecture seeks to encourage students to help shape Jakarta EE by joining the community mailing list for Jakarta EE.
Are you a Java developer? Do you aspire to be a Java EE developer? Do you need a modern, next generation, powerful, open platform to develop the next big thing the world has to see? Do you need to build RESTful web services as fast as possible? Do you want to spend time fleshing out your business ideas instead of fighting your framework? If you answered yes to any of the above questions, I have good news for you!
Practical RESTful Web Services with Java EE 8 (JAX-RS 2.1) is your complete guide to developing modern RESTful web services with the industry gold standard Java EE. This course is designed to equip you with the critical knowledge you need to master the Java EE API for creating RESTful web services.
You will learn both the theory and practice of the JAX-RS API and come away with deep understanding of how to craft great web services with Java EE. You will also be trained in using the very detailed Java EE documentation available at your disposal to further deepen your knowledge of Java EE.
Practical RESTful Web Services with Java EE 8 will teach you
Practical RESTful Web Services with Java EE 8 (JAX-RS 2.1) is uniquely designed with you the student in mind, aimed at taking you from 0-1 developing RESTful Web Services as fast as possible. The goal is to get you to productivity in the shortest possible time while still sharing valuable good software development principles and practices with you.
So what are you waiting for? Go on, click the big green button to enroll in this course and be on your way to developing awesome web services in no time with the awesome Java EE platform. Go ahead, enroll by clicking the green button and I will see you in the course.