Runnable Pure Java JSON-RPC 2.0 sample without Spring.
From repository root:
./gradlew -p samples/pure-java-demo runFrom repository root:
./gradlew -p samples/pure-java-demo test- Single request success flow
- Notification flow (no response body)
- Mixed batch flow (request + notification + error)
- Parse error flow
- Typed handler registration (
JsonRpcTypedMethodHandlerFactory) - Manual handler registration (
dispatcher.register) - Request-validator policy switch with
JsonRpcParamsTypeViolationCodePolicy - Request validation profile with
JsonRpcRequestValidationOptions(require-id-member,allow-fractional-id,reject-response-fields) - Response validation profile with
JsonRpcResponseValidationOptions(reject-request-fields,reject-duplicate-members,error-code.policy) - Incoming response-side flow using envelope classifier, error-code classifier, parser, and validator utilities
- Interceptor lifecycle flow (
beforeValidate,beforeInvoke,afterInvoke,onError) - Outbound request composition using
JsonRpcRequestBuilderandJsonRpcRequestBatchBuilder - Direct
paramsObject(...)andparamsArray(...)builder examples for outbound requests - Manual JSON-RPC error object composition using
JsonRpcError.of(code, message, data) - Record, POJO, collection, and map params converted through Jackson and passed via
params(JsonNode)
src/main/java/com/limehee/jsonrpc/sample/purejava/PureJavaDemoApplication.javasrc/main/java/com/limehee/jsonrpc/sample/purejava/ResponseSideUtilitiesExample.javasrc/main/java/com/limehee/jsonrpc/sample/purejava/InterceptorFlowExample.javasrc/main/java/com/limehee/jsonrpc/sample/purejava/ValidationProfileExample.javasrc/main/java/com/limehee/jsonrpc/sample/purejava/OutboundRequestCompositionExample.java
The main method prints one output payload per scenario so you can follow request -> dispatch -> response flow.