Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Cookie |
|
| 1.0;1 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, | |
13 | * software distributed under the License is distributed on an | |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | * KIND, either express or implied. See the License for the | |
16 | * specific language governing permissions and limitations | |
17 | * under the License. | |
18 | */ | |
19 | package org.apache.shiro.web.servlet; | |
20 | ||
21 | import javax.servlet.http.HttpServletRequest; | |
22 | import javax.servlet.http.HttpServletResponse; | |
23 | ||
24 | /** | |
25 | * Interface representing HTTP cookie operations, supporting pojo-style getters and setters for all | |
26 | * attributes which includes <a href="http://www.owasp.org/index.php/HttpOnly">HttpOnly</a> support. | |
27 | * This allows Shiro to set <a href="http://www.owasp.org/index.php/HttpOnly">HttpOnly</a> cookies even on | |
28 | * Servlet containers based on the {@code 2.4} and {@code 2.5} API (Servlet API 'native' support was only introduced in | |
29 | * the {@code 2.6} specification). | |
30 | * | |
31 | * @since 1.0 | |
32 | */ | |
33 | public interface Cookie { | |
34 | /** | |
35 | * The value of deleted cookie (with the maxAge 0). | |
36 | */ | |
37 | public static final String DELETED_COOKIE_VALUE = "deleteMe"; | |
38 | ||
39 | ||
40 | /** | |
41 | * The number of seconds in one year (= 60 * 60 * 24 * 365). | |
42 | */ | |
43 | public static final int ONE_YEAR = 60 * 60 * 24 * 365; | |
44 | ||
45 | /** | |
46 | * Root path to use when the path hasn't been set and request context root is empty or null. | |
47 | */ | |
48 | public static final String ROOT_PATH = "/"; | |
49 | ||
50 | String getName(); | |
51 | ||
52 | void setName(String name); | |
53 | ||
54 | String getValue(); | |
55 | ||
56 | void setValue(String value); | |
57 | ||
58 | String getComment(); | |
59 | ||
60 | void setComment(String comment); | |
61 | ||
62 | String getDomain(); | |
63 | ||
64 | void setDomain(String domain); | |
65 | ||
66 | int getMaxAge(); | |
67 | ||
68 | void setMaxAge(int maxAge); | |
69 | ||
70 | String getPath(); | |
71 | ||
72 | void setPath(String path); | |
73 | ||
74 | boolean isSecure(); | |
75 | ||
76 | void setSecure(boolean secure); | |
77 | ||
78 | int getVersion(); | |
79 | ||
80 | void setVersion(int version); | |
81 | ||
82 | void setHttpOnly(boolean httpOnly); | |
83 | ||
84 | boolean isHttpOnly(); | |
85 | ||
86 | void saveTo(HttpServletRequest request, HttpServletResponse response); | |
87 | ||
88 | void removeFrom(HttpServletRequest request, HttpServletResponse response); | |
89 | ||
90 | String readValue(HttpServletRequest request, HttpServletResponse response); | |
91 | } |