Class GraphQLServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class GraphQLServlet
    extends org.apache.sling.api.servlets.SlingAllMethodsServlet
    Servlet that can be activated to implement the standard GraphQL "protocol" as per https://graphql.org/learn/serving-over-http/ This servlet is only active if the corresponding OSGi configurations are created. This allows is to be mounted either on a path to support the "traditional" GraphQL single-endpoint mode, or on specific resource types and selectors to turn specific Sling Resources into GraphQL endpoints.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  GraphQLServlet.Config  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String P_QUERY  
    • Constructor Summary

      Constructors 
      Constructor Description
      GraphQLServlet()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void doGet​(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)  
      void doPost​(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)  
      • Methods inherited from class org.apache.sling.api.servlets.SlingAllMethodsServlet

        doDelete, doPut, getAllowedRequestMethods, isMethodValid, mayService
      • Methods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet

        doGeneric, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log
    • Constructor Detail

      • GraphQLServlet

        public GraphQLServlet()
    • Method Detail

      • doGet

        public void doGet​(org.apache.sling.api.SlingHttpServletRequest request,
                          org.apache.sling.api.SlingHttpServletResponse response)
                   throws IOException
        Overrides:
        doGet in class org.apache.sling.api.servlets.SlingSafeMethodsServlet
        Throws:
        IOException
      • doPost

        public void doPost​(org.apache.sling.api.SlingHttpServletRequest request,
                           org.apache.sling.api.SlingHttpServletResponse response)
                    throws IOException
        Overrides:
        doPost in class org.apache.sling.api.servlets.SlingAllMethodsServlet
        Throws:
        IOException