use of com.servoy.j2db.server.ngclient.NGClient in project servoy-client by Servoy.
the class ServoyDebugger method getFrame.
/**
* @see org.eclipse.dltk.rhino.dbgp.DBGPDebugger#getFrame(org.mozilla.javascript.Context, org.mozilla.javascript.debug.DebuggableScript)
*/
@Override
public DebugFrame getFrame(Context cx, DebuggableScript fnOrScript) {
final IServiceProvider client = J2DBGlobals.getServiceProvider();
if (profilelisteners.size() > 0) {
ProfileInfo info = profileInfo.get();
return new ServoyDebugFrame(cx, fnOrScript, this, info != null ? info.peek() : null);
}
return new DBGPDebugFrame(cx, fnOrScript, this) {
@Override
public Object eval(String value) {
if (client != null && J2DBGlobals.getServiceProvider() == null) {
J2DBGlobals.setServiceProvider(client);
}
boolean reset = false;
try {
if (client instanceof NGClient && !CurrentWindow.exists()) {
// make sure that for an NGClient the current window is set.
CurrentWindow.set(new NGClientWebsocketSessionWindows(((NGClient) client).getWebsocketSession()));
reset = true;
}
return super.eval(value);
} finally {
if (reset)
CurrentWindow.set(null);
}
}
};
}
use of com.servoy.j2db.server.ngclient.NGClient in project servoy-client by Servoy.
the class NGClientEndpoint method handleException.
@Override
protected void handleException(final Exception e, final IWebsocketSession session) {
if (e instanceof ApplicationException) {
final ApplicationException ae = (ApplicationException) e;
// if the current window has no endpoint then quickly set it to this instance.
if (CurrentWindow.exists() && !CurrentWindow.get().hasEndpoint())
CurrentWindow.get().setEndpoint(this);
CurrentWindow.runForWindow(new NGClientWebsocketSessionWindows((INGClientWebsocketSession) session), new Runnable() {
@Override
public void run() {
if (ae.getErrorCode() == ServoyException.NO_LICENSE) {
session.getClientService("$sessionService").executeAsyncServiceCall("setNoLicense", new Object[] { getLicenseAndMaintenanceDetail() });
} else if (ae.getErrorCode() == ServoyException.MAINTENANCE_MODE) {
session.getClientService("$sessionService").executeAsyncServiceCall("setMaintenanceMode", new Object[] { getLicenseAndMaintenanceDetail() });
}
}
});
}
try {
((NGClient) ((INGClientWebsocketSession) session).getClient()).shutDown(true);
} catch (Exception e1) {
Debug.error("Error calling shutdown on client that had an exception when starting up: " + e.getMessage(), e1);
}
}
Aggregations