Work in progress
provides opinionated utility classes for JAXRS project.
Add the following:
- Config
- CORS Filter
- Healthcheck
- Immediate Feature
- Security Filter
Configuration is intended to read yaml, for example on Kubernetes
Register domains for this service from Config to easily check CORS without using *
Quick check to see if the JAXRS is up (note that this does not need to imply your app is really in working order)
JAXRS feature that enable the usage of the @Immediate annotation. This annotation makes sure that the class is eagerly initialized in HK2
Simple check that:
- checks if security is needed (in Config)
- reads a JWT token
- Validates the token
Expected the following on the classpath:
- jaxrs implementation
- javax inject implementation
- javax annotation implementation
- hk2-api implementation
- swagger annotation implementation
- jackson implementation
JAXRS 2.0 is the reference implementation that works.
Microservice template is a reference implementation for, amongst others, this library.
Include dependency:
dependencies {
compile "com.wijdemans:jaxrs-standard:1.0.0"
}
To run a task from Gradle we need to add PROPERTIES_LOCATION to the environment.
task(run, dependsOn: 'classes', type: JavaExec) {
environment 'PROPERTIES_LOCATION', file('./properties/local').absolutePath
main = 'com.wijdemans.Main'
classpath = sourceSets.main.runtimeClasspath
}
Add to container:
class Main {
private ResourceConfig createResourceConfig () {
final ResourceConfig rc = new ResourceConfig();
rc.register(JaxRsErrorMapper.class);
return rc;
}
}