1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.tomcat.util.descriptor.web;
19
20 import java.util.EnumSet;
21
22 import javax.servlet.SessionTrackingMode;
23
24 /**
25  * Representation of a session configuration element for a web application,
26  * as represented in a <code>&lt;session-config&gt;</code> element in the
27  * deployment descriptor.
28  */

29 public class SessionConfig {
30     private Integer sessionTimeout;
31     private String cookieName;
32     private String cookieDomain;
33     private String cookiePath;
34     private String cookieComment;
35     private Boolean cookieHttpOnly;
36     private Boolean cookieSecure;
37     private Integer cookieMaxAge;
38     private final EnumSet<SessionTrackingMode> sessionTrackingModes =
39         EnumSet.noneOf(SessionTrackingMode.class);
40
41     public Integer getSessionTimeout() {
42         return sessionTimeout;
43     }
44     public void setSessionTimeout(String sessionTimeout) {
45         this.sessionTimeout = Integer.valueOf(sessionTimeout);
46     }
47
48     public String getCookieName() {
49         return cookieName;
50     }
51     public void setCookieName(String cookieName) {
52         this.cookieName = cookieName;
53     }
54
55     public String getCookieDomain() {
56         return cookieDomain;
57     }
58     public void setCookieDomain(String cookieDomain) {
59         this.cookieDomain = cookieDomain;
60     }
61
62     public String getCookiePath() {
63         return cookiePath;
64     }
65     public void setCookiePath(String cookiePath) {
66         this.cookiePath = cookiePath;
67     }
68
69     public String getCookieComment() {
70         return cookieComment;
71     }
72     public void setCookieComment(String cookieComment) {
73         this.cookieComment = cookieComment;
74     }
75
76     public Boolean getCookieHttpOnly() {
77         return cookieHttpOnly;
78     }
79     public void setCookieHttpOnly(String cookieHttpOnly) {
80         this.cookieHttpOnly = Boolean.valueOf(cookieHttpOnly);
81     }
82
83     public Boolean getCookieSecure() {
84         return cookieSecure;
85     }
86     public void setCookieSecure(String cookieSecure) {
87         this.cookieSecure = Boolean.valueOf(cookieSecure);
88     }
89
90     public Integer getCookieMaxAge() {
91         return cookieMaxAge;
92     }
93     public void setCookieMaxAge(String cookieMaxAge) {
94         this.cookieMaxAge = Integer.valueOf(cookieMaxAge);
95     }
96
97     public EnumSet<SessionTrackingMode> getSessionTrackingModes() {
98         return sessionTrackingModes;
99     }
100     public void addSessionTrackingMode(String sessionTrackingMode) {
101         sessionTrackingModes.add(
102                 SessionTrackingMode.valueOf(sessionTrackingMode));
103     }
104
105 }
106