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.

UploadPackErrorHandler.java 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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.ServiceMayNotContinueException;
  15. import org.eclipse.jgit.transport.UploadPack;
  16. /**
  17. * Handle git-upload-pack errors.
  18. *
  19. * <p>
  20. * This is an entry point for customizing an error handler for git-upload-pack.
  21. * Right before calling {@link UploadPack#uploadWithExceptionPropagation}, JGit
  22. * will call this handler if specified through {@link GitFilter}. The
  23. * implementation of this handler is responsible for calling
  24. * {@link UploadPackRunnable} 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 UploadPackErrorHandler {
  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-upload-pack request.
  40. * @throws IOException
  41. */
  42. void upload(HttpServletRequest req, HttpServletResponse rsp,
  43. UploadPackRunnable r) throws IOException;
  44. /** Process a git-upload-pack request. */
  45. public interface UploadPackRunnable {
  46. /**
  47. * See {@link UploadPack#uploadWithExceptionPropagation}.
  48. *
  49. * @throws ServiceMayNotContinueException
  50. * @throws IOException
  51. */
  52. void upload() throws ServiceMayNotContinueException, IOException;
  53. }
  54. }