1 /*
2 * Copyright (c) 2005-2007 Creative Sphere Limited.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *
10 * Creative Sphere - initial API and implementation
11 *
12 */
13 package org.abstracthorizon.danube.http.session;
14
15 import org.abstracthorizon.danube.http.HTTPConnection;
16 import org.abstracthorizon.danube.session.SessionManager;
17
18 /**
19 * This interface defines simple session handling interface. It defines a
20 * factory that keeps track of sessions. This interface adds new utility
21 * method that obtains session id from {@link HTTPConnection}. Also,
22 * it adds method to rewrite URLs if needed.
23 *
24 * @author Daniel Sendula
25 */
26 public interface HTTPSessionManager extends SessionManager {
27
28 /**
29 * Finds existing session or creates new one if there is no existing session
30 * and create parameter is set to <code>true</code>. This method should
31 * call {@link SessionManager#findSession(Object, boolean)} when session id is found.
32 *
33 * @param connection http connection for session id to be extracted from
34 * @param create should new session be created if there is no existing session
35 * @return existing session object, new session if existing session is not there and
36 * create param is set to <code>true</code> or <code>null</code> otherwise.
37 */
38 Object findSession(HTTPConnection connection, boolean create);
39
40 /**
41 * This method should take care session ids kept in the url. If such thing is not used then
42 * it shouold return url parameter unchanged.
43 *
44 * @param connection http connection object
45 * @param url url to be updated
46 * @return updated url
47 */
48 String rewriteURL(HTTPConnection connection, String url);
49
50 /**
51 * Removes session from connection
52 * @param connection connection
53 */
54 void removeSession(HTTPConnection connection);
55 }