001/*
002 * Copyright 2012-2017 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.jersey;
018
019import java.util.HashMap;
020import java.util.Map;
021
022import org.springframework.boot.context.properties.ConfigurationProperties;
023
024/**
025 * {@link ConfigurationProperties} for Jersey.
026 *
027 * @author Dave Syer
028 * @author EddĂș MelĂ©ndez
029 * @author Stephane Nicoll
030 * @since 1.2.0
031 */
032@ConfigurationProperties(prefix = "spring.jersey")
033public class JerseyProperties {
034
035        /**
036         * Jersey integration type.
037         */
038        private Type type = Type.SERVLET;
039
040        /**
041         * Init parameters to pass to Jersey through the servlet or filter.
042         */
043        private Map<String, String> init = new HashMap<>();
044
045        private final Filter filter = new Filter();
046
047        private final Servlet servlet = new Servlet();
048
049        /**
050         * Path that serves as the base URI for the application. If specified, overrides the
051         * value of "@ApplicationPath".
052         */
053        private String applicationPath;
054
055        public Filter getFilter() {
056                return this.filter;
057        }
058
059        public Servlet getServlet() {
060                return this.servlet;
061        }
062
063        public Type getType() {
064                return this.type;
065        }
066
067        public void setType(Type type) {
068                this.type = type;
069        }
070
071        public Map<String, String> getInit() {
072                return this.init;
073        }
074
075        public void setInit(Map<String, String> init) {
076                this.init = init;
077        }
078
079        public String getApplicationPath() {
080                return this.applicationPath;
081        }
082
083        public void setApplicationPath(String applicationPath) {
084                this.applicationPath = applicationPath;
085        }
086
087        public enum Type {
088
089                SERVLET, FILTER
090
091        }
092
093        public static class Filter {
094
095                /**
096                 * Jersey filter chain order.
097                 */
098                private int order;
099
100                public int getOrder() {
101                        return this.order;
102                }
103
104                public void setOrder(int order) {
105                        this.order = order;
106                }
107
108        }
109
110        public static class Servlet {
111
112                /**
113                 * Load on startup priority of the Jersey servlet.
114                 */
115                private int loadOnStartup = -1;
116
117                public int getLoadOnStartup() {
118                        return this.loadOnStartup;
119                }
120
121                public void setLoadOnStartup(int loadOnStartup) {
122                        this.loadOnStartup = loadOnStartup;
123                }
124
125        }
126
127}