How johnson-phillips/httplibrary works
Purpose and Entry Points
A Java HTTP client library for GET/POST requests with two request-signing options: AWS Signature Version 4 and OAuth 1.0a. The consumer-facing request abstraction is src/main/java/http/HTTPRequest.java; OAuth usage is implemented through src/main/java/http/SimpleOauth10.java.
Request Orchestration
HTTPRequest is the primary control point: it represents an outbound HTTP request and likely owns method, URL, headers, body, connection execution, and response handling. Authorization logic should decorate or supply headers before this execution boundary. Paths: src/main/java/http/HTTPRequest.java, src/main/java/http/SimpleOauth10.java.
AWS SigV4 Signing Pipeline
AWS signing is separated into a reusable base plus an Authorization-header-specific signer. The pipeline constructs canonical request material, derives signing keys, calculates the signature, and emits an AWS Authorization header for the HTTP layer. Paths: src/main/java/awsauth/AWS4SignerBase.java, src/main/java/awsauth/AWS4SignerForAuthorizationHeader.java.
AWS Canonicalization Boundary
AWS-specific URL/query/header normalization is isolated from the generic HTTP client. HttpUtils handles HTTP-oriented canonicalization/encoding support, while BinaryUtils supports byte-level hashing or hex encoding used by signature generation. Paths: src/main/java/awsauth/HttpUtils.java, src/main/java/awsauth/BinaryUtils.java, src/main/java/awsauth/AWS4SignerBase.java.
OAuth 1.0a Flow
SimpleOauth10 provides the alternative authorization path: it generates OAuth request parameters and signature data, then integrates those values into the outbound request. This is a distinct credential/signature model from AWS SigV4 but shares the same HTTP transport boundary. Paths: src/main/java/http/SimpleOauth10.java, src/main/java/http/HTTPRequest.java.
Runtime and External Boundaries
The library runs on the JVM and is Maven-packaged as HttpLibrary version 1.0-SNAPSHOT. Its external boundary is arbitrary HTTP endpoints, including AWS services that accept SigV4 Authorization headers and OAuth 1.0a-protected APIs. Published Maven-style outputs, including a dependency-bundled JAR, are present under artifact/HttpLibrary/HttpLibrary/1.0-SNAPSHOT/.
Validation and Distribution
The available test entry point is src/test/java/HttpTest.java. Maven package metadata and distributable artifacts are tracked in pom.xml and artifact/HttpLibrary/HttpLibrary/1.0-SNAPSHOT/, indicating the project is intended for library consumption rather than as a standalone service.
Components 12
HTTP Client
- HTTPRequest · Owns outbound request execution and response handling.
src/main/java/http/HTTPRequest.java
AWS SigV4
- AWS4SignerBase · Builds canonical material, derives keys, and calculates signatures.
src/main/java/awsauth/AWS4SignerBase.java - AWS4SignerForAuthorizationHeader · Emits the AWS Authorization header.
src/main/java/awsauth/AWS4SignerForAuthorizationHeader.java - HttpUtils · Provides HTTP URL, query, and header encoding support.
src/main/java/awsauth/HttpUtils.java - BinaryUtils · Supports hashing-related byte and hex encoding.
src/main/java/awsauth/BinaryUtils.java
OAuth 1.0a
- SimpleOauth10 · Generates OAuth parameters and signature data.
src/main/java/http/SimpleOauth10.java
Build & Distribution
- Maven project · Packages HttpLibrary 1.0-SNAPSHOT.
pom.xml - Published artifacts · Includes distributable and dependency-bundled JAR outputs.
Other components
- Library consumer · Creates requests and selects an authorization flow.
- JVM
- HTTP endpoints · Arbitrary HTTP services, including OAuth-protected APIs.
- AWS services · Accept SigV4 Authorization headers.
Connections 12
- Library consumer → HTTPRequest: creates and executes
- Library consumer → SimpleOauth10: uses OAuth flow
- SimpleOauth10 → HTTPRequest: supplies OAuth values
- AWS4SignerForAuthorizationHeader → HTTPRequest: supplies Authorization header
- AWS4SignerForAuthorizationHeader → AWS4SignerBase: extends signing core
- AWS4SignerBase → HttpUtils: canonicalizes HTTP data
- AWS4SignerBase → BinaryUtils: hashes and hex-encodes
- HTTPRequest → HTTP endpoints: sends GET/POST
- HTTPRequest → AWS services: calls with SigV4 headers
- JVM → HTTPRequest: runs
- Maven project → Published artifacts: packages
- Published artifacts → Library consumer: distributed to