Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
HttpClientFactory | 37 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.extension.repository.http.internal; | |
21 | ||
22 | import java.util.Map; | |
23 | ||
24 | import org.apache.http.client.HttpClient; | |
25 | import org.apache.http.impl.client.CloseableHttpClient; | |
26 | import org.apache.http.impl.client.HttpClientBuilder; | |
27 | import org.xwiki.component.annotation.Role; | |
28 | ||
29 | /** | |
30 | * Constructs {@link CloseableHttpClient} objects that can be used to perform request on HTTP-based Extension | |
31 | * Repositories. | |
32 | * | |
33 | * @version $Id: dbebe093953842217b4173569bff1c1ad9254872 $ | |
34 | * @since 5.2M1 | |
35 | */ | |
36 | @Role | |
37 | public interface HttpClientFactory | |
38 | { | |
39 | /** | |
40 | * Defines the socket timeout ({@code SO_TIMEOUT}) in milliseconds, which is the timeout for waiting for data or, | |
41 | * put differently, a maximum period inactivity between two consecutive data packets). A timeout value of zero is | |
42 | * interpreted as an infinite timeout. | |
43 | * <p> | |
44 | * This parameter expects a value of type {@link Integer}. | |
45 | * </p> | |
46 | * | |
47 | * @see java.net.SocketOptions#SO_TIMEOUT | |
48 | * @since 8.3M1 | |
49 | */ | |
50 | String SOCKET_TIMEOUT = "http.socket.timeout"; | |
51 | ||
52 | /** | |
53 | * Determines the timeout in milliseconds until a connection is established. A timeout value of zero is interpreted | |
54 | * as an infinite timeout. | |
55 | * <p> | |
56 | * Please note this parameter can only be applied to connections that are bound to a particular local address. | |
57 | * <p> | |
58 | * This parameter expects a value of type {@link Integer}. | |
59 | * </p> | |
60 | * | |
61 | * @since 8.3M1 | |
62 | */ | |
63 | String CONNECTION_TIMEOUT = "http.connection.timeout"; | |
64 | ||
65 | /** | |
66 | * @param user the user if the remote repository requires authentication, or null if no authentication is required | |
67 | * @param password the password if the remote repository requires authentication, or null if no authentication is | |
68 | * required | |
69 | * @return the {@link CloseableHttpClient} object that can be used to perform HTTP calls to an HTTP-based Extension | |
70 | * Repository | |
71 | */ | |
72 | CloseableHttpClient createClient(String user, String password); | |
73 | ||
74 | /** | |
75 | * @param user the user if the remote repository requires authentication, or null if no authentication is required | |
76 | * @param password the password if the remote repository requires authentication, or null if no authentication is | |
77 | * required | |
78 | * @return the pre-configured {@link HttpClientBuilder} instance that can be customized and used to build the actual | |
79 | * {@link HttpClient} | |
80 | * @since 8.3M1 | |
81 | */ | |
82 | HttpClientBuilder createHttpClientBuilder(String user, String password); | |
83 | ||
84 | /** | |
85 | * @param properties properties | |
86 | * @return the pre-configured {@link HttpClientBuilder} instance that can be customized and used to build the actual | |
87 | * {@link HttpClient} | |
88 | * @since 8.3M1 | |
89 | */ | |
90 | HttpClientBuilder createHttpClientBuilder(Map<String, String> properties); | |
91 | } |