@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
try {
xsrfHelper.verify(XSRF_ACTION, requireParameter(req, "token"));
} catch (XsrfTokenExpiredException e) {
throw new BadRequestException(e);
} catch (InvalidSecurityTokenException e) {
throw new BadRequestException(e);
}
String action = requireParameter(req, "action");
if ("newwave".equals(action)) {
SlobId newWaveId = waveletCreator.newConvWithGeneratedId(null, null, false);
// TODO(ohler): Send 303, not 302. See
// http://en.wikipedia.org/wiki/Post/Redirect/Get .
resp.sendRedirect(Searcher.makeWaveLink(newWaveId));
} else {
throw new BadRequestException("Unknown action: " + action);
}
}