Search in sources :

Example 1 with INGClientWebsocketSession

use of com.servoy.j2db.server.ngclient.INGClientWebsocketSession 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);
    }
}
Also used : ApplicationException(com.servoy.j2db.ApplicationException) NGClientWebsocketSessionWindows(com.servoy.j2db.server.ngclient.eventthread.NGClientWebsocketSessionWindows) INGClientWebsocketSession(com.servoy.j2db.server.ngclient.INGClientWebsocketSession) NGClient(com.servoy.j2db.server.ngclient.NGClient) JSONObject(org.json.JSONObject) ServoyException(com.servoy.j2db.util.ServoyException) ApplicationException(com.servoy.j2db.ApplicationException) IOException(java.io.IOException)

Example 2 with INGClientWebsocketSession

use of com.servoy.j2db.server.ngclient.INGClientWebsocketSession in project servoy-client by Servoy.

the class DebugClientHandler method createDebugNGClient.

public synchronized IDebugClient createDebugNGClient(Object wsSession) throws Exception {
    IFlattenedSolutionDebugListener debugListener = null;
    if (debugNGClient != null && debugNGClient.getFlattenedSolution() != null) {
        debugListener = debugNGClient.getFlattenedSolution().getDebugListener();
    }
    if (debugNGClient != null && !debugNGClient.isShutDown()) {
        debugNGClient.shutDown(true);
    }
    debugNGClient = new DebugNGClient((INGClientWebsocketSession) wsSession, designerCallback);
    if (debugListener != null && debugNGClient.getFlattenedSolution() != null)
        debugNGClient.getFlattenedSolution().registerDebugListener(debugListener);
    return debugNGClient;
}
Also used : IDebugNGClient(com.servoy.j2db.IDebugNGClient) INGClientWebsocketSession(com.servoy.j2db.server.ngclient.INGClientWebsocketSession) IFlattenedSolutionDebugListener(com.servoy.j2db.server.shared.IFlattenedSolutionDebugListener)

Aggregations

INGClientWebsocketSession (com.servoy.j2db.server.ngclient.INGClientWebsocketSession)2 ApplicationException (com.servoy.j2db.ApplicationException)1 IDebugNGClient (com.servoy.j2db.IDebugNGClient)1 NGClient (com.servoy.j2db.server.ngclient.NGClient)1 NGClientWebsocketSessionWindows (com.servoy.j2db.server.ngclient.eventthread.NGClientWebsocketSessionWindows)1 IFlattenedSolutionDebugListener (com.servoy.j2db.server.shared.IFlattenedSolutionDebugListener)1 ServoyException (com.servoy.j2db.util.ServoyException)1 IOException (java.io.IOException)1 JSONObject (org.json.JSONObject)1