Methanol is an extensible HTTP client library built on Java's java.net.http package. It provides core HTTP functionality enhanced with features like automatic decompression (gzip, deflate, Brotli), pluggable body adapters for JSON/XML/Protobuf, HTTP caching with multiple backends (memory, disk, Redis), request/response interceptors, retry mechanisms, progress tracking, and Kotlin DSL support. The library follows a modular architecture with separate modules for core functionality, format adapters, extensions, and testing. Key entry points include Methanol.Builder for client creation, MutableRequest for request building, and BodyAdapter for encoding/decoding. Data flows involve request interception, body encoding, HTTP exchange via java.net.http, response interception, body decoding, and optional caching/progress tracking. External dependencies vary by module: core requires only JDK 11+, while adapters depend on libraries like Jackson/Gson/Moshi, extensions on Redis Lettuce or native Brotli, and testing on JUnit5/MockWebServer.
This repository is a Spring Guide tutorial demonstrating how to build a Spring Boot web application that accepts HTTP multipart file uploads. It contains four project variants: initial and complete versions in both Java and Kotlin, each with Maven and Gradle build files. The complete version adds a FileUploadController with endpoints for listing uploaded files, serving them as downloads, and handling uploads, plus a StorageService abstraction backed by a FileSystemStorageService that writes files to a configurable local directory (default 'upload-dir'). A Thymeleaf template provides a simple HTML upload form. The application is a small monolith: Spring MVC controllers handle GET / (list files), POST / (store uploaded file), and GET /files/{filename} (download with Content-Disposition). The storage layer uses java.nio.file APIs and includes a path traversal protection check that rejects filenames escaping the root directory. Upload size limits are configured via spring.servlet.multipart properties. Tests cover controller behavior with MockMvc, storage service security cases, and full integration tests using RestTestClient with redirect handling. This is educational sample code, not a production service. It demonstrates clean separation between web layer and storage abstraction, and the complete version includes meaningful security and testing patterns that can be reused in real projects. The code is actively maintained, uses current Spring Boot 4.0.x and Java 17, and is well-suited as a reference for implementing file upload endpoints.