Class BackgroundFunctionExecutor
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- com.google.cloud.functions.invoker.BackgroundFunctionExecutor
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
public final class BackgroundFunctionExecutor extends javax.servlet.http.HttpServletExecutes the user's background function.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BackgroundFunctionExecutorforClass(Class<?> functionClass)Makes aBackgroundFunctionExecutorfor the given class.static Optional<BackgroundFunctionExecutor>maybeForClass(Class<?> functionClass)Optionally makes aBackgroundFunctionExecutorfor the given class, if it implements one ofBackgroundFunction,RawBackgroundFunction, orCloudEventsFunction.voidservice(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)Executes the user's background function.-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
-
-
-
-
Method Detail
-
maybeForClass
public static Optional<BackgroundFunctionExecutor> maybeForClass(Class<?> functionClass)
Optionally makes aBackgroundFunctionExecutorfor the given class, if it implements one ofBackgroundFunction,RawBackgroundFunction, orCloudEventsFunction. Otherwise returnsOptional.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.
-
forClass
public static BackgroundFunctionExecutor forClass(Class<?> functionClass)
Makes aBackgroundFunctionExecutorfor the given class.- Throws:
RuntimeException- if either the class does not implement one ofBackgroundFunction,RawBackgroundFunction, orCloudEventsFunction; or 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 IOExceptionExecutes the user's background function. This can handle all HTTP methods.- Overrides:
servicein classjavax.servlet.http.HttpServlet- Throws:
IOException
-
-