001/* 002 * Copyright 2002-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 * https://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.mock.web; 018 019import javax.servlet.SessionCookieConfig; 020 021import org.springframework.lang.Nullable; 022 023/** 024 * Mock implementation of the {@link javax.servlet.SessionCookieConfig} interface. 025 * 026 * @author Juergen Hoeller 027 * @since 4.0 028 * @see javax.servlet.ServletContext#getSessionCookieConfig() 029 */ 030public class MockSessionCookieConfig implements SessionCookieConfig { 031 032 @Nullable 033 private String name; 034 035 @Nullable 036 private String domain; 037 038 @Nullable 039 private String path; 040 041 @Nullable 042 private String comment; 043 044 private boolean httpOnly; 045 046 private boolean secure; 047 048 private int maxAge = -1; 049 050 051 @Override 052 public void setName(@Nullable String name) { 053 this.name = name; 054 } 055 056 @Override 057 @Nullable 058 public String getName() { 059 return this.name; 060 } 061 062 @Override 063 public void setDomain(@Nullable String domain) { 064 this.domain = domain; 065 } 066 067 @Override 068 @Nullable 069 public String getDomain() { 070 return this.domain; 071 } 072 073 @Override 074 public void setPath(@Nullable String path) { 075 this.path = path; 076 } 077 078 @Override 079 @Nullable 080 public String getPath() { 081 return this.path; 082 } 083 084 @Override 085 public void setComment(@Nullable String comment) { 086 this.comment = comment; 087 } 088 089 @Override 090 @Nullable 091 public String getComment() { 092 return this.comment; 093 } 094 095 @Override 096 public void setHttpOnly(boolean httpOnly) { 097 this.httpOnly = httpOnly; 098 } 099 100 @Override 101 public boolean isHttpOnly() { 102 return this.httpOnly; 103 } 104 105 @Override 106 public void setSecure(boolean secure) { 107 this.secure = secure; 108 } 109 110 @Override 111 public boolean isSecure() { 112 return this.secure; 113 } 114 115 @Override 116 public void setMaxAge(int maxAge) { 117 this.maxAge = maxAge; 118 } 119 120 @Override 121 public int getMaxAge() { 122 return this.maxAge; 123 } 124 125}