Browse Source
Same as UploadPack, add a custom error handler. Change-Id: I9c708aa5a22e01214c1d997fa6f72f4b8bf814f0 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>stable-5.7
Masaya Suzuki
5 years ago
3 changed files with 117 additions and 28 deletions
@ -0,0 +1,60 @@ |
|||||||
|
/* |
||||||
|
* 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 javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.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.6 |
||||||
|
*/ |
||||||
|
public interface ReceivePackErrorHandler { |
||||||
|
/** |
||||||
|
* @param req |
||||||
|
* The HTTP request |
||||||
|
* @param rsp |
||||||
|
* The HTTP response |
||||||
|
* @param r |
||||||
|
* A continuation that handles a git-receive-pack request. |
||||||
|
* @throws IOException |
||||||
|
*/ |
||||||
|
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 |
||||||
|
* @throws IOException |
||||||
|
*/ |
||||||
|
void receive() throws ServiceMayNotContinueException, IOException; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue