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 */
45 public static final String CONFIG_PROP_REDIRECT_MODE = CONFIG_PROPS_PREFIX + "redirectMode";
46
47 public static final String DEFAULT_REDIRECT_MODE = "ANY";
48
49 /**
50 * Maximum count of redirects that transport follows within one transaction.
51 *
52 * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
53 * @configurationType {@link Integer}
54 * @configurationDefaultValue {@link #DEFAULT_MAX_REDIRECT_COUNT}
55 * @configurationRepoIdSuffix Yes
56 */
57 public static final String CONFIG_PROP_MAX_REDIRECT_COUNT = CONFIG_PROPS_PREFIX + "maxRedirectCount";
58
59 public static final int DEFAULT_MAX_REDIRECT_COUNT = 5;
60
61 /**
62 * Whether protocol downgrade (HTTPS -> HTTP) is allowed during redirect following.
63 *
64 * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
65 * @configurationType {@link java.lang.Boolean}
66 * @configurationDefaultValue {@link #DEFAULT_REDIRECT_ALLOW_DOWNGRADE}
67 * @configurationRepoIdSuffix Yes
68 */
69 public static final String CONFIG_PROP_REDIRECT_ALLOW_DOWNGRADE = CONFIG_PROPS_PREFIX + "redirectAllowDowngrade";
70
71 public static final boolean DEFAULT_REDIRECT_ALLOW_DOWNGRADE = false;
72
73 /**
74 * Whether this transport should close the HTTP connection at the end of each transaction, effectively
75 * disabling persistent connections (keep-alive). This configuration affects only this transport.
76 * Important to note, that globally, on JVM-wide level persistent connections are controlled by
77 * <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/net/http-keepalive.html">{@code http.keepAlive}</a>
78 * Java system property, that is {@code true} by default. If this system property is set to {@code false}, this
79 * transport cannot use persistent connections either.
80 *
81 * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
82 * @configurationType {@link java.lang.Boolean}
83 * @configurationDefaultValue {@link #DEFAULT_CLOSE_CONNECTION}
84 * @configurationRepoIdSuffix Yes
85 */
86 public static final String CONFIG_PROP_CLOSE_CONNECTION = CONFIG_PROPS_PREFIX + "closeConnection";
87
88 public static final boolean DEFAULT_CLOSE_CONNECTION = false;
89 }