code: protected int statusCodeForException(@Nonnull Throwable exception) {
          if (exception instanceof PApplicationException) {
              PApplicationException e = (PApplicationException) exception;
              if (e.getId() == PApplicationExceptionType.INVALID_PROTOCOL ||
                  e.getId() == PApplicationExceptionType.PROTOCOL_ERROR ||
                  e.getId() == PApplicationExceptionType.BAD_SEQUENCE_ID ||
                  e.getId() == PApplicationExceptionType.INVALID_MESSAGE_TYPE) {
                  return HttpServletResponse.SC_BAD_REQUEST;
              }
              if (e.getId() == PApplicationExceptionType.UNKNOWN_METHOD) {
                  return HttpServletResponse.SC_NOT_FOUND;
              }
          }
          return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
      }
docs: With default exception handling, this can simply change the status code used
  for the response.
  
  @param exception The exception seen.
  @return The status code to be used.