Package test

Source Code of test.SharedInitContextConf

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package test;

import java.util.Date;
import javax.servlet.ServletContext;
import org.itsnat.core.ItsNatServletConfig;
import org.itsnat.core.ItsNatServletContext;
import org.itsnat.core.http.ItsNatHttpServlet;

/**
*
* @author jmarranz
*/
public class SharedInitContextConf
{

    public static void init(ServletContext context,ItsNatHttpServlet itsNatServlet)
    {
        int maxOpenDocumentsBySession = 6; // Hay que tener en cuenta los ejemplos con iframes
        boolean sessionReplicationGAE = true; // En GAE
        boolean sessionReplicationNotGAE = false; // No GAE
        boolean sessionSerializeCompressed = false;
        boolean sessionExplicitSerialize = false;
        //long sessionExplicitSerializeFragmentSize = 0; /*100*1024;*/ // 0 = un s�lo fragmento, X = n�mero de bytes fragmento, setSessionReplicationXXX(boolean) debe estar a true tambi�n


        ItsNatServletConfig itsNatConfig = itsNatServlet.getItsNatServletConfig();

        ItsNatServletContext itsNatCtx = itsNatConfig.getItsNatServletContext();
        itsNatCtx.setMaxOpenDocumentsBySession(maxOpenDocumentsBySession);
        // http://radomirmladenovic.info/2009/06/15/detecting-code-execution-on-google-app-engine
        boolean gae = context.getServerInfo().startsWith("Google App Engine");
        itsNatCtx.setSessionReplicationCapable(gae ? sessionReplicationGAE : sessionReplicationNotGAE);
        if (gae) System.out.println("Session Replication: " + itsNatCtx.isSessionReplicationCapable());

        itsNatCtx.setSessionSerializeCompressed(sessionSerializeCompressed);
        itsNatCtx.setSessionExplicitSerialize(sessionExplicitSerialize);
        // itsNatCtx.setSessionExplicitSerializeFragmentSize(sessionExplicitSerializeFragmentSize);
    }

}
TOP

Related Classes of test.SharedInitContextConf

TOP
Copyright © 2018 www.massapi.com. 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.