Java: Converting LocalDateTime to ZonedDateTime Correctly

A LocalDateTime knows the date and the time — for example, 2025-07-15T14:30:00 — but it has absolutely no concept of timezone or offset. A ZonedDateTime attaches a full IANA timezone (e.g. America/New_York) to that instant, making it globally unambiguous. Converting between the two is a common need whenever data arrives from a UI, database, or external API without timezone information attached. This guide covers every conversion scenario, explains why it matters, and shows the one-liner plus the explicit approach for each case.

Continue reading Java: Converting LocalDateTime to ZonedDateTime Correctly

Jersey REST API – Complete File Upload and Download Example

File upload is one of those features that sounds simple until you actually implement it — multipart boundaries, streaming vs buffering, size limits, and MIME-type validation all add up quickly. In this tutorial you will build a complete file-upload REST endpoint using Jersey 3.x (JAX-RS 3.1), test it with an HTML form and with curl, enforce a file-size limit, and save uploads to a configurable directory on disk.

Continue reading Jersey REST API – Complete File Upload and Download Example

Secure Your Jersey REST APIs – Complete Authentication & Authorization Guide

Exposing a REST endpoint is only half the job — you also need to control who can call it and what they are allowed to do. Jersey, the reference implementation of Jakarta RESTful Web Services (JAX-RS), provides a clean extension point through ContainerRequestFilter that lets you intercept every request before it reaches your resource class. In this guide you will implement HTTP Basic authentication, JWT Bearer-token validation, and role-based authorization step by step, using plain Jersey and then the Spring Boot integration.

Continue reading Secure Your Jersey REST APIs – Complete Authentication & Authorization Guide

Mastering Maven: How to Create Your Own Custom Archetypes

Every time you run mvn archetype:generate, Maven reads a blueprint called an archetype to scaffold your project structure. The built-in archetypes cover plain Java and simple web apps, but when your team has its own folder conventions, preferred dependencies, or boilerplate code, you need a custom archetype. In this guide you will build a complete custom Maven archetype from scratch, install it to your local repository, generate a new project from it, and optionally deploy it to a team-shared repository so your whole organisation can use it in one command.

Continue reading Mastering Maven: How to Create Your Own Custom Archetypes

Mastering Variable Declarations in TypeScript: var, let, and const Explained

When you start learning TypeScript (or JavaScript), one of the very first questions you face is: should I use var, let, or const? They all declare variables, but they behave very differently in terms of scope, hoisting, and re-assignment. Getting these rules wrong leads to subtle bugs that are notoriously hard to track down. In this guide you will understand every difference with concrete examples, see the TypeScript compiler’s role, and learn the simple rules that modern TypeScript developers follow every day.

Continue reading Mastering Variable Declarations in TypeScript: var, let, and const Explained

Mastering Credit Card Validation with Regular Expressions in Java

Validating credit card numbers at the point of entry catches typos before an expensive payment gateway call is made. In this tutorial you will learn how to use Java regular expressions to check card number format for the major card networks, and then apply the Luhn algorithm — the checksum standard built into every valid card number — to confirm the number is mathematically plausible. The combination of regex format check + Luhn checksum is the industry-standard client-side validation used by checkout pages worldwide.

Continue reading Mastering Credit Card Validation with Regular Expressions in Java

A Practical Guide to Formatting ZonedDateTime in Java

ZonedDateTime is the most complete date-time class in the modern java.time API: it stores a date, a time, and a full timezone (e.g. America/New_York). Displaying it in a human-readable or machine-readable format requires the DateTimeFormatter class. In this tutorial you will learn every important formatting pattern, understand the difference between predefined ISO formatters and custom patterns, and see how to parse a string back into a ZonedDateTime — all with annotated code examples and sample output.

Continue reading A Practical Guide to Formatting ZonedDateTime in Java