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