diff options
Diffstat (limited to 'org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java')
-rw-r--r-- | org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java new file mode 100644 index 0000000000..ee66cb102f --- /dev/null +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackErrorHandler.java @@ -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; + } + +} |