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
Author: sumanthprabhakar
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
Setting ACCEPT header using JAX-RS client
In this post under JAX-RS I will show with example how to set ACCEPT header 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 java.util.Locale; 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…… Continue reading Setting ACCEPT header using JAX-RS client
Setting headers in JAX-RS Client
In this post under JAX-RS Client, I will show with example how to set headers when sending the REST request. 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 class Example8 {…… Continue reading Setting headers in JAX-RS Client
Writing to a worksheet
In this post under Apache Excel, I will with example how to write to a worksheet. For our example, we will use a text file “Input1.txt” to read the data to be written to worksheet. The “Input1.txt” file contains comma separated values as shown below Line1Column1,Line1Column2,Line1Column3,Line1Column4 Line2Column1,Line2Column2,Line2Column3,Line2Column4 Line3Column1,Line3Column2,Line3Column3,Line3Column4 Line4Column1,Line4Column2,Line4Column3,Line4Column4 Below is the complete code for…… Continue reading Writing to a worksheet
Cloning a sheet in a Worksheet
In this post under Apache Excel, I will show how to clone an existing sheet in a Worksheet. Below is the complete code for your reference. Main class 1 package package3; 2 3 import java.io.File; 4 import java.io.FileInputStream; 5 import java.io.FileOutputStream; 6 import java.io.IOException; 7 8 import org.apache.poi.openxml4j.exceptions.InvalidFormatException; 9 import org.apache.poi.ss.usermodel.Sheet; 10 import org.apache.poi.xssf.usermodel.XSSFSheet; 11…… Continue reading Cloning a sheet in a Worksheet
Reading an excel worksheet
In this post under Apache Excel, I will show with example how to read an excel (*.xlsx) document. Below is the complete code for your reference. Main Class 1 package package2; 2 3 import java.io.File; 4 import java.io.IOException; 5 6 import org.apache.poi.openxml4j.exceptions.InvalidFormatException; 7 import org.apache.poi.xssf.usermodel.XSSFCell; 8 import org.apache.poi.xssf.usermodel.XSSFRow; 9 import org.apache.poi.xssf.usermodel.XSSFSheet; 10 import org.apache.poi.xssf.usermodel.XSSFWorkbook; 11…… Continue reading Reading an excel worksheet