/** * Constructor which uses {@link StoredChannel#getDefaultDataStore(DataStoreFactory)} on the given * data store factory, which is the normal use case. * * @param dataStoreFactory data store factory */ protected NotificationServlet(DataStoreFactory dataStoreFactory) throws IOException { this(StoredChannel.getDefaultDataStore(dataStoreFactory)); }
/** * Stores this notification channel in the notification channel data store, which is derived from * {@link #getDefaultDataStore(DataStoreFactory)} on the given data store factory. * * <p> * It is important that this method be called before the watch HTTP request is made in case the * notification is received before the watch HTTP response is received. * </p> * * @param dataStoreFactory data store factory */ public StoredChannel store(DataStoreFactory dataStoreFactory) throws IOException { return store(getDefaultDataStore(dataStoreFactory)); }
/** * Utility method to process the webhook notification from {@link HttpServlet#doPost} by finding * the notification channel in the given data store factory. * * <p> * It is a wrapper around * {@link #processWebhookNotification(HttpServletRequest, HttpServletResponse, DataStore)} that * uses the data store from {@link StoredChannel#getDefaultDataStore(DataStoreFactory)}. * </p> * * @param req an {@link HttpServletRequest} object that contains the request the client has made * of the servlet * @param resp an {@link HttpServletResponse} object that contains the response the servlet sends * to the client * @param dataStoreFactory data store factory * @exception IOException if an input or output error is detected when the servlet handles the * request * @exception ServletException if the request for the POST could not be handled */ public static void processWebhookNotification( HttpServletRequest req, HttpServletResponse resp, DataStoreFactory dataStoreFactory) throws ServletException, IOException { processWebhookNotification(req, resp, StoredChannel.getDefaultDataStore(dataStoreFactory)); }