Registering Filters per JAX-RS client

In this post under JAX-RS Client, I will show with example how to configure filters per client. For our example we need to create two filters one to intercept requests and another to intercept responses as shown below Request Filter package defaultPackage; import java.io.IOException; import jakarta.ws.rs.client.ClientRequestContext; import jakarta.ws.rs.client.ClientRequestFilter; import jakarta.ws.rs.ext.Provider; public class MyClientRequestFilter implements ClientRequestFilter…… Continue reading Registering Filters per JAX-RS client

JAX-RS Client Connect Timeout

In this post under JAX-RS client, I will show with example how to set connect timeout. Below is the complete code for your reference Main Class 1 package defaultPackage; 2 3 import java.util.concurrent.TimeUnit; 4 5 import jakarta.ws.rs.client.Client; 6 import jakarta.ws.rs.client.ClientBuilder; 7 import jakarta.ws.rs.client.Invocation; 8 import jakarta.ws.rs.client.WebTarget; 9 import jakarta.ws.rs.core.Response; 10 11 public class Example14 {…… Continue reading JAX-RS Client Connect Timeout

JAX-RS Client Read Timeout

In this post under JAX-RS client, I will show with example how to set read timeout. Below is the complete code for your reference Main Class 1 package defaultPackage; 2 3 import java.util.concurrent.TimeUnit; 4 5 import jakarta.ws.rs.client.Client; 6 import jakarta.ws.rs.client.ClientBuilder; 7 import jakarta.ws.rs.client.Invocation; 8 import jakarta.ws.rs.client.WebTarget; 9 import jakarta.ws.rs.core.Response; 10 11 public class Example13 {…… Continue reading JAX-RS Client Read Timeout

Creating a header and footer for a worksheet

In this post under Apache excel, I will show with example how to add header and footer to an Worksheet. Below is the complete code for your reference. Main Class 1 package package5; 2 3 import java.io.BufferedReader; 4 import java.io.File; 5 import java.io.FileOutputStream; 6 import java.io.FileReader; 7 import java.io.IOException; 8 9 import org.apache.poi.xssf.usermodel.XSSFCell; 10 import…… Continue reading Creating a header and footer for a worksheet

Configuring RetryTemplate (using Interceptor)

In the previous post under Spring Retry –> XML Configuration –> Spring AOP, I showed with example how to configure Spring Retry using interceptor. In that post I used RetryOperationsInterceptor class as shown in the below snippet. <bean id=”retryAdvice” class=”org.springframework.retry.interceptor.RetryOperationsInterceptor”/> In the above code snippet, I created a bean of RetryOperationsInterceptor which will create a…… Continue reading Configuring RetryTemplate (using Interceptor)

Asynchronous REST api call using JAX-RS Client api (Part 2)

In the previous post under JAX-RS Client, I showed with example, one way of making asynchronous request for a resource using JAX-RS api. In this post, I will show another way in which we can achieve the same thing. In the first approach, once we made the asynchronous call, we were continuously looping, checking the…… Continue reading Asynchronous REST api call using JAX-RS Client api (Part 2)

Asynchronous REST api call using JAX-RS Client api (Part 1)

Till now in all my previous posts under JAX-RS client, the examples I showed made synchronous call to REST resource using JAX-RS client api. In this post under JAX-RS client, I will show with example how to make an asynchronous call to REST resource using JAX-RS client api. Below is the complete code for your…… Continue reading Asynchronous REST api call using JAX-RS Client api (Part 1)

Setting Cookies using JAX-RS client

In this post under JAX-RS I will show with example how to set cookies, when making REST api calls, using JAX-RS client api. Below is the complete code for your reference. Main Class 1 package defaultPackage; 2 3 import jakarta.ws.rs.client.Client; 4 import jakarta.ws.rs.client.ClientBuilder; 5 import jakarta.ws.rs.client.Invocation; 6 import jakarta.ws.rs.client.WebTarget; 7 import jakarta.ws.rs.core.Response; 8 9 public…… Continue reading Setting Cookies using JAX-RS client