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

GraphQLServletListener cant be registered in OSGI #164

Closed
maarten-blokker opened this issue Apr 16, 2019 · 4 comments
Closed

GraphQLServletListener cant be registered in OSGI #164

maarten-blokker opened this issue Apr 16, 2019 · 4 comments
Labels
Milestone

Comments

@maarten-blokker
Copy link

maarten-blokker commented Apr 16, 2019

Im trying to register a GraphQLServletListener so i can set some headers on the response. When i register a listener in OSGI, the following code should pick it up and add it to the configuration:

OsgiGraphQLHttpServlet.java

    @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
    public void bindServletListener(GraphQLServletListener listener) {
        this.addListener(listener);
    }

which then calls:

AbstractGraphQLHttpServlet

    public void addListener(GraphQLServletListener servletListener) {
        configuration.add(servletListener);
    }

However, the configuration field is not initialised yet until the servlet gets registered. So an NPE is thrown.

graphql-java version: 11.0
graphql-java-servlet version: 7.3.3

@oliemansm oliemansm added the bug label Jun 20, 2019
@oliemansm oliemansm added this to the 7.5.1 milestone Jun 20, 2019
@oliemansm
Copy link
Member

Added a check and fix in 7.5.1.

@maarten-blokker
Copy link
Author

I suppose the nullpointer does not occur anymore, but the exception was symptomatic of events not occurring in the right order. You will still be unable to register a GraphQLServletListener using OSGI.

@oliemansm
Copy link
Member

oliemansm commented Jun 22, 2019 via email

@maarten-blokker
Copy link
Author

I have not verified correct behaviour yet, just made the conclusion based of the changes im seeing. I'l try to run some local tests somewhere next weeks, thanks for the effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants