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.

HttpConnectionFactory2.java 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 2020 Thomas Wolf <thomas.wolf@paranor.ch> 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. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.transport.http;
  11. import java.io.IOException;
  12. import java.security.GeneralSecurityException;
  13. import org.eclipse.jgit.annotations.NonNull;
  14. /**
  15. * A {@link HttpConnectionFactory} that supports client-side sessions that can
  16. * maintain state and configure connections.
  17. *
  18. * @since 5.11
  19. */
  20. public interface HttpConnectionFactory2 extends HttpConnectionFactory {
  21. /**
  22. * Creates a new {@link GitSession} instance that can be used with
  23. * connections created by this {@link HttpConnectionFactory} instance.
  24. *
  25. * @return a new {@link GitSession}
  26. */
  27. @NonNull
  28. GitSession newSession();
  29. /**
  30. * A {@code GitSession} groups the multiple HTTP connections
  31. * {@link org.eclipse.jgit.transport.TransportHttp TransportHttp} uses for
  32. * the requests it makes during a git fetch or push. A {@code GitSession}
  33. * can maintain client-side HTTPS state and can configure individual
  34. * connections.
  35. */
  36. interface GitSession {
  37. /**
  38. * Configure a just created {@link HttpConnection}.
  39. *
  40. * @param connection
  41. * to configure; created by the same
  42. * {@link HttpConnectionFactory} instance
  43. * @param sslVerify
  44. * whether SSL is to be verified
  45. * @return the configured {@connection}
  46. * @throws IOException
  47. * if the connection cannot be configured
  48. * @throws GeneralSecurityException
  49. * if the connection cannot be configured
  50. */
  51. @NonNull
  52. HttpConnection configure(@NonNull HttpConnection connection,
  53. boolean sslVerify) throws IOException, GeneralSecurityException;
  54. /**
  55. * Closes the {@link GitSession}, releasing any internal state.
  56. */
  57. void close();
  58. }
  59. }