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 12 import java.io.IOException; 13 14 import javax.servlet.http.HttpServletRequest; 15 import javax.servlet.http.HttpServletResponse; 16 17 import org.eclipse.jgit.transport.ReceivePack; 18 import org.eclipse.jgit.transport.ServiceMayNotContinueException; 19 20 /** 21 * Handle git-receive-pack errors. 22 * 23 * <p> 24 * This is an entry point for customizing an error handler for git-receive-pack. 25 * Right before calling {@link ReceivePack#receiveWithExceptionPropagation}, 26 * JGit will call this handler if specified through {@link GitFilter}. The 27 * implementation of this handler is responsible for calling 28 * {@link ReceivePackRunnable} and handling exceptions for clients. 29 * 30 * <p> 31 * If a custom handler is not specified, JGit will use the default error 32 * handler. 33 * 34 * @since 5.6 35 */ 36 public interface ReceivePackErrorHandler { 37 /** 38 * @param req 39 * The HTTP request 40 * @param rsp 41 * The HTTP response 42 * @param r 43 * A continuation that handles a git-receive-pack request. 44 * @throws IOException 45 */ receive(HttpServletRequest req, HttpServletResponse rsp, ReceivePackRunnable r)46 void receive(HttpServletRequest req, HttpServletResponse rsp, 47 ReceivePackRunnable r) throws IOException; 48 49 /** Process a git-receive-pack request. */ 50 public interface ReceivePackRunnable { 51 /** 52 * See {@link ReceivePack#receiveWithExceptionPropagation}. 53 * 54 * @throws ServiceMayNotContinueException 55 * @throws IOException 56 */ receive()57 void receive() throws ServiceMayNotContinueException, IOException; 58 } 59 60 } 61