01: // Copyright 2006 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.services;
16:
17: import java.util.List;
18:
19: import javax.servlet.http.HttpSession;
20:
21: /**
22: * Generic version of {@link HttpSession}, used to bridge the gaps between the Servlet API and the
23: * Portlet API.
24: */
25: public interface Session {
26: /**
27: * Returns a list of the names of all attributes stored in the session. The names are returned
28: * sorted alphabetically.
29: */
30: List<String> getAttributeNames();
31:
32: /**
33: * Returns a list of the names of all attributes stored in the session whose name has the
34: * provided prefix. The names are returned in alphabetical order.
35: */
36: List<String> getAttributeNames(String prefix);
37:
38: /** Returns the value previously stored in the session. */
39: Object getAttribute(String name);
40:
41: /** Sets the value of an attribute. If the value is null, then the attribute is deleted. */
42: void setAttribute(String name, Object value);
43:
44: /**
45: * Returns the maximum time interval, in seconds, that the servlet container will keep this
46: * session open between client accesses. After this interval, the servlet container will
47: * invalidate the session. The maximum time interval can be set with the setMaxInactiveInterval
48: * method. A negative time indicates the session should never timeout.
49: */
50: int getMaxInactiveInterval();
51:
52: /**
53: * Specifies the time, in seconds, between client requests before the servlet container will
54: * invalidate this session. A negative time indicates the session should never timeout.
55: */
56: void setMaxInactiveInterval(int seconds);
57:
58: /**
59: * Invalidates this session then unbinds any objects bound to it.
60: *
61: * @throws IllegalStateException
62: * if this method is called on an already invalidated session
63: */
64: void invalidate();
65: }
|