The specific way you do this depends on your language and platform, but the gist of it is that you log the notification request body.
The Java quick start is actually already doing it in [NotifyServlet.java][2]
. It does some quick checks on the request body and logs it to info.
public class NotifyServlet extends HttpServlet {
private static final Logger LOG = Logger.getLogger(MainServlet.class.getSimpleName());
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// Respond with OK and status 200 in a timely fashion to prevent redelivery
response.setContentType("text/html");
Writer writer = response.getWriter();
writer.append("OK");
writer.close();
// Get the notification object from the request body (into a string so we
// can log it)
BufferedReader notificationReader =
new BufferedReader(new InputStreamReader(request.getInputStream()));
String notificationString = "";
// Count the lines as a very basic way to prevent Denial of Service attacks
int lines = 0;
while (notificationReader.ready()) {
notificationString += notificationReader.readLine();
lines++;
// No notification would ever be this long. Something is very wrong.
if(lines > 1000) {
throw new IOException("Attempted to parse notification payload that was unexpectedly long.");
}
}
LOG.info("got raw notification " + notificationString);
JsonFactory jsonFactory = new JacksonFactory();
...
Once this code runs, visit your log, copy the JSON and use it with curl to post it back to your local server.