A collection of Java code snippets and examples for learning and reference.
src/
├── main/
│ ├── java/
│ │ └── io/
│ │ └── weli/
│ │ ├── ai/ # AI related examples
│ │ ├── alg/ # Algorithm examples
│ │ ├── concurrent/ # Concurrency examples
│ │ ├── generic/ # Generic programming examples
│ │ ├── lang/ # Java language features
│ │ ├── reflection/ # Reflection examples
│ │ ├── rest/ # REST API examples
│ │ └── ...
│ └── resources/
└── test/
└── java/
└── io/
└── weli/
└── ...
- REST API client examples using RestAssured
- Algorithm implementations and examples
- Concurrency patterns and examples
- Generic programming examples
- Java language features exploration
- Reflection API usage examples
- AI integration examples
- And more...
- Java 21 or later
- Maven 3.9.6 or later
mvn clean install
To run the REST API client demo:
# Without proxy
mvn clean compile exec:java -Dexec.mainClass="io.weli.rest.RestApiClientDemo"
# With proxy
mvn clean compile exec:java -Dexec.mainClass="io.weli.rest.RestApiClientDemo" -Dproxy.enabled=true -Dproxy.host=localhost -Dproxy.port=7890
The demo will:
- Fetch all posts
- Get a specific post
- Create a new post
- Update a post
- Get user information
- Delete a post
mvn clean test
The project supports proxy configuration for HTTP/HTTPS requests. You can configure the proxy settings in two ways:
-
Using system properties:
mvn clean compile exec:java -Dexec.mainClass="io.weli.rest.RestApiClientDemo" -Dproxy.enabled=true -Dproxy.host=localhost -Dproxy.port=7890
-
Programmatically in your code:
System.setProperty("http.proxyHost", "localhost"); System.setProperty("http.proxyPort", "7890"); System.setProperty("https.proxyHost", "localhost"); System.setProperty("https.proxyPort", "7890");
Feel free to contribute by:
- Forking the repository
- Creating a new branch
- Making your changes
- Submitting a pull request
This project is licensed under the MIT License - see the LICENSE file for details.