public class IlxWManager extends IlxWContainer implements javax.servlet.http.HttpSessionBindingListener, ilog.webui.dhtml.IlxWConstants, java.io.Serializable
IlxWManager represents a Web components container.
A web component is an instance of IlxWComponent. This class is
designed to be deployed in a servlet or a JSP. It uses the method
print to print its graphic representation to the designated port.
A port, that is, an an instance of IlxWPort, can be considered
as a stream for displaying the HTML code representing the component in a web
browser. This port encapsulates the response writer of a servlet.
All components are associated with a manager, that is, an instance of
IlxWManager. A manager can be considered as a container of
component objects. There is only one instance of IlxWManager
associated with the current HTTP session. You can get this instance by
calling getManager(javax.servlet.http.HttpSession) static method.
A session is an instance of javax.servlet.http.HttpSession. Each
user is associated with a session. You can always retrieve the current session
manager by calling getManager.
In order to print the HTML representation of Web components deployed in a servlet or a JSP page to a web browser, you must store your components in a manager so that you can retrieve them during the session.
The following code example shows how to save a decision table using a
IlxWManager instance:
public void doSave(HttpSession session, IlrBusinessRule element) throws Exception {
IlrDecisionTable dt = (IlrDecisionTable)element;
IlrSession rtsSession = dt.getSession();
IlxWManager manager = IlxWManager.getManager(session);
synchronized (manager) {
String componentName = DTableEditor.EDITORNAME;
DTableEditor dtEditor = (DTableEditor) manager.getComponentNamed(componentName);
if (dtEditor == null) {
throw new Exception(Messages.getString("DecisionTableEditor.DECISION_EDITOR_NAMED") + componentName + Messages.getString("DecisionTableEditor.NOT_FOUND_IN_CURRENT_SESSION")); //$NON-NLS-1$ //$NON-NLS-2$
}
IlrDTController dtcontroller = (IlrDTController) session.getAttribute("controller"); //$NON-NLS-1$
if(dtcontroller!=null){
String body = IlrSessionHelper.dtControllerToStorableString(rtsSession, dtcontroller);
IlrDefinition definition = dt.getDefinition();
definition.setRawValue(rtsSession.getBrmPackage().getDefinition_Body(), body);
IlrCommitableObject cobject = new IlrCommitableObject(dt);
cobject.addModifiedElement(rtsSession.getBrmPackage().getRuleArtifact_Definition(), definition);
rtsSession.commit(cobject);
}
session.removeAttribute("controller"); //$NON-NLS-1$
}
}
listenerList| Modifier and Type | Method and Description |
|---|---|
void |
cleanup()
Called by the controller in order to cleanup the queue containing
the components no longer referenced.
|
static IlxWManager |
getManager(javax.servlet.http.HttpSession session)
Gets the manager associated with the session or creates
that manager if this is the first time this method is called since
the session was created.
|
javax.servlet.http.HttpSession |
getSession()
Gets the session in which this manager has been registered.
|
void |
notifyDependencies(IlxWPort port) |
static void |
releaseManager(javax.servlet.http.HttpSession session)
Releases the manager from the session.
|
void |
valueBound(javax.servlet.http.HttpSessionBindingEvent event)
Defines the
HttpSessionBindingListener interface. |
void |
valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
Defines the
HttpSessionBindingListener interface. |
add, add, getAttribute, getAttributeNames, getComponent, getComponentCount, getComponentNamed, getComponents, getManager, getParent, getUserAgentRules, indexOf, isAncestorOf, remove, remove, removeAll, removeAttribute, setAttribute, setAuthorRules, setFinalizerpublic void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
HttpSessionBindingListener interface.valueBound in interface javax.servlet.http.HttpSessionBindingListenerpublic void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
HttpSessionBindingListener interface.valueUnbound in interface javax.servlet.http.HttpSessionBindingListenerpublic static void releaseManager(javax.servlet.http.HttpSession session)
IlxWConfig.noSessionAttributes flag
is set to true, otherwise, since in this mode the managers are stored in a singleton map, they will never be
released.
If the IlxWConfig.noSessionAttributes flag is false (this is the default behavior), then you don't need
to call this method, since it the manager corresponding to this session will be GCed when the session is GCed.
public static IlxWManager getManager(javax.servlet.http.HttpSession session)
public javax.servlet.http.HttpSession getSession()
public void cleanup()
public void notifyDependencies(IlxWPort port)
notifyDependencies in interface ilog.webui.dhtml.IlxWDependencyProvidernotifyDependencies in class IlxWContainer© Copyright IBM Corp. 1987, 2017