Skip to content

[REQ] [jaxrs-spec] Make contextPath available as a string constant for use in @ApplicationPath(...) #13374

@shamus13

Description

@shamus13

Hi guys,

I am trying to use the jaxrs-spec-interface server template creators to build a war application containing several independent REST services. I am using exception mappers etc specific to each service, so i am writing my own @ApplicationPath annotated classes for the services, but i find it a bit annoying, that i have to provide the base path aka 'contextPath' for the @ApplicationPath("/thePath") myself.

I would like the template creator to generate a string constant with the content of the 'contextPath', which i can use instead of a string litteral. F.x '@ApplicationPath(RootResource.ROOT)'

I have looked into custom templates etc, but i do not see a path to success going down that path.
I am using the openapi generator gradle plugin, and i do not see support for custom templates in the plugin
I am also constrained in my choice of template creators to JAXRS due to project requirements.

I have looked into the jaxrs-spec creator code and templates, and it is fairly easy to extend the creators to produce a class with the string constant, i am looking for. I will create a tiny PR for this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions