Archive June 2017

Convert Image to JPEG in Java with Custom Compression Quality

Converting image to JPEG in Java is quite easy task if you use javax.imageio.ImageIO class. You just call:

BufferedImage image = ...;
OutputStream output = ...;
ImageIO.write(image, "JPEG", output);
Read More

HTTPS-Enabled Java Web Application Using nginx

Today, I'd like to share my approach to secure Java web application using nginx server. Recent industry shift to a secure internet basically require all websites to provide HTTPS access. It improves search ranking and especially privacy of your visitors. So, I will share my approach how I made it for my application. This tutorial applies for Linux, specifically Debian or Ubuntu.

Our architecture is laid out on the following diagram. Our clients are accessing nginx server that forwards decrypted calls to Java application.

Read More

How to Reference a File Relative to a JAR Archive

Few weeks ago I was dealing with a task how to reference a file that is relatively placed to an application JAR file. Directories are organized in the following way:

├── lib/
│   └── application.jar
└── config/
    └── config.json
Read More

Asynchronous and Synchronous Code Patterns in Java

Enterprise applications usually connect to various systems. They can be either asynchronous (like messaging) or synchronous (like HTTP). This brings in a problem of communication between asynchronous and synchronous systems.

Read More