Package org.itsnat.core.event

Examples of org.itsnat.core.event.ItsNatAttachedClientTimerEvent


        if (phase == ItsNatAttachedClientEvent.REQUEST)
        {
            String[] msg = new String[1];
            if (event instanceof ItsNatAttachedClientTimerEvent)
            {
                ItsNatAttachedClientTimerEvent timerEvent = (ItsNatAttachedClientTimerEvent)event;
                boolean accepted = (timerEvent.getRefreshInterval() >= 3000);
                event.setAccepted(accepted);
                if (!accepted) msg[0] = "Refresh interval too short: " + timerEvent.getRefreshInterval();
            }
            else if (event instanceof ItsNatAttachedClientCometEvent)
            {
                event.setAccepted(true);
            }
View Full Code Here


        switch(phase)
        {
            case ItsNatAttachedClientEvent.REQUEST:
                if (event instanceof ItsNatAttachedClientTimerEvent)
                {
                    ItsNatAttachedClientTimerEvent timerEvent = (ItsNatAttachedClientTimerEvent)event;
                    boolean accepted = (timerEvent.getRefreshInterval() >= 1000);
                    if (!accepted)
                    {
                        try
                        {
                            Writer out = response.getWriter();
                            out.write("<html><body><h1>Remote control request rejected. Interval too short: ");
                            out.write(Integer.toString(timerEvent.getRefreshInterval()));
                            out.write("</h1></body></html>");
                        }
                        catch(IOException ex) { throw new RuntimeException(ex); }
                    }
                    event.setAccepted(accepted);
                }
                else if (event instanceof ItsNatAttachedClientCometEvent)
                {
                    event.setAccepted(true); // Nothing to check
                }
                else // "None" refresh mode
                {
                    event.setAccepted(true); // Nothing to check
                }

                if (event.getWaitDocTimeout() > 30000) // Demasiado tiempo de espera
                    event.setAccepted(false);
               
                if (!event.isAccepted())
                    return;

                break;

            case ItsNatAttachedClientEvent.LOAD:
                 //event.setAccepted(false);
                break;
            case ItsNatAttachedClientEvent.REFRESH:
                if (itsNatDoc.isInvalid())
                {
                    observer.addCodeToSend("alert('Observed document was destroyed');");
                }
                else if (event instanceof ItsNatAttachedClientTimerEvent)
                {
                    // Esto no es lo normal (modificar a trav�s de un visor el documento)
                    // pero es para probar.
                    // Lo normal es a partir del estado del DOM hacer algo en consecuencia
                    // junto con la sessi�n del "observado" que tenemos acceso a ella via ItsNatDocument
                    ItsNatAttachedClientTimerEvent timerEvent = (ItsNatAttachedClientTimerEvent)event;

                    long initTime = timerEvent.getItsNatServletRequest().getClientDocument().getCreationTime();
                    long currentTime = System.currentTimeMillis();
                    int limitMilisec = 15*60*1000; // 15 minutos, para evitar que est� indefinidamente
                    if (currentTime - initTime > limitMilisec)
                    {
                        event.setAccepted(false);
View Full Code Here

        if (phase == ItsNatAttachedClientEvent.REQUEST)
        {
            String[] msg = new String[1];
            if (event instanceof ItsNatAttachedClientTimerEvent)
            {
                ItsNatAttachedClientTimerEvent timerEvent = (ItsNatAttachedClientTimerEvent)event;
                boolean accepted = (timerEvent.getRefreshInterval() >= 3000);
                event.setAccepted(accepted);
                if (!accepted) msg[0] = "Refresh interval too short: " + timerEvent.getRefreshInterval();
            }
            else if (event instanceof ItsNatAttachedClientCometEvent)
            {
                event.setAccepted(true);
            }
View Full Code Here

TOP

Related Classes of org.itsnat.core.event.ItsNatAttachedClientTimerEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.