1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.eclipse.aether.transport.url;
20
21 import org.eclipse.aether.ConfigurationProperties;
22 import org.eclipse.aether.RepositorySystemSession;
23
24 /**
25 * Configuration for URL Transport.
26 *
27 * @since 2.0.21
28 */
29 public final class UrlTransporterConfigurationKeys {
30 private UrlTransporterConfigurationKeys() {}
31
32 static final String CONFIG_PROPS_PREFIX =
33 ConfigurationProperties.PREFIX_TRANSPORT + UrlTransporterFactory.NAME + ".";
34
35 /**
36 * The redirect mode of the transport. Accepted values are {@code NONE}, when any redirect response from server
37 * result in transport error, {@code SAME_AUTHORITY} when transport follow redirects only happening within same
38 * URI authority (same server), and {@code ANY} when redirects are followed everywhere.
39 *
40 * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
41 * @configurationType {@link String}
42 * @configurationDefaultValue {@link #DEFAULT_REDIRECT_MODE}
43 * @configurationRepoIdSuffix Yes
44 * @deprecated Use {@link ConfigurationProperties#HTTP_REDIRECT_MODE} instead.
45 */
46 @Deprecated
47 public static final String CONFIG_PROP_REDIRECT_MODE = CONFIG_PROPS_PREFIX + "redirectMode";
48
49 public static final String DEFAULT_REDIRECT_MODE = "ANY";
50
51 /**
52 * Maximum count of redirects that transport follows within one transaction.
53 *
54 * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
55 * @configurationType {@link Integer}
56 * @configurationDefaultValue {@link #DEFAULT_MAX_REDIRECT_COUNT}
57 * @configurationRepoIdSuffix Yes
58 */
59 public static final String CONFIG_PROP_MAX_REDIRECT_COUNT = CONFIG_PROPS_PREFIX + "maxRedirectCount";
60
61 public static final int DEFAULT_MAX_REDIRECT_COUNT = 5;
62
63 /**
64 * Whether protocol downgrade (HTTPS -> HTTP) is allowed during redirect following.
65 *
66 * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
67 * @configurationType {@link java.lang.Boolean}
68 * @configurationDefaultValue {@link #DEFAULT_REDIRECT_ALLOW_DOWNGRADE}
69 * @configurationRepoIdSuffix Yes
70 * @deprecated Use {@link ConfigurationProperties#HTTP_FOLLOW_INSECURE_REDIRECT} instead.
71 */
72 @Deprecated
73 public static final String CONFIG_PROP_REDIRECT_ALLOW_DOWNGRADE = CONFIG_PROPS_PREFIX + "redirectAllowDowngrade";
74
75 public static final boolean DEFAULT_REDIRECT_ALLOW_DOWNGRADE = false;
76
77 /**
78 * Whether this transport should close the HTTP connection at the end of each transaction, effectively
79 * disabling persistent connections (keep-alive). This configuration affects only this transport.
80 * Important to note, that globally, on JVM-wide level persistent connections are controlled by
81 * <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/net/http-keepalive.html">{@code http.keepAlive}</a>
82 * Java system property, that is {@code true} by default. If this system property is set to {@code false}, this
83 * transport cannot use persistent connections either.
84 *
85 * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
86 * @configurationType {@link java.lang.Boolean}
87 * @configurationDefaultValue {@link #DEFAULT_CLOSE_CONNECTION}
88 * @configurationRepoIdSuffix Yes
89 */
90 public static final String CONFIG_PROP_CLOSE_CONNECTION = CONFIG_PROPS_PREFIX + "closeConnection";
91
92 public static final boolean DEFAULT_CLOSE_CONNECTION = false;
93 }