-
Notifications
You must be signed in to change notification settings - Fork 23
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
Would like the ability to calculate a base path from a JAX-RS Application type in a specific package, unrelated to @RESTClient type #229
Comments
hi @scottkurz, I'm not quite clear on what you're referring to as an "application from some other package"? Do you mean that you have a resource class like |
That's right. I was referring to the introspection done by RestClientBuilder.locateApplicationPath() |
Ok, I understand the scenario now thanks. A few questions now:
Currently a heuristic is used where the first 3 packages of the resource class will be scanned. Ultimately the auto-package scanning is a heuristic, so currently the backup way is to use @RESTClient(applicationPath = "/api") // since @ApplicationPath cannot be auto-detected from pkg scanning
public static StarterResource appService; or, we could roll the entire path into a single (more generic) annotation attribute: @RESTClient(path = "/api/starter")
public static StarterResource appService; |
I would say the error msg was reasonably clear. It didn't completely jump out at me but wasn't hard to see looking over it a couple times:
My use case has the Application "pre-generated" from the application stack starter (at https://github.com/OpenLiberty/application-stack-starters). This is kind of primitive compared to many starters since the package name isn't customizable. So I always get dev.odo.starter.StarterApplication as my Application but I might want to develop my resources in another package name, e.g. I use dev.odo.sample.SampleResource here. I'm just looking for something simple-looking and transparent to use with the starter, for people to learn without frustration in simple, getting started apps. Just for this use case it doesn't seem worth engineering too complex a solution. It seems like: @RESTClient(applicationPath = "/api") // since @ApplicationPath cannot be auto-detected from pkg scanning
public static StarterResource appService; could be a simple solution which in a simple sample would be easy to understand to see how the client/server paths align. |
I'd like to be able to use:
but to use an Application from some other package.
At the moment, MST will start from the Resource class and look for an Application in the same package, (understandably not wanting to scan the whole classloader tree).
Interested to hear ideas here on how this could fit into MST config or extension.
This basic mapping strikes me as maybe one that could have come up in other JAX-RS-related contexts, but admit I haven't done much resource to see if there's something already to build off of (completely separate from MST).
The text was updated successfully, but these errors were encountered: