Modified the web server to allow connection related data to be stored in the connection's context by the application. This modifies the contract (interfaces) between the framework and application code, requiring changes to the application (breaks backward compatibility).

This commit is contained in:
wcrisman
2014-07-11 10:39:36 -07:00
parent bb9b1f550e
commit d2027e13f9
9 changed files with 83 additions and 16 deletions

View File

@@ -0,0 +1,21 @@
package com.foundation.web.interfaces;
/**
* The context object available to the web application where connection related data can be stored and released within the context of a single connection between the client and server.
* Used to store data related to a single socket between the web browser and web server, such as a socket to a service that the server needs in order to service the client's requests.
* The data will be given an opportunity to be cleaned up upon the socket's closure if it implements com.foundation.web.interfaces.ISessionLifecycleAware.
*/
public interface IConnectionContext {
/**
* Gets the application data in the connection context's application data map by the given key.
* @return The application specific data element.
*/
public Object getApplicationData(String key);
/**
* Stores the application data in the connection context's application data map by the given key.
* The application data may implement ISessionLifecycleAware if it should be called when the session is being released. This will only be called for a normal closing of the session. The session may still be restored at some time in the future.
* @param key The key for the data. If the key is logically equal (equivalent) to an existing key, then the existing data will be replaced and returned.
* @param applicationData The application specific data element.
*/
public void setApplicationData(String key, Object applicationData);
}//IConnectionContext//