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

Make disableDefaultExceptionMapperRegistration public in StandardExceptionMappers #483

Closed
sleberknight opened this issue Apr 30, 2024 · 1 comment · Fixed by #484
Closed
Assignees
Labels
enhancement A request for change or improvement to an existing feature
Milestone

Comments

@sleberknight
Copy link
Member

The disableDefaultExceptionMapperRegistration method has been around for many years, but is private. To provide more flexibility to applications which might want to disable Dropwizard's default exception mappers programmatically instead of static, repetitive YAML configuration, make this method public.

This will allow applications to easily disable Dropwizard's default exception mappers, and then register only the exception mappers they want instead of getting the opinionated set of them that the StandardExceptionMappers#register methods provide.

@sleberknight sleberknight added the enhancement A request for change or improvement to an existing feature label Apr 30, 2024
@sleberknight sleberknight added this to the 3.6.0 milestone Apr 30, 2024
@sleberknight sleberknight self-assigned this Apr 30, 2024
@sleberknight
Copy link
Member Author

We should also "optimize" this method so that it directly calls the setter method if the ServerFactory is an instance of AbstractServerFactory. Since Dropwizard has provided only two implementations (DefaultServerFactory and SimpleServerFactory) for many, many years, they probably won't be changing this anytime soon. And, doing this avoids the overhead of the reflective call. Last, while it is highly unlikely we'll ever need it, we can keep the existing reflective code but only invoke if the ServerFactory is not an instance of AbstractServerFactory.

sleberknight added a commit that referenced this issue Apr 30, 2024
…ptionMappers

* Make disableDefaultExceptionMapperRegistration public
* Directly call setter method if argument is an AbsractServerFactory
* Enhance exception methods when reflective invocation fails
* Add/update javadocs

Closes #483
sleberknight added a commit that referenced this issue Apr 30, 2024
…ptionMappers (#484)

* Make disableDefaultExceptionMapperRegistration public
* Directly call setter method if argument is an AbsractServerFactory
* Enhance exception methods when reflective invocation fails
* Add/update javadocs

Closes #483
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A request for change or improvement to an existing feature
Projects
None yet
1 participant