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.autoconfigure.webservices;
018
019import java.util.HashMap;
020import java.util.Map;
021
022import org.springframework.boot.context.properties.ConfigurationProperties;
023import org.springframework.util.Assert;
024
025/**
026 * {@link ConfigurationProperties} for Spring Web Services.
027 *
028 * @author Vedran Pavic
029 * @author Stephane Nicoll
030 * @since 1.4.0
031 */
032@ConfigurationProperties(prefix = "spring.webservices")
033public class WebServicesProperties {
034
035        /**
036         * Path that serves as the base URI for the services.
037         */
038        private String path = "/services";
039
040        private final Servlet servlet = new Servlet();
041
042        public String getPath() {
043                return this.path;
044        }
045
046        public void setPath(String path) {
047                Assert.notNull(path, "Path must not be null");
048                Assert.isTrue(path.length() > 1, "Path must have length greater than 1");
049                Assert.isTrue(path.startsWith("/"), "Path must start with '/'");
050                this.path = path;
051        }
052
053        public Servlet getServlet() {
054                return this.servlet;
055        }
056
057        public static class Servlet {
058
059                /**
060                 * Servlet init parameters to pass to Spring Web Services.
061                 */
062                private Map<String, String> init = new HashMap<>();
063
064                /**
065                 * Load on startup priority of the Spring Web Services servlet.
066                 */
067                private int loadOnStartup = -1;
068
069                public Map<String, String> getInit() {
070                        return this.init;
071                }
072
073                public void setInit(Map<String, String> init) {
074                        this.init = init;
075                }
076
077                public int getLoadOnStartup() {
078                        return this.loadOnStartup;
079                }
080
081                public void setLoadOnStartup(int loadOnStartup) {
082                        this.loadOnStartup = loadOnStartup;
083                }
084
085        }
086
087}