Modifier and Type | Field and Description |
---|---|
static String |
TYPE
Webhook notification channel type to use in the watch request.
|
Modifier and Type | Method and Description |
---|---|
static void |
processWebhookNotification(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
DataStore<StoredChannel> channelDataStore)
Utility method to process the webhook notification from
HttpServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) . |
static void |
processWebhookNotification(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
DataStoreFactory dataStoreFactory)
Utility method to process the webhook notification from
HttpServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) by finding
the notification channel in the given data store factory. |
public static final String TYPE
public static void processWebhookNotification(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, DataStoreFactory dataStoreFactory) throws javax.servlet.ServletException, IOException
HttpServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
by finding
the notification channel in the given data store factory.
It is a wrapper around
processWebhookNotification(HttpServletRequest, HttpServletResponse, DataStore)
that
uses the data store from StoredChannel.getDefaultDataStore(DataStoreFactory)
.
req
- an HttpServletRequest
object that contains the request the client has made
of the servletresp
- an HttpServletResponse
object that contains the response the servlet sends
to the clientdataStoreFactory
- data store factoryIOException
- if an input or output error is detected when the servlet handles the
requestjavax.servlet.ServletException
- if the request for the POST could not be handledpublic static void processWebhookNotification(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, DataStore<StoredChannel> channelDataStore) throws javax.servlet.ServletException, IOException
HttpServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
.
The ServletRequest.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(com.google.api.client.googleapis.notifications.StoredChannel, com.google.api.client.googleapis.notifications.UnparsedNotification)
for the registered notification callback
method.
req
- an HttpServletRequest
object that contains the request the client has made
of the servletresp
- an HttpServletResponse
object that contains the response the servlet sends
to the clientchannelDataStore
- notification channel data storeIOException
- if an input or output error is detected when the servlet handles the
requestjavax.servlet.ServletException
- if the request for the POST could not be handledCopyright © 2010–2020 Google. All rights reserved.