use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.
the class AbstractServiceTunnel method interceptRequest.
protected void interceptRequest(ServiceTunnelRequest request) {
UserAgent userAgent = UserAgent.CURRENT.get();
if (userAgent == null) {
LOG.warn("No UserAgent set on calling context; include default in service-request");
userAgent = UserAgents.createDefault();
}
request.setUserAgent(userAgent.createIdentifier());
ISession session = ISession.CURRENT.get();
if (session != null) {
request.setSessionId(session.getId());
}
request.setClientNodeId(INode.ID);
}
use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.
the class ClusterSynchronizationService method getNotificationProperties.
@Override
public IClusterNotificationProperties getNotificationProperties() {
ISession curentSession = ISession.CURRENT.get();
String userid = curentSession != null ? curentSession.getUserId() : "";
return new ClusterNotificationProperties(m_nodeId, userid);
}
use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.
the class AbstractObservableNotificationHandler method sessionChanged.
/**
* Automatically removes listeners for stopped sessions.
*/
@Override
public void sessionChanged(SessionEvent event) {
if (event.getType() == SessionEvent.TYPE_STOPPED) {
// only interested in session stopped
ISession session = Assertions.assertNotNull(event.getSource());
if (session instanceof IClientSession) {
IClientSession clientSession = (IClientSession) session;
synchronized (m_listeners) {
for (INotificationListener<T> notificationListener : getListeners(clientSession)) {
removeListener(clientSession, notificationListener);
LOG.warn("Auto fallback removal of session listener due to stopped session. This must be done explicitly by the one that registered the listener: {}", notificationListener);
}
}
}
}
}
use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.
the class ClientTestRunnerDifferentSessionTest method test3.
@Test
@RunWithClientSession(value = JUnitClientSession2.class)
public void test3() {
ISession clientSession = IClientSession.CURRENT.get();
assertTrue(clientSession instanceof JUnitClientSession2);
assertEquals("anna", getCurrentUser());
m_clientSessions.add(clientSession);
}
use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.
the class ClientTestRunnerDifferentSessionTest method test1.
@Test
public void test1() {
ISession clientSession = IClientSession.CURRENT.get();
assertTrue(clientSession instanceof JUnitClientSession1);
assertEquals("anna", getCurrentUser());
m_clientSessions.add(clientSession);
}
Aggregations