1 /*
2 * Copyright 2009-2010 Capgemini
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * 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 */
16 package net.sourceforge.statelessfilter.backend;
17
18 import java.io.IOException;
19 import java.util.List;
20
21 import javax.servlet.http.HttpServletRequest;
22 import javax.servlet.http.HttpServletResponse;
23
24 import net.sourceforge.statelessfilter.filter.IPlugin;
25
26 /**
27 * Interface for a session backend. All session backends must implement this
28 * interface.
29 *
30 * @author Nicolas Richeton - Capgemini
31 */
32 public interface ISessionBackend extends IPlugin {
33
34 /**
35 * Restores a session from the backend.
36 *
37 * @param request
38 * @return session data or null if session does not exists or restoration
39 * failed.
40 */
41 ISessionData restore(HttpServletRequest request);
42
43 /**
44 * Saves a session to the backend.
45 *
46 * @param session
47 * Current session.
48 * @param dirtyAttributes
49 * list of attributes that were added/changed/removed during the
50 * current request.
51 * @param request
52 * Current request.
53 * @param response
54 * Current response.
55 * @throws IOException
56 */
57 void save(ISessionData session, List<String> dirtyAttributes,
58 HttpServletRequest request, HttpServletResponse response)
59 throws IOException;
60 }