From the course: Java EE 7: Web Services

Unlock the full course today

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

Extract request parameters

Extract request parameters - Java EE Tutorial

From the course: Java EE 7: Web Services

Start my 1-month free trial

Extract request parameters

- [Instructor] Let's learn how to extract information from the request. The following types of parameters can be extracted for use in the Resource class. Query parameters, URI path parameters, form elements, cookies, headers, and a matrix. Let's discuss the URI path parameter in more detail, and then see it in action. URI path parameters indicated by the @PathParam annotation are extracted from the URI of the request, and essentially injects the value of the parameter into the method. Here's a tip. You can inject multiple parameters into a Java method using a format similar to what's below. Simply list each path parameter separated by a forward slash. I've opened IntelliJ and navigated to the ApplicationResource.java file. On line 33, the getApplication resource method demonstrates returning an application. For now, we have the data hard-coded, but that will soon change. If you notice here on line 32, we are using the @Path annotation at the method level. The @Path annotation on this…

Contents