001/*
002 * Copyright 2012-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.web.embedded.tomcat;
018
019import java.io.File;
020import java.nio.charset.Charset;
021
022import org.apache.catalina.Context;
023import org.apache.catalina.Engine;
024import org.apache.catalina.Valve;
025import org.apache.catalina.connector.Connector;
026
027import org.springframework.boot.web.server.ConfigurableWebServerFactory;
028
029/**
030 * {@link ConfigurableWebServerFactory} for Tomcat-specific features.
031 *
032 * @author Brian Clozel
033 * @since 2.0.0
034 * @see TomcatServletWebServerFactory
035 * @see TomcatReactiveWebServerFactory
036 */
037public interface ConfigurableTomcatWebServerFactory extends ConfigurableWebServerFactory {
038
039        /**
040         * Set the Tomcat base directory. If not specified a temporary directory will be used.
041         * @param baseDirectory the tomcat base directory
042         */
043        void setBaseDirectory(File baseDirectory);
044
045        /**
046         * Sets the background processor delay in seconds.
047         * @param delay the delay in seconds
048         */
049        void setBackgroundProcessorDelay(int delay);
050
051        /**
052         * Add {@link Valve}s that should be applied to the Tomcat {@link Engine}.
053         * @param engineValves the valves to add
054         */
055        void addEngineValves(Valve... engineValves);
056
057        /**
058         * Add {@link TomcatConnectorCustomizer}s that should be added to the Tomcat
059         * {@link Connector}.
060         * @param tomcatConnectorCustomizers the customizers to add
061         */
062        void addConnectorCustomizers(TomcatConnectorCustomizer... tomcatConnectorCustomizers);
063
064        /**
065         * Add {@link TomcatContextCustomizer}s that should be added to the Tomcat
066         * {@link Context}.
067         * @param tomcatContextCustomizers the customizers to add
068         */
069        void addContextCustomizers(TomcatContextCustomizer... tomcatContextCustomizers);
070
071        /**
072         * Set the character encoding to use for URL decoding. If not specified 'UTF-8' will
073         * be used.
074         * @param uriEncoding the uri encoding to set
075         */
076        void setUriEncoding(Charset uriEncoding);
077
078}