aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java
blob: 843a11556ee8f8c0a9015bff47fd60957ff8279e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright (c) 2019, Google LLC  and others
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0 which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
package org.eclipse.jgit.http.server;

import java.io.IOException;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.ServiceMayNotContinueException;

/**
 * Handle git-receive-pack errors.
 *
 * <p>
 * This is an entry point for customizing an error handler for git-receive-pack.
 * Right before calling {@link ReceivePack#receiveWithExceptionPropagation},
 * JGit will call this handler if specified through {@link GitFilter}. The
 * implementation of this handler is responsible for calling
 * {@link ReceivePackRunnable} and handling exceptions for clients.
 *
 * <p>
 * If a custom handler is not specified, JGit will use the default error
 * handler.
 *
 * @since 5.7
 */
public interface ReceivePackErrorHandler {
	/**
	 * Receive pack
	 *
	 * @param req
	 *            The HTTP request
	 * @param rsp
	 *            The HTTP response
	 * @param r
	 *            A continuation that handles a git-receive-pack request.
	 * @throws IOException
	 *             if an IO error occurred
	 * @since 7.0
	 */
	void receive(HttpServletRequest req, HttpServletResponse rsp,
			ReceivePackRunnable r) throws IOException;

	/** Process a git-receive-pack request. */
	public interface ReceivePackRunnable {
		/**
		 * See {@link ReceivePack#receiveWithExceptionPropagation}.
		 *
		 * @throws ServiceMayNotContinueException
		 *             if transport service cannot continue
		 * @throws IOException
		 *             if an IO error occurred
		 */
		void receive() throws ServiceMayNotContinueException, IOException;
	}

}