resolver.resolve(links);
}
public void otherDocumentsAndSessions()
{
ItsNatDocument itsNatDoc = getItsNatDocument();
ItsNatDocumentTemplate thisDocTemplate = itsNatDoc.getItsNatDocumentTemplate();
ItsNatServlet itsNatServlet = thisDocTemplate.getItsNatServlet();
ItsNatServletContext appCtx = itsNatServlet.getItsNatServletConfig().getItsNatServletContext();
final List<ItsNatSession> sessionList = new LinkedList<ItsNatSession>();
ItsNatSessionCallback cb = new ItsNatSessionCallback()
{
public boolean handleSession(ItsNatSession session)
{
sessionList.add(session);
return true; // continue
}
};
appCtx.enumerateSessions(cb);
ItsNatVariableResolver resolver = itsNatDoc.createItsNatVariableResolver(true);
resolver.setLocalVariable("refreshInterval",new Integer(3000));
resolver.setLocalVariable("commMode",new Integer(CommMode.XHR_ASYNC));
for(int i = 0; i < sessionList.size(); i++)
{
ItsNatHttpSession otherSession = (ItsNatHttpSession)sessionList.get(i);
ItsNatDocument[] remDocs = otherSession.getItsNatDocuments();
for(int j = 0; j < remDocs.length; j++)
{
ItsNatDocument currRemDoc = remDocs[j];
if (itsNatDoc == currRemDoc) continue;
// currRemDoc should be synchronized, but a dead lock could occur by other process doing the same (docs locked mutually, the parent doc is already locked)
// there is no problem, the ItsNatDocument.getItsNatDocumentTemplate() is thread safe
ItsNatDocumentTemplate docTemplate = currRemDoc.getItsNatDocumentTemplate();
if (docTemplate != thisDocTemplate)
continue;
String docId = currRemDoc.getId(); // No sync is needed
Element sessionElem = (Element)sessionNodeList.addElement();
long lastRequest = currRemDoc.getClientDocumentOwner().getLastRequestTime();
ItsNatVariableResolver resolver2 = resolver.createItsNatVariableResolver();
resolver2.setLocalVariable("sessionId",otherSession.getId());
resolver2.setLocalVariable("docId",docId);
resolver2.setLocalVariable("agentInfo",otherSession.getUserAgent());