From the course: Java EE 8: Web Services
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Synchronous REST service client - Java EE Tutorial
From the course: Java EE 8: Web Services
Synchronous REST service client
- [Instructor] I've shown how to hit a RESTful service with Postman, JavaScript and from a web page. Now, you need to do it programmatically in Java. This video will show you how to call a REST resource with the JAX-RS API. It's going to be a synchronous call. What that means is that the calling thread, i.e. your client code is blocked, until either a response comes back from the service or the request has terminated by a timeout. The journey begins where everything life does in the Java class. So let's go overhead to the project. I want a new class. Now, under the package I want it in a client sub package under the REST hierarchy. For the name we'll call a SyncRESTClient. Hit the Finish button and we're done. I want to add a main method to kick start everything, public static void main(String[] args). Then the heavy lifting I will do that in a private static void syncClientCall, no arguments and there. I'm…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.