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
Creating a blank worksheet
In this post under Apache Excel, I will show with example how to create a blank excel document. Below is the code for your reference. Main class 1 package package1; 2 3 import java.io.File; 4 import java.io.FileOutputStream; 5 import java.io.IOException; 6 7 import org.apache.poi.xssf.usermodel.XSSFWorkbook; 8 9 public class Example1 { 10 public static void main(String[]…… Continue reading Creating a blank worksheet
JAX-RS Client API using url template example
In this post under JAX-RS Client I will show with example how to use URL template to make rest api calls. But first what is URL template. A URL template is a template with placeholders. At runtime these placeholders are replaced with actual data forming the actual url to be requested. The placeholders are placed…… Continue reading JAX-RS Client API using url template example
JAX-RS Client API sending query parameters example
In this post under JAX-RS Client, I will show with example how to make a REST api call to a resource and send query parameters. 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…… Continue reading JAX-RS Client API sending query parameters example
Extending base URL with path segments
In this post under JAX-RS Client, I will show with example how to extend base URL with path segments. Suppose you want to access below two REST apis. These two apis return user information with id 2 and 3. https://jsonplaceholder.typicode.com/users/2https://jsonplaceholder.typicode.com/users/3 To access these two urls you will create two “WebTarget” instances as shown below WebTarget…… Continue reading Extending base URL with path segments
JAX-RS Client API simple DELETE example
In this post under JAX-RS Client, I will show with example how to perform a DELETE REST call. 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 Example4 { 10 public…… Continue reading JAX-RS Client API simple DELETE example
JAX-RS Client API simple PUT example
In this post under JAXRS Client, I will show with simple example how to use the JAXRS Client API to make a PUT request to REST api resource. Below is the complete code for the example 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.Entity; 6 import jakarta.ws.rs.client.Invocation; 7…… Continue reading JAX-RS Client API simple PUT example
JAX-RS Client API simple POST example
In this post under JAXRS Client section, I will show with simple example how to use the JAXRS Client API to make a POST request to REST api resource. Below is the complete code for the example 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.Entity; 6 import jakarta.ws.rs.client.Invocation;…… Continue reading JAX-RS Client API simple POST example