This is a basic application showing kohttp usage together with Spring Boot. We are using Spring Boot 2.x, however, Spring Boot 1.x should work, except Spring MVC Router DSL.
Application allows to check temperature in chosen location.
- kohttp specific configurations is in
WeatherApplicationclass. - Spring Boot context:
WeatherControllerLocationControllerLocationRepoMockLogService
Open localhost:8080/weather in your browser.
Or use cURL
curl -X GET http://localhost:8080/weatherWeatherController use kohttp to access third party REST API with weather data.
WeatherController also use kohttp to log weather asynchronously using a specific client: extendedTimeoutClient.
LocationController expose API to get and modify you location.
Open localhost:8080/location in your browser.
Or use cURL
curl -X GET http://localhost:8080/locationChanging location using POST request.
curl -X POST \
http://localhost:8080/location \
-H 'content-type: application/x-www-form-urlencoded' \
-d location=MoscowOpen localhost:8080/weather/log in your browser.
Or use cURL
curl -X GET http://localhost:8080/weather/logNote: MockLogService is designed in the way that it emulates eventual consistent behaviour. Logs get accounted with a specific delay and could be reordered.
Build sample as any other SpringBoot application.
./gradlew clean bootJar Run sample as any other SpringBoot application.
./gradlew bootRun