Package com.alibaba.citrus.service.requestcontext.session

Examples of com.alibaba.citrus.service.requestcontext.session.SessionConfig


    @Test
    public void random_id() {
        service = (RequestContextChainingServiceImpl) factory.getBean("rc2");
        SessionRequestContextFactoryImpl f = getFactory(service, SessionRequestContextFactoryImpl.class);
        SessionConfig config = f.getConfig();
        RandomIDGenerator rid = (RandomIDGenerator) config.getId().getGenerator();

        assertEquals(16, rid.getLength());
    }
View Full Code Here


    @Test
    public void lifecycle_log() {
        service = (RequestContextChainingServiceImpl) factory.getBean("rc2");
        SessionRequestContextFactoryImpl f = getFactory(service, SessionRequestContextFactoryImpl.class);
        SessionConfig config = f.getConfig();
        SessionLifecycleLogger sll = (SessionLifecycleLogger) config.getSessionInterceptors()[0];

        assertEquals("debug", getFieldValue(sll, "logLevel", Level.class).toString());
        assertEquals("trace", getFieldValue(sll, "visitLogLevel", Level.class).toString());
    }
View Full Code Here

    @Test
    public void session() {
        service = (RequestContextChainingServiceImpl) factory.getBean("rc2");
        SessionRequestContextFactoryImpl f = getFactory(service, SessionRequestContextFactoryImpl.class);
        SessionConfig config = f.getConfig();

        assertEquals("SESSION_MODEL", config.getModelKey());
        assertEquals(false, config.isKeepInTouch());

        assertEquals("JSESSIONID", config.getId().getCookie().getName());
        assertEquals("/", config.getId().getCookie().getPath());
        assertEquals(0, config.getId().getCookie().getMaxAge());
        assertEquals(true, config.getId().getCookie().isHttpOnly());
        assertEquals(false, config.getId().getCookie().isSecure());

        assertEquals("JSESSIONID", config.getId().getUrlEncode().getName());

        assertEquals(true, config.getId().isCookieEnabled());
        assertEquals(false, config.getId().isUrlEncodeEnabled());
    }
View Full Code Here

    @Test
    public void cookiestore() {
        service = (RequestContextChainingServiceImpl) factory.getBean("rc2");
        SessionRequestContextFactoryImpl f = getFactory(service, SessionRequestContextFactoryImpl.class);
        SessionConfig config = f.getConfig();

        StoresConfig stores = config.getStores();
        CookieStoreImpl cookieStore = (CookieStoreImpl) stores.getStore("s1");

        assertEquals("/", getFieldValue(cookieStore, "path", null));
        assertEquals(0, getFieldValue(cookieStore, "maxAge", null));
        assertEquals(true, getFieldValue(cookieStore, "httpOnly", null));
View Full Code Here

    @Test
    public void singlevalued_cookiestore() {
        service = (RequestContextChainingServiceImpl) factory.getBean("rc2");
        SessionRequestContextFactoryImpl f = getFactory(service, SessionRequestContextFactoryImpl.class);
        SessionConfig config = f.getConfig();

        StoresConfig stores = config.getStores();
        SingleValuedCookieStoreImpl cookieStore = (SingleValuedCookieStoreImpl) stores.getStore("s2");

        assertEquals("/", getFieldValue(cookieStore, "path", null));
        assertEquals(0, getFieldValue(cookieStore, "maxAge", null));
        assertEquals(true, getFieldValue(cookieStore, "httpOnly", null));
View Full Code Here

    @Test
    public void aes_encrypter() {
        service = (RequestContextChainingServiceImpl) factory.getBean("rc2");
        SessionRequestContextFactoryImpl f = getFactory(service, SessionRequestContextFactoryImpl.class);
        SessionConfig config = f.getConfig();

        StoresConfig stores = config.getStores();
        CookieStoreImpl cookieStore = (CookieStoreImpl) stores.getStore("s1");
        SessionEncoder[] encoders = getFieldValue(cookieStore, "encoders", SessionEncoder[].class);
        SerializationEncoder sencoder = (SerializationEncoder) encoders[0];
        AesEncrypter aes = (AesEncrypter) sencoder.getEncrypter();
View Full Code Here

    @Test
    public void random_id() {
        service = (RequestContextChainingServiceImpl) factory.getBean("rc2");
        SessionRequestContextFactoryImpl f = getFactory(service, SessionRequestContextFactoryImpl.class);
        SessionConfig config = f.getConfig();
        RandomIDGenerator rid = (RandomIDGenerator) config.getId().getGenerator();

        assertEquals(16, rid.getLength());
    }
View Full Code Here

    @Test
    public void lifecycle_log() {
        service = (RequestContextChainingServiceImpl) factory.getBean("rc2");
        SessionRequestContextFactoryImpl f = getFactory(service, SessionRequestContextFactoryImpl.class);
        SessionConfig config = f.getConfig();
        SessionLifecycleLogger sll = (SessionLifecycleLogger) config.getSessionInterceptors()[0];

        assertEquals("debug", getFieldValue(sll, "logLevel", Level.class).toString());
        assertEquals("trace", getFieldValue(sll, "visitLogLevel", Level.class).toString());
    }
View Full Code Here

            }
        };
    }

    private Set<String> getAttributeNameSet() {
        SessionConfig sessionConfig = requestContext.getSessionConfig();
        String[] storeNames = sessionConfig.getStores().getStoreNames();
        Set<String> attrNames = createLinkedHashSet();

        for (String storeName : storeNames) {
            SessionStore store = sessionConfig.getStores().getStore(storeName);

            for (String attrName : store.getAttributeNames(getId(), new StoreContextImpl(storeName))) {
                if (!isEquals(attrName, modelKey)) {
                    attrNames.add(attrName);
                }
View Full Code Here

            return SessionImpl.this.getServletContext();
        }

        public Object getAttribute(String name) {
            SessionAttribute attr = attrs.get(name);
            SessionConfig sessionConfig = requestContext.getSessionConfig();
            Object value;

            if (attr == null) {
                String storeName = sessionConfig.getStoreMappings().getStoreNameForAttribute(name);

                if (storeName == null) {
                    value = null;
                } else {
                    attr = new SessionAttribute(name, SessionImpl.this, storeName, new StoreContextImpl(storeName));
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.requestcontext.session.SessionConfig

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.