Skip to content

Make AbstractGraphQLHttpServlet to be more customisable #194

Closed
@drupalspring

Description

@drupalspring

Maybe related to #182 .

Currently , all of the request handling logic are implemented in the getHandler and postHandler , but all of its internal methods are private methods which make the subclass cannot customise the request handling logic by override the corresponding methods.

My use-case is that I would like to override the logic of setting the HttpServletResponse (e.g its status code , the content write to the outputStream)(i.e the following codes in query() )

        if (!(result.getData() instanceof Publisher)) {
            resp.setContentType(APPLICATION_JSON_UTF8);
            resp.setStatus(STATUS_OK);
            resp.getWriter().write(graphQLObjectMapper.serializeResultAsJson(result));
        }

I am thinking perhaps to refactor the logic of getHandler/postHandler into many sensible protected methods such that subclass can override it
(e.g queryIntroSpectionRequest() , setResponse() .....)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions