34
loading...
This website collects cookies to deliver better user experience
https://start.microprofile.io/api/1/project?supportedServer=<SERVER>
<SERVER>
, which specifies which application server (that supports MicroProfile) to use.<SERVER>
. Well, not all application servers provide the same level of support for different versions on MicroProfile, so first, we must decide which version of MicroProfile we wish to target. Once we know that, we can select an appropriate application server and then create a project.https://start.microprofile.io/api/1/mpVersion
david ~ $ curl https://start.microprofile.io/api/1/mpVersion
["MP22","MP21","MP20","MP14","MP13","MP12"]
david ~ $ curl https://start.microprofile.io/api/1/mpVersion/MP20
{"supportedServers":["KUMULUZEE","LIBERTY","PAYARA_MICRO","TOMEE"],"specs":["CONFIG","FAULT_TOLERANCE","JWT_AUTH","METRICS","HEALTH_CHECKS","OPEN_API","OPEN_TRACING","REST_CLIENT"]}
This api call tells us that Kumuluzee, Open Liberty, Payara Micro and TomEE support version 2.0 of MicroProfile and they support the MicroProfile APIs:
Fault Tolerance
JWT Authentication
Metrics
Health Checks
Open API
Open Tracing
REST Client
david ~ $ curl -O -J https://start.microprofile.io/api/1/project?supportedServer=TOMEE
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12555 100 12555 0 0 44818 0 --:--:-- --:--:-- --:--:-- 44679
curl: Saved to filename 'demo.zip'
-O
parameter tells curl to download a file rather than output to the console. The -J
parameter tells curl to correctly name the file after it is downloaded, in this case, demo.zip
. If the -J parameter was not specified, the downloaded file would be called project?supportedServer=TOMEE
demo/src/test/java/.gitkeep
demo/src/main/webapp/WEB-INF/beans.xml
demo/src/main/java/com/example/demo/HelloController.java
demo/pom.xml
demo/src/main/java/com/example/demo/health/ServiceHealthCheck.java
demo/src/main/resources/META-INF/microprofile-config.properties
demo/src/main/java/com/example/demo/resilient/ResilienceController.java
demo/src/main/webapp/.gitkeep
demo/src/test/java/com/example/demo/JWTClient.java
demo/src/main/java/com/example/demo/config/ConfigTestController.java
demo/src/test/resources/privateKey.pem
demo/src/main/java/com/example/demo/DemoRestApplication.java
demo/readme.md
demo/src/main/resources/.gitkeep
demo/src/main/java/com/example/demo/secure/ProtectedController.java
demo/src/test/java/com/example/demo/MPJWTToken.java
demo/src/main/resources/publicKey.pem
demo/src/main/webapp/index.html
demo/src/main/java/com/example/demo/metric/MetricController.java
com.example.demo
. We can easily refactor this in an IDE, or we could specify the Maven Group and Artifact Id’s and have the project created exactly as we want it, by appending the groupId
and artifactId
arguments to the call.groupId
of com.acme
and an artifactId
of customer-service
, we would append the groupId
and artifactId
parameters as:david ~ $ curl -O -J 'https://start.microprofile.io/api/1/project?supportedServer=TOMEE&groupId=com.acme&artifactId=customer-service'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13420 100 13420 0 0 45698 0 --:--:-- --:--:-- --:--:-- 45802
curl: Saved to filename 'customer-service.zip'
customer-service.zip
and its contents are:customer-service/src/main/java/com/acme/customer/service/metric/MetricController.java
customer-service/src/main/java/com/acme/customer/service/resilient/ResilienceController.java
customer-service/pom.xml
customer-service/src/main/java/com/acme/customer/service/CustomerserviceRestApplication.java
customer-service/src/main/webapp/index.html
customer-service/src/main/webapp/WEB-INF/beans.xml
customer-service/src/main/java/com/acme/customer/service/HelloController.java
customer-service/src/main/java/com/acme/customer/service/config/ConfigTestController.java
customer-service/src/main/webapp/.gitkeep
customer-service/src/main/resources/META-INF/microprofile-config.properties
customer-service/src/main/resources/.gitkeep
customer-service/src/test/resources/privateKey.pem
customer-service/src/test/java/com/acme/customer/service/JWTClient.java
customer-service/src/main/java/com/acme/customer/service/health/ServiceHealthCheck.java
customer-service/src/main/resources/publicKey.pem
customer-service/src/main/java/com/acme/customer/service/secure/ProtectedController.java
customer-service/src/test/java/.gitkeep
customer-service/readme.md
customer-service/src/test/java/com/acme/customer/service/MPJWTToken.java
selectedSpecs
parameter. The values used for this parameter are those returned in the curl shown at the beginning of this post.david ~ $ curl -O -J 'https://start.microprofile.io/api/1/project?supportedServer=TOMEE&groupId=com.acme&artifactId=customer-service&selectedSpecs=CONFIG&selectedSpecs=FAULT_TOLERANCE'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6107 100 6107 0 0 17580 0 --:--:-- --:--:-- --:--:-- 17548
curl: Saved to filename 'customer-service.zip'