How guinetik/rocketrest works
Project type and purpose
• This is a Java 8 library (rocketrest-core) for making HTTP API requests via a clean, fluent interface, plus an examples module demonstrating usage.
• It provides synchronous, asynchronous and “fluent” (Result-pattern) APIs, pluggable authentication, JSON serialization, circuit-breaker support, and client decorators.
File structure
• Top-level modules:
• rocketrest-core – the core library under src/main/java/com/guinetik/rr
• examples – a Maven project showing how to call RocketRest in user code
• Within rocketrest-core:
• Facade and config: RocketRest, RocketRestConfig, RocketRestOptions
• API clients: AbstractApiClient, DefaultApiClient, AsyncApiClient, FluentApiClient
• HTTP layer: RocketClientFactory → RocketClient (interface) → DefaultHttpClient, AsyncHttpClient, CircuitBreakerClient, MockRocketClient
• Auth strategies: AuthStrategyFactory → BasicAuth, BearerToken, OAuth2*, NoAuth
• JSON: JsonObjectMapper
• Request/response: RequestBuilder, RequestSpec, Result, ApiError
• Utilities: StreamUtils, ResponseLogger
• Build and CI: Maven poms, GitHub workflows, examples POM
README for additional insights
• It describes the architecture in terms of a facade (RocketRest) over configurable clients, pluggable authentication, and decorators (circuit-breaker, custom).
• Emphasizes minimal dependencies (Jackson, SLF4J) and compatibility with JDK8.
a. Main components
1) Top-level Facade (RocketRest)
2) Configuration module (RocketRestConfig, Options)
3) Client Factory (RocketClientFactory)
4) API Client implementations (DefaultApiClient, AsyncApiClient, FluentApiClient)
5) HTTP transport layer (DefaultHttpClient → HttpURLConnection, AsyncHttpClient)
6) Decorators (CircuitBreakerClient, custom decorators)
7) Authentication strategies (AuthStrategy variants)
8) JSON serialization (JsonObjectMapper)
9) Request building (RequestBuilder, RequestSpec)
10) Result/Error handling (Result, ApiError)
11) Utilities (ResponseLogger, StreamUtils)
b. Relationships and data flow
• User code calls RocketRest (sync(), async(), fluent() or direct)
• RocketRest delegates to the appropriate ApiClient
• ApiClient uses RequestBuilder to compose HTTP requests
• AuthStrategy injects credentials into requests
• Requests pass to RocketClientFactory → chosen RocketClient
• HTTP client (DefaultHttpClient or AsyncHttpClient) executes via HttpURLConnection
• CircuitBreakerClient wraps the HTTP client if enabled
• Responses flow back through JsonObjectMapper into POJOs or Result objects
• Errors map to ApiError or exceptions
c. Architectural patterns
• Facade (RocketRest)
• Factory (RocketClientFactory)
• Strategy (AuthStrategy)
• Decorator (CircuitBreakerClient, custom decorators)
• Result pattern for error handling
• Asynchronous adapter (CompletableFuture via AsyncApiClient)
d. Key technologies
• Java 8, CompletableFuture
• HttpURLConnection (default transport)
• Jackson (JSON)
• SLF4J (logging)
Emphasize
• Be detailed: capture every package-level component.
• Keep RocketRest prominently at the top.
• Extension points (AuthStrategy, decorators) with special borders or callouts.