Class GrpcServlet

  • All Implemented Interfaces:
    jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, java.io.Serializable

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/5066")
    public class GrpcServlet
    extends jakarta.servlet.http.HttpServlet
    A simple servlet backed by a gRPC server. Must set asyncSupported to true. The /contextRoot/urlPattern must match the gRPC services' path, which is "/full-service-name/short-method-name".

    The API is experimental. The authors would like to know more about the real usecases. Users are welcome to provide feedback by commenting on the tracking issue.

    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroy()  
      protected void doGet​(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)  
      protected void doPost​(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)  
      private static ServletAdapter loadServices​(java.util.List<? extends BindableService> bindableServices)  
      • Methods inherited from class jakarta.servlet.http.HttpServlet

        doDelete, doHead, doOptions, doPatch, doPut, doTrace, getLastModified, init, isSensitiveHeader, service, service
      • Methods inherited from class jakarta.servlet.GenericServlet

        getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • doGet

        protected final void doGet​(jakarta.servlet.http.HttpServletRequest request,
                                   jakarta.servlet.http.HttpServletResponse response)
                            throws java.io.IOException
        Overrides:
        doGet in class jakarta.servlet.http.HttpServlet
        Throws:
        java.io.IOException
      • doPost

        protected final void doPost​(jakarta.servlet.http.HttpServletRequest request,
                                    jakarta.servlet.http.HttpServletResponse response)
                             throws java.io.IOException
        Overrides:
        doPost in class jakarta.servlet.http.HttpServlet
        Throws:
        java.io.IOException
      • destroy

        public void destroy()
        Specified by:
        destroy in interface jakarta.servlet.Servlet
        Overrides:
        destroy in class jakarta.servlet.GenericServlet