You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ReceivePackErrorHandler.java 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2019, Google LLC and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * http://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.http.server;
  11. import java.io.IOException;
  12. import javax.servlet.http.HttpServletRequest;
  13. import javax.servlet.http.HttpServletResponse;
  14. import org.eclipse.jgit.transport.ReceivePack;
  15. import org.eclipse.jgit.transport.ServiceMayNotContinueException;
  16. /**
  17. * Handle git-receive-pack errors.
  18. *
  19. * <p>
  20. * This is an entry point for customizing an error handler for git-receive-pack.
  21. * Right before calling {@link ReceivePack#receiveWithExceptionPropagation},
  22. * JGit will call this handler if specified through {@link GitFilter}. The
  23. * implementation of this handler is responsible for calling
  24. * {@link ReceivePackRunnable} and handling exceptions for clients.
  25. *
  26. * <p>
  27. * If a custom handler is not specified, JGit will use the default error
  28. * handler.
  29. *
  30. * @since 5.6
  31. */
  32. public interface ReceivePackErrorHandler {
  33. /**
  34. * @param req
  35. * The HTTP request
  36. * @param rsp
  37. * The HTTP response
  38. * @param r
  39. * A continuation that handles a git-receive-pack request.
  40. * @throws IOException
  41. */
  42. void receive(HttpServletRequest req, HttpServletResponse rsp,
  43. ReceivePackRunnable r) throws IOException;
  44. /** Process a git-receive-pack request. */
  45. public interface ReceivePackRunnable {
  46. /**
  47. * See {@link ReceivePack#receiveWithExceptionPropagation}.
  48. *
  49. * @throws ServiceMayNotContinueException
  50. * @throws IOException
  51. */
  52. void receive() throws ServiceMayNotContinueException, IOException;
  53. }
  54. }