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.servlet.server;
018
019import java.util.HashMap;
020import java.util.Map;
021
022/**
023 * Configuration for the server's JSP servlet.
024 *
025 * @author Andy Wilkinson
026 * @author Stephane Nicoll
027 * @since 2.0.0
028 */
029public class Jsp {
030
031        /**
032         * Class name of the servlet to use for JSPs. If registered is true and this class is
033         * on the classpath then it will be registered.
034         */
035        private String className = "org.apache.jasper.servlet.JspServlet";
036
037        private Map<String, String> initParameters = new HashMap<>();
038
039        /**
040         * Whether the JSP servlet is registered.
041         */
042        private boolean registered = true;
043
044        public Jsp() {
045                this.initParameters.put("development", "false");
046        }
047
048        /**
049         * Return the class name of the servlet to use for JSPs. If {@link #getRegistered()
050         * registered} is {@code true} and this class is on the classpath then it will be
051         * registered.
052         * @return the class name of the servlet to use for JSPs
053         */
054        public String getClassName() {
055                return this.className;
056        }
057
058        public void setClassName(String className) {
059                this.className = className;
060        }
061
062        /**
063         * Return the init parameters used to configure the JSP servlet.
064         * @return the init parameters
065         */
066        public Map<String, String> getInitParameters() {
067                return this.initParameters;
068        }
069
070        public void setInitParameters(Map<String, String> initParameters) {
071                this.initParameters = initParameters;
072        }
073
074        /**
075         * Return whether the JSP servlet is registered.
076         * @return {@code true} to register the JSP servlet
077         */
078        public boolean getRegistered() {
079                return this.registered;
080        }
081
082        public void setRegistered(boolean registered) {
083                this.registered = registered;
084        }
085
086}