BASIC / CATATAN</>↗Basic29 Mei 2025
In Java 17, switch expressions provide a more concise and streamlined way to handle conditional logic. This feature was introduced in Java 12 as a preview and made a standard feature in Java 14. Java 17, being a Long-Term Support version, includes this feature as well. Let me guide you through how to use them. […]
JAVA 10 / CATATAN</>↗Java 1028 Mei 2025
Java 10 introduced Thread-Local Handshakes as a powerful feature in the JVM, designed to improve the performance and responsiveness of applications, especially in scenarios involving thread-based operations and garbage collection. Here’s what you need to know about Thread-Local Handshakes and how to leverage them for performance tuning: 1. What are Thread-Local Handshakes? Thread-Local Handshakes allow […]
JSCH / CATATAN</>↗JSch28 Mei 2025
When using JSch (Java Secure Channel) to connect to an SSH server, you can enable strict host key checking and validate the server against a known_hosts file. By default, strict host key checking ensures that your application will only connect to SSH servers that are already listed in the known_hosts file. If the server’s key […]
JSCH / CATATAN</>↗JSch27 Mei 2025
When transferring files over SFTP using JSch, resuming partially transferred files (either uploads or downloads) can be implemented by handling offsets for files that are already partially transferred. This guide explains how to: Resume downloads by continuing from the last transferred byte of a local file. Resume uploads by appending to a remote file. Handling […]
HTTPCLIENT / CATATAN</>↗HttpClient27 Mei 2025
Securing API requests with OAuth2 using Java 11’s HttpClient involves obtaining an access token from the OAuth2 provider and including it in the header of your HTTP requests. Here’s a step-by-step guide: 1. Understand OAuth2 Flow OAuth2 involves several flows (e.g., Authorization Code, Client Credentials, etc.). For simplicity, we’ll focus on the Client Credentials Grant […]
HTTPCLIENT / CATATAN</>↗HttpClient26 Mei 2025
If you are using Java 11’s HttpClient and want to log request and response details, you can achieve this by implementing a custom utility. Java 11’s HttpClient provides flexibility to log and inspect both requests and responses using its APIs. Here’s how you can log them: Full Implementation for Logging Request and Response Below is […]