public class ExtensionHttpSessions extends ExtensionAdaptor implements SessionChangedListener, SiteMapListener, HttpSenderListener
Whenever referring to a particular site, the string that is identifying it is constructed from the site's URI and has to follow these rules:
ScanPanel.cleanSiteName(String, boolean)
.Constructor and Description |
---|
ExtensionHttpSessions()
Instantiates a new extension http sessions.
|
Modifier and Type | Method and Description |
---|---|
void |
addHttpSessionToken(String site,
String token)
Adds a new session token for a particular site.
|
String |
getAuthor()
Gets the author of the extension.
|
String |
getDescription()
Returns the description of the extension, to be shown in UI components.
|
List<HttpSession> |
getHttpSessionsForContext(Context context)
Builds and returns a list of http sessions that correspond to a given context.
|
protected HttpSessionsPanel |
getHttpSessionsPanel()
Gets the http sessions panel.
|
HttpSessionsSite |
getHttpSessionsSite(String site)
Gets the http sessions for a particular site.
|
HttpSessionsSite |
getHttpSessionsSite(String site,
boolean createIfNeeded)
Gets the http sessions for a particular site.
|
HttpSessionTokensSet |
getHttpSessionTokensSet(String site)
Gets the set of session tokens for a particular site.
|
HttpSessionTokensSet |
getHttpSessionTokensSetForContext(Context context)
Gets the http session tokens set for the first site matching a given Context.
|
int |
getListenerOrder()
Gets the order of when this listener should be notified.
|
HttpSessionsParam |
getParam()
Gets the parameters (options) for this extension and related classes.
|
List<String> |
getSites()
Gets all of the sites with http sessions.
|
String |
getUIName()
By default returns the name returned by
getName() . |
void |
hook(ExtensionHook extensionHook)
Called during extension's initialisation to allow to add new functionality to core
components.
|
void |
init()
Initialize plugin during startup.
|
boolean |
isDefaultSessionToken(String token)
Checks if a particular token is part of the default session tokens set by the user using the
options panel.
|
boolean |
isSessionToken(String site,
String token)
Checks if a particular token is a session token name for a particular site.
|
void |
nodeSelected(SiteNode node) |
void |
onHttpRequestSend(HttpMessage msg,
int initiator,
HttpSender sender)
Notifies the listener that a new request was received from the client and is ready to be
forwarded to the server.
|
void |
onHttpResponseReceive(HttpMessage msg,
int initiator,
HttpSender sender)
Notifies the listener that a new response was received from the server and is ready to be
forwarded to the client.
|
void |
onReturnNodeRendererComponent(SiteMapTreeCellRenderer component,
boolean leaf,
SiteNode value) |
void |
removeHttpSessionToken(String site,
String token)
Removes a particular session token for a site.
|
void |
sessionAboutToChange(Session session)
Called just prior to the session changing.
|
void |
sessionChanged(Session session)
Called just after the session has changed.
|
void |
sessionModeChanged(Control.Mode mode)
Called when the user changes the mode.
|
void |
sessionScopeChanged(Session session)
Called when the user has changes the session scope.
|
boolean |
supportsDb(String type)
Return true if the specified db type is supported by the extension (or if it doesn't use any
db) If this method returns false (meaning the db in use is not supported) then the extension
will not be loaded.
|
canUnload, databaseOpen, destroy, getActiveActions, getAddOn, getDependencies, getExtensionMenu, getExtensionView, getI18nPrefix, getMessages, getModel, getName, getOrder, getUnsavedResources, getView, hasView, initModel, initView, initXML, isCore, isDepreciated, isEnabled, optionsLoaded, postInit, postInstall, setAddOn, setDescription, setEnabled, setI18nPrefix, setMessages, setName, setOrder, start, stop, supportsLowMemory, unload
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
sessionPropertiesChanged
getURL, getVersion
public static final String NAME
public ExtensionHttpSessions()
public boolean supportsDb(String type)
Extension
supportsDb
in interface Extension
supportsDb
in class ExtensionAdaptor
type
- the db typeDatabase.getType()
public String getUIName()
ExtensionAdaptor
getName()
.getUIName
in interface Extension
getUIName
in class ExtensionAdaptor
null
ExtensionAdaptor.getName()
public String getAuthor()
Extension
Since 2.9.0 defaults to the author of the add-on, if set, otherwise an empty string.
public String getDescription()
Extension
getDescription
in interface Extension
getDescription
in class ExtensionAdaptor
null
public void init()
Extension
init
in interface Extension
init
in class ExtensionAdaptor
public void hook(ExtensionHook extensionHook)
Extension
hook
in interface Extension
hook
in class ExtensionAdaptor
extensionHook
- the hook to add the components.public HttpSessionsParam getParam()
public boolean isDefaultSessionToken(String token)
token
- the tokenpublic boolean isSessionToken(String site, String token)
site
- the site. This parameter has to be formed as defined in the ExtensionHttpSessions
class documentation. However, if the protocol is missing, a
default protocol of 80 is used.token
- the tokenpublic void addHttpSessionToken(String site, String token)
site
- the site. This parameter has to be formed as defined in the ExtensionHttpSessions
class documentation. However, if the protocol is missing, a
default protocol of 80 is used.token
- the tokenpublic void removeHttpSessionToken(String site, String token)
All the existing sessions are cleaned up:
site
- the site. This parameter has to be formed as defined in the ExtensionHttpSessions
class documentation. However, if the protocol is missing, a
default protocol of 80 is used.token
- the tokenpublic final HttpSessionTokensSet getHttpSessionTokensSet(String site)
ExtensionHttpSessions
.site
- the site. This parameter has to be formed as defined in the ExtensionHttpSessions
class documentation. However, if the protocol is missing, a
default protocol of 80 is used.addHttpSessionToken(String, String)
,
removeHttpSessionToken(String, String)
protected HttpSessionsPanel getHttpSessionsPanel()
public HttpSessionsSite getHttpSessionsSite(String site)
site
- the site. This parameter has to be formed as defined in the ExtensionHttpSessions
class documentation. However, if the protocol is missing, a
default protocol of 80 is used.public HttpSessionsSite getHttpSessionsSite(String site, boolean createIfNeeded)
HttpSessionsSite
does not exist is defined by the createIfNeeded
parameter.site
- the site. This parameter has to be formed as defined in the ExtensionHttpSessions
class documentation. However, if the protocol is missing, a
default protocol of 80 is used.createIfNeeded
- whether a new HttpSessionsSite
object is created if one does
not existpublic void nodeSelected(SiteNode node)
nodeSelected
in interface SiteMapListener
public void onReturnNodeRendererComponent(SiteMapTreeCellRenderer component, boolean leaf, SiteNode value)
onReturnNodeRendererComponent
in interface SiteMapListener
public void sessionChanged(Session session)
SessionChangedListener
sessionChanged
in interface SessionChangedListener
session
- the new sessionpublic void sessionAboutToChange(Session session)
SessionChangedListener
sessionAboutToChange
in interface SessionChangedListener
session
- the session about to be closedpublic void sessionScopeChanged(Session session)
SessionChangedListener
sessionScopeChanged
in interface SessionChangedListener
session
- the current sessionpublic void sessionModeChanged(Control.Mode mode)
SessionChangedListener
sessionModeChanged
in interface SessionChangedListener
mode
- the new modepublic List<HttpSession> getHttpSessionsForContext(Context context)
context
- the contextpublic HttpSessionTokensSet getHttpSessionTokensSetForContext(Context context)
context
- the contextpublic List<String> getSites()
public int getListenerOrder()
HttpSenderListener
The listeners are ordered in a natural order, the greater the order the later it will be notified.
Note: If two or more listeners have the same order, the order that those listeners will be notified is undefined.
getListenerOrder
in interface HttpSenderListener
int
with the value of the order that this listener should be notified
aboutpublic void onHttpRequestSend(HttpMessage msg, int initiator, HttpSender sender)
HttpSenderListener
The HttpMessage
msg
can be modified (only the request should be modified).
If the return value is true
the message may be forwarded and the following
listeners will be notified, if the value is false
the message will not be
forwarded and no more listeners will be notified.
Note: In the presence of more than one listener there are no guarantees that:
HttpMessage
msg
is equal to the one forwarded to the server, as the
following listeners may modify it;
true
, as the following listeners may return false
.
int
initiator
as defined in the HttpSender
class.
onHttpRequestSend
in interface HttpSenderListener
msg
- the HttpMessage
that may be forwarded to the serverinitiator
- the ID of the entity that's sending the messagesender
- the sender of the messagepublic void onHttpResponseReceive(HttpMessage msg, int initiator, HttpSender sender)
HttpSenderListener
The HttpMessage
msg
can be modified (only the response should be
modified). If the return value is true
the message may be forwarded and the
following listeners will be notified, if the value is false
the message will
not be forwarded and no more listeners will be notified.
Note: In the presence of more than one listener there are no guarantees that:
HttpMessage
msg
is equal to the one forwarded to the client, as the
following listeners may modify it;
true
, as the following listeners may return false
.
int
initiator
as defined in the HttpSender
class.
onHttpResponseReceive
in interface HttpSenderListener
msg
- the HttpMessage
that may be forwarded to the clientinitiator
- the ID of the entity that's sending the messagesender
- the sender of the message