Class BackgroundFunctionExecutor

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

    public final class BackgroundFunctionExecutor
    extends javax.servlet.http.HttpServlet
    Executes the user's background function.
    See Also:
    Serialized Form
    • Method Detail

      • maybeForClass

        public static Optional<BackgroundFunctionExecutor> maybeForClass​(Class<?> functionClass)
        Optionally makes a BackgroundFunctionExecutor for the given class, if it implements one of BackgroundFunction, RawBackgroundFunction, or CloudEventsFunction. Otherwise returns Optional.empty().
        Parameters:
        functionClass - the class of a possible background function implementation.
        Throws:
        RuntimeException - if the given class does implement one of the required interfaces, but we are unable to construct an instance using its no-arg constructor.
      • service

        public void service​(javax.servlet.http.HttpServletRequest req,
                            javax.servlet.http.HttpServletResponse res)
                     throws IOException
        Executes the user's background function. This can handle all HTTP methods.
        Overrides:
        service in class javax.servlet.http.HttpServlet
        Throws:
        IOException