-
Notifications
You must be signed in to change notification settings - Fork 96
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
Adds a factory for building ResponseProcessor
.
#663
Conversation
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.
Changes are pretty good. Prob. some minor issues
@@ -172,7 +176,8 @@ public DataServlet( | |||
BroadcastChannel<String> preResponseStoredNotifications, | |||
HttpResponseMaker httpResponseMaker, | |||
ResponseFormatResolver formatResolver, | |||
DataApiRequestFactory dataApiRequestFactory | |||
DataApiRequestFactory dataApiRequestFactory, | |||
ResponseProcessorFactory responseProcessorFactory |
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.
Since we are changing contract of this method and there are possibilities of extending DataServlet
in downstream projects, shall we crate a new constructor and deprecate this one?
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.
We haven't been doing that for the DataServlet. And we could, but seeing as how
we always add something to this constructor whenever we need to add something
new to inject, DataServlet
would very quickly become very noisy.
Also, although it is technically possible to override the DataServlet
, I think
that's sufficiently weird and rare enough that having hordes of giant
deprecated constructors running around would do more harm than good.
Especially since this is an easy enough thing to fix.
* @return A class that implements {@link ResponseProcessorFactory}. | ||
*/ | ||
protected Class<? extends ResponseProcessorFactory> buildResponseProcessorFactory() { | ||
return ResultSetResponseProcessorFactory.class; |
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.
Prob. not a blocker for this PR, but what if other ResponseProcessor
implementations also need custom injection?
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.
Erm, that's the whole idea of this PR? If somebody wants to inject their
own custom ResponseProcessor
then they:
- Define their
CustomResponseProcessor
. - Define their
CustomResponseProcessorFactory
. - Override this method and return
CustomResponseProcessorFactory.class
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.
Do you mean if they have non-empty constructors? Then they'd need to make their
constructor injectable so that HK2 can handle 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.
Make sense
c37997e
to
f4a6054
Compare
-- We would like to do a little bit of Druid error analysis to extract some more illuminating error codes out of some of Druid's 500's. The error callback is controlled by the `ResponseProcessor`. -- Unfortunately, the `ResponseProcessor` can't be injected directly because it depends on the `DataApiRequest`, which is built directly in each request. So instead we wrap the creation of `ResponseProcessor` in a factory that can be injected.
f4a6054
to
30450bb
Compare
-- We would like to do a little bit of Druid error analysis to extract
some more illuminating error codes out of some of Druid's 500's. The
error callback is controlled by the
ResponseProcessor
.-- Unfortunately, the
ResponseProcessor
can't be injected directlybecause it depends on the
DataApiRequest
, which is built directly ineach request. So instead we wrap the creation of
ResponseProcessor
ina factory that can be injected.