001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.eclipse.aether.transport.url; 020 021import org.eclipse.aether.ConfigurationProperties; 022import org.eclipse.aether.RepositorySystemSession; 023 024/** 025 * Configuration for URL Transport. 026 * 027 * @since 2.0.21 028 */ 029public final class UrlTransporterConfigurationKeys { 030 private UrlTransporterConfigurationKeys() {} 031 032 static final String CONFIG_PROPS_PREFIX = 033 ConfigurationProperties.PREFIX_TRANSPORT + UrlTransporterFactory.NAME + "."; 034 035 /** 036 * The redirect mode of the transport. Accepted values are {@code NONE}, when any redirect response from server 037 * result in transport error, {@code SAME_AUTHORITY} when transport follow redirects only happening within same 038 * URI authority (same server), and {@code ANY} when redirects are followed everywhere. 039 * 040 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 041 * @configurationType {@link String} 042 * @configurationDefaultValue {@link #DEFAULT_REDIRECT_MODE} 043 * @configurationRepoIdSuffix Yes 044 * @deprecated Use {@link ConfigurationProperties#HTTP_REDIRECT_MODE} instead. 045 */ 046 @Deprecated 047 public static final String CONFIG_PROP_REDIRECT_MODE = CONFIG_PROPS_PREFIX + "redirectMode"; 048 049 public static final String DEFAULT_REDIRECT_MODE = "ANY"; 050 051 /** 052 * Maximum count of redirects that transport follows within one transaction. 053 * 054 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 055 * @configurationType {@link Integer} 056 * @configurationDefaultValue {@link #DEFAULT_MAX_REDIRECT_COUNT} 057 * @configurationRepoIdSuffix Yes 058 */ 059 public static final String CONFIG_PROP_MAX_REDIRECT_COUNT = CONFIG_PROPS_PREFIX + "maxRedirectCount"; 060 061 public static final int DEFAULT_MAX_REDIRECT_COUNT = 5; 062 063 /** 064 * Whether protocol downgrade (HTTPS -> HTTP) is allowed during redirect following. 065 * 066 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 067 * @configurationType {@link java.lang.Boolean} 068 * @configurationDefaultValue {@link #DEFAULT_REDIRECT_ALLOW_DOWNGRADE} 069 * @configurationRepoIdSuffix Yes 070 * @deprecated Use {@link ConfigurationProperties#HTTP_FOLLOW_INSECURE_REDIRECT} instead. 071 */ 072 @Deprecated 073 public static final String CONFIG_PROP_REDIRECT_ALLOW_DOWNGRADE = CONFIG_PROPS_PREFIX + "redirectAllowDowngrade"; 074 075 public static final boolean DEFAULT_REDIRECT_ALLOW_DOWNGRADE = false; 076 077 /** 078 * Whether this transport should close the HTTP connection at the end of each transaction, effectively 079 * disabling persistent connections (keep-alive). This configuration affects only this transport. 080 * Important to note, that globally, on JVM-wide level persistent connections are controlled by 081 * <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/net/http-keepalive.html">{@code http.keepAlive}</a> 082 * Java system property, that is {@code true} by default. If this system property is set to {@code false}, this 083 * transport cannot use persistent connections either. 084 * 085 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 086 * @configurationType {@link java.lang.Boolean} 087 * @configurationDefaultValue {@link #DEFAULT_CLOSE_CONNECTION} 088 * @configurationRepoIdSuffix Yes 089 */ 090 public static final String CONFIG_PROP_CLOSE_CONNECTION = CONFIG_PROPS_PREFIX + "closeConnection"; 091 092 public static final boolean DEFAULT_CLOSE_CONNECTION = false; 093}