Utility method to process the webhook notification from HttpServlet#doPost.
The HttpServletRequest#getInputStream() is closed in a finally block inside this
method. If it is not detected to be a webhook notification, an HttpServletResponse#SC_BAD_REQUEST error will be displayed. If the notification channel is
found in the given notification channel data store, it will call UnparsedNotificationCallback#onNotification for the registered notification callback method.
Parameters
Name
Description
req
jakarta.servlet.http.HttpServletRequest
an HttpServletRequest object that contains the request the client has made
of the servlet
resp
jakarta.servlet.http.HttpServletResponse
an HttpServletResponse object that contains the response the servlet sends
to the client
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-15 UTC."],[],[],null,["# Class WebhookUtils (2.8.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.8.1 (latest)](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils)\n- [2.8.0](/java/docs/reference/google-api-client/2.8.0/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils)\n- [2.7.2](/java/docs/reference/google-api-client/2.7.2/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils)\n- [2.6.0](/java/docs/reference/google-api-client/2.6.0/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils)\n- [2.5.1](/java/docs/reference/google-api-client/2.5.1/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils)\n- [2.4.1](/java/docs/reference/google-api-client/2.4.1/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils)\n- [2.1.2](/java/docs/reference/google-api-client/2.1.2/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils)\n- [2.0.1](/java/docs/reference/google-api-client/2.0.1/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils)\n- [1.35.2](/java/docs/reference/google-api-client/1.35.2/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils)\n- [1.34.1](/java/docs/reference/google-api-client/1.34.1/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils)\n- [1.33.4](/java/docs/reference/google-api-client/1.33.4/com.google.api.client.googleapis.extensions.servlet.notifications.jakarta.WebhookUtils) \n\n public final class WebhookUtils\n\nBeta \n\nUtilities for Webhook notifications using the `jakarta.servlet` namespace. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e WebhookUtils \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Fields\n-------------\n\n### TYPE\n\n public static final String TYPE\n\nWebhook notification channel type to use in the watch request.\n\nStatic Methods\n--------------\n\n### processWebhookNotification(HttpServletRequest req, HttpServletResponse resp, DataStore\\\u003cStoredChannel\\\u003e channelDataStore)\n\n public static void processWebhookNotification(HttpServletRequest req, HttpServletResponse resp, DataStore\u003cStoredChannel\u003e channelDataStore)\n\nUtility method to process the webhook notification from HttpServlet#doPost.\n\nThe HttpServletRequest#getInputStream() is closed in a finally block inside this\nmethod. If it is not detected to be a webhook notification, an HttpServletResponse#SC_BAD_REQUEST error will be displayed. If the notification channel is\nfound in the given notification channel data store, it will call [UnparsedNotificationCallback#onNotification](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.UnparsedNotificationCallback#com_google_api_client_googleapis_notifications_UnparsedNotificationCallback_onNotification_) for the registered notification callback method.\n\n### processWebhookNotification(HttpServletRequest req, HttpServletResponse resp, DataStoreFactory dataStoreFactory)\n\n public static void processWebhookNotification(HttpServletRequest req, HttpServletResponse resp, DataStoreFactory dataStoreFactory)\n\nUtility method to process the webhook notification from HttpServlet#doPost by finding\nthe notification channel in the given data store factory.\n\nIt is a wrapper around #processWebhookNotification(HttpServletRequest, HttpServletResponse, DataStore) that uses the data store from [StoredChannel#getDefaultDataStore(DataStoreFactory)](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.StoredChannel#com_google_api_client_googleapis_notifications_StoredChannel_getDefaultDataStore_com_google_api_client_util_store_DataStoreFactory_)."]]