-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[Java][jaxrs-spec] Make contextPath template parameter available as a string constant for use in @ApplicationPath #13377
Conversation
… resource root to be used in the @ApplicationPath annotation to make it easier for people, who want to write their own jax-rs Application class
package {{invokerPackage}}; | ||
|
||
public class RestResourceRoot { | ||
public static final String ROOT = "{{{contextPath}}}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the PR. one question from me is why do we need to store this ROOT
separately in another class?
can you store it in RestApplication
for example instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using interface only, so that i can provide my own RestApplication class, where i add a bunch of exception mappers and such.
The variable could of course be defined in RestApplication, when that class is generated. In the interface only cases, i think, it would be odd to generate a RestApplication class without the @ApplicationPath annotation to hold this ROOT constant, that i am proposing. Btw perhaps APPLICATION_PATH would be a better name for this constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw perhaps APPLICATION_PATH would be a better name for this constant?
yes, please rename it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when ready, please PM me via slack for review and merged.
… use more obvious
@wing328 I have updated my pull request with a simple renaming of the constant as suggested. Can't message you on Slack though, since i do not have it installed or even have an account. |
This PR extends the jaxrs-spec template creators to generate a class RestResourceRoot.java with a single string constant ROOT with the content of the template parameter `contextPath'. Secondly the existing generation of RestApplication.java has been updated to make use of this constant in its '@ApplicationPath' annotation. This PR relates to #13374
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
(6.1.0) (minor release - breaking changes with fallbacks),7.0.x
(breaking changes without fallbacks)@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608