Skip to content

Instantly share code, notes, and snippets.

@jonfriesen
Created September 20, 2025 12:31
Show Gist options
  • Save jonfriesen/6b3fc8af370f537a8ac079479e4e6c94 to your computer and use it in GitHub Desktop.
Save jonfriesen/6b3fc8af370f537a8ac079479e4e6c94 to your computer and use it in GitHub Desktop.
A list of babel java image usage examples

Java HTTP Client Docker Examples

This document provides Docker run examples for the Java Babel HTTP client images, demonstrating various HTTP request patterns according to the CLIENT_GUIDE.md specifications.

Available Java Container Images

Image Java Version Distribution Base Description
us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:11-corretto-alpine 11 Amazon Corretto Alpine Linux Minimal footprint with Corretto 11
us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:17-corretto-alpine 17 Amazon Corretto Alpine Linux LTS version with Corretto 17
us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-corretto-alpine 21 Amazon Corretto Alpine Linux Latest LTS with Corretto 21
us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jdk 21 Eclipse Temurin Ubuntu/Debian Full JDK with development tools
us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jre 21 Eclipse Temurin Ubuntu/Debian Runtime-only for production

Basic Examples

Simple GET Request

# Using Corretto 17 Alpine
docker run --rm \
  -e URL="https://httpbin.org/get" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:17-corretto-alpine

GET Request with Custom Headers

# Using Temurin JRE 21
docker run --rm \
  -e URL="https://httpbin.org/headers" \
  -e HTTP_HEADERS="User-Agent:Babel-Java-Client/1.0,Accept:application/json" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jre

POST Request with JSON Body

# Using Corretto 21 Alpine
docker run --rm \
  -e URL="https://httpbin.org/post" \
  -e HTTP_METHOD="POST" \
  -e HTTP_BODY='{"title":"Test Post","body":"This is a test","userId":1}' \
  -e HTTP_HEADERS="Content-Type:application/json" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-corretto-alpine

Authentication Examples

API Key Authentication

# Using Temurin JDK 21
docker run --rm \
  -e URL="https://httpbin.org/bearer" \
  -e HTTP_HEADERS="Authorization:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...,X-API-Key:your-api-key-here" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jdk

Basic Authentication

# Using Corretto 11 Alpine
docker run --rm \
  -e URL="https://httpbin.org/basic-auth/user/pass" \
  -e HTTP_HEADERS="Authorization:Basic dXNlcjpwYXNz" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:11-corretto-alpine

Different HTTP Methods

PUT Request

# Using Corretto 17 Alpine
docker run --rm \
  -e URL="https://httpbin.org/put" \
  -e HTTP_METHOD="PUT" \
  -e HTTP_BODY='{"id":1,"title":"Updated Post","body":"Updated content","userId":1}' \
  -e HTTP_HEADERS="Content-Type:application/json" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:17-corretto-alpine

DELETE Request

# Using Temurin JRE 21
docker run --rm \
  -e URL="https://httpbin.org/delete" \
  -e HTTP_METHOD="DELETE" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jre

PATCH Request

# Using Corretto 21 Alpine
docker run --rm \
  -e URL="https://httpbin.org/patch" \
  -e HTTP_METHOD="PATCH" \
  -e HTTP_BODY='{"title":"Patched Title"}' \
  -e HTTP_HEADERS="Content-Type:application/json" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-corretto-alpine

Request Body from File

Using Volume Mount

# Create a payload file first
echo '{"name":"John Doe","email":"[email protected]","age":30}' > /tmp/payload.json

# Using Temurin JDK 21
docker run --rm \
  -v /tmp/payload.json:/data/payload.json \
  -e URL="https://httpbin.org/post" \
  -e HTTP_METHOD="POST" \
  -e HTTP_BODY_FILE="/data/payload.json" \
  -e HTTP_HEADERS="Content-Type:application/json" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jdk

Performance and Load Testing

Multiple Sequential Requests

# Using Corretto 17 Alpine - 10 requests with 2 second delay
docker run --rm \
  -e URL="https://httpbin.org/delay/1" \
  -e REQUESTS="10" \
  -e DELAY_BETWEEN_REQUESTS="2.0" \
  -e VERBOSE="true" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:17-corretto-alpine

Health Check Monitoring

# Using Temurin JRE 21 - continuous health checks
docker run --rm \
  -e URL="https://httpbin.org/status/200" \
  -e REQUESTS="100" \
  -e DELAY_BETWEEN_REQUESTS="30" \
  -e HTTP_TIMEOUT="5" \
  -e OUTPUT_FORMAT="json" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jre

Debugging and Verbose Mode

Verbose Request Debugging

# Using Corretto 21 Alpine with full debugging
docker run --rm \
  -e URL="https://httpbin.org/anything" \
  -e HTTP_METHOD="POST" \
  -e HTTP_BODY='{"debug":"test","timestamp":"'$(date -Iseconds)'"}' \
  -e HTTP_HEADERS="Content-Type:application/json,X-Debug:true" \
  -e VERBOSE="true" \
  -e OUTPUT_FORMAT="human" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-corretto-alpine

JSON Output for Processing

# Using Temurin JDK 21 for structured output
docker run --rm \
  -e URL="https://httpbin.org/json" \
  -e OUTPUT_FORMAT="json" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jdk | jq '.response_body | fromjson | .slideshow.title'

HTTP Protocol Configuration

HTTP/1.0 Request

# Using Corretto 11 Alpine with HTTP/1.0
docker run --rm \
  -e URL="https://httpbin.org/get" \
  -e HTTP_VERSION="1.0" \
  -e HTTP_KEEP_ALIVE="off" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:11-corretto-alpine

Connection Keep-Alive

# Using Corretto 17 Alpine with keep-alive
docker run --rm \
  -e URL="https://httpbin.org/get" \
  -e HTTP_VERSION="1.1" \
  -e HTTP_KEEP_ALIVE="on" \
  -e REQUESTS="5" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:17-corretto-alpine

Real-World Use Cases

API Integration Testing

# Using Temurin JRE 21 for integration tests
docker run --rm \
  -e URL="https://httpbin.org/post" \
  -e HTTP_METHOD="POST" \
  -e HTTP_BODY="name=John+Doe&[email protected]" \
  -e HTTP_HEADERS="Authorization:Bearer test_token,Content-Type:application/x-www-form-urlencoded" \
  -e HTTP_TIMEOUT="30" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jre

Webhook Testing

# Using Corretto 21 Alpine for webhook simulation
docker run --rm \
  -e URL="https://httpbin.org/post" \
  -e HTTP_METHOD="POST" \
  -e HTTP_BODY='{"event":"user.created","data":{"id":123,"name":"Jane Smith"},"timestamp":"'$(date -Iseconds)'"}' \
  -e HTTP_HEADERS="Content-Type:application/json,X-Webhook-Source:babel-client" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-corretto-alpine

File Upload Simulation

# Create a test file
echo "This is test file content" > /tmp/upload.txt

# Using Temurin JDK 21 for file upload
docker run --rm \
  -v /tmp/upload.txt:/data/upload.txt \
  -e URL="https://httpbin.org/post" \
  -e HTTP_METHOD="POST" \
  -e HTTP_BODY_FILE="/data/upload.txt" \
  -e HTTP_HEADERS="Content-Type:text/plain,X-File-Name:upload.txt" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jdk

GraphQL Query

# Using Corretto 17 Alpine for GraphQL
docker run --rm \
  -e URL="https://httpbin.org/post" \
  -e HTTP_METHOD="POST" \
  -e HTTP_BODY='{"query":"query { viewer { login name } }"}' \
  -e HTTP_HEADERS="Authorization:Bearer test_token,Content-Type:application/json" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:17-corretto-alpine

Error Handling Examples

Timeout Testing

# Using Temurin JRE 21 with short timeout
docker run --rm \
  -e URL="https://httpbin.org/delay/10" \
  -e HTTP_TIMEOUT="5" \
  -e VERBOSE="true" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-temurin-jre

Invalid URL Handling

# Using Corretto 11 Alpine with invalid URL
docker run --rm \
  -e URL="invalid-url-format" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:11-corretto-alpine

Startup Delay Examples

Delayed Execution

# Using Corretto 21 Alpine with 5-second startup delay
docker run --rm \
  -e URL="https://httpbin.org/get" \
  -e STARTUP_DELAY="5000" \
  -e VERBOSE="true" \
  us-docker.pkg.dev/qpoint-edge/public/babel/babel-java:21-corretto-alpine

Container Selection Guidelines

  • Use 11-corretto-alpine: For legacy applications requiring Java 11
  • Use 17-corretto-alpine: For most production workloads (LTS + minimal size)
  • Use 21-corretto-alpine: For latest features with minimal footprint
  • Use 21-temurin-jdk: For development/debugging with full JDK tools
  • Use 21-temurin-jre: For production with latest Java but runtime-only

Notes

  • All images support the same environment variables as specified in CLIENT_GUIDE.md
  • Alpine-based images are smaller but may have different SSL certificate handling
  • Temurin images include more comprehensive tooling for debugging
  • JSON output can be piped to jq for processing in shell scripts
  • Use volume mounts for larger request bodies or when content comes from files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment