From the course: Java EE 8 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

URI template parameters

URI template parameters - Java EE Tutorial

From the course: Java EE 8 Essential Training

Start my 1-month free trial

URI template parameters

- [Narrator] In this lesson, we're going to take a look at how to use URI template parameters within JAX-RS. We're going to add them to a resource method and also see how to call them with the client. So, the first thing we're going to do is navigate to our find by catalog ID resource method and you'll notice right now we are using a Query Param. We're going to switch that up and use a URI template parameter. Now, to do that we modify the path to include a parameter in curly braces and we're going to name this parameter Catalog Item ID. At this point, we can go ahead and switch out our query parameter with a path parameter and this is very typical within REST APIs that you may build or use, so just kind of switch in the semantics. And then we can navigate to the remote inventory service, because we'll need to adjust the code that is causing our client to call the REST API. So, now instead of using the query pram method,…

Contents