Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Architecture board] Should root exposed endpoints respect context root path set by user #163

Open
xstefank opened this issue Jan 29, 2020 · 5 comments
Labels
Architecture board Issues across more MP specifications

Comments

@xstefank
Copy link
Member

For instance, in Health we have defined /health endpoint in Metrics /metrics endpoint. If the user sets the root context path (@ApplicationPath("/api")) should the context root path be respected also for these endpoints? That is, should it be:

a/ http://localhost:8080/health
b/ http://localhost:8080/api/health

Just to be precise, this would influence Health, Metrics, OpenAPI, and soon to be introduced GraphQL and potentially AsyncAPI.

@xstefank xstefank added the Architecture board Issues across more MP specifications label Jan 29, 2020
@rdebusscher
Copy link
Member

Since /health and /metrics are runtime endpoints and not application endpoints, this should stay a)

If it is application based, then the OpenAPI documents needs to be generated per application. But health is also about runtime, not application only. so it doesn't make sense to have it per application.

@jmartisk
Copy link
Contributor

jmartisk commented Jan 30, 2020

@ApplicationPath is a JAX-RS annotation, it decides where the application REST endpoints will be located. Metrics and health endpoints are IMO not considered application REST endpoints.

If the application also contains some servlets apart from JAX-RS endpoints, these servlets will not respect @ApplicationPath. So it does not mean that everything in the application will be under that path.

Furthermore, it apparently is possible to have multiple JAX-RS applications (and therefore multiple @ApplicationPath annotations) within one deployment (see http://www.adam-bien.com/roller/abien/entry/multiple_jax_rs_uris_in) so we wouldn't be able to tell which one is the correct one.

So my vote is strongly for a)

@phillip-kruger
Copy link
Member

We discussed this in the GraphQL meeting. For us, it more about the context path (and not the application path).

Most runtimes use / as the context path, as with runtimes we assume a microservice. So in that case the endpoints should be under /. (quarkus, thorntail, payara-micro etc.)

Most application servers use the war name (or what ever is set in WEB-INF) as the context root, as there can be more that one app on the app server.

Ex: /myapp/

So for us (GraphQL) we always use the context path as the root. If the user set the context root when using a runtime (eg thorntail) the endpoint will be available under the context root.

I think this is a good approach, as this allows MP apis to work on traditional application servers. without having to merge endpoints from different (possibly unrelated) applications.

@xstefank
Copy link
Member Author

Thank you all for ideas. Since the architecture call is for now not happening because of the working group discussions, how can we reach a decision here? cc/ @kenfinnigan

@rdebusscher
Copy link
Member

Most runtimes use / as the context path, as with runtimes we assume a microservice. So in that case the endpoints should be under /. (quarkus, thorntail, payara-micro etc.)

Not correct for Payara (Micro). The context path can be configured by the user.

Runtime specific data (like /metrics and /health) should stay at / because application independent.

I'm not completely familiar with the use-case for GraphQL, but when it is application specific (which I think it is), it can be under the context root of the application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture board Issues across more MP specifications
Projects
None yet
Development

No branches or pull requests

4 participants