Package com.volantis.mcs.cache.css

Examples of com.volantis.mcs.cache.css.CSSCacheEntry


        //
        // Store our WritableCSSEntityMock in the cache and get the identity
        // that can be used to retrieve the entry.
        //
        CacheIdentity identity = cache.store(
                new CSSCacheEntry(writableCSSEntityMock));


        //
        // EXPECTATIONS
        //
View Full Code Here


        //
        // Store our WritableCSSEntityMock in the cache and get the identity
        // that can be used to retrieve the entry.
        //
        CacheIdentity identity = cache.store(
                new CSSCacheEntry(writableCSSEntityMock));
        //
        // Now remove all entries so we get a cache miss.
        //
        cache.clear();
View Full Code Here

            CSSCacheIdentity identity = new CSSCacheIdentity(base64Key);
            if (logger.isDebugEnabled()) {
                logger.debug("Key createTime is  " + identity.getCreateTime());
                logger.debug("Key sequenceNo is  " + identity.getSequenceNo());
            }
            CSSCacheEntry entity = (CSSCacheEntry) cssCache.retrieve(identity);
            if (entity != null) {
                response.setContentType("text/css");

                // Set caching HTTP headers.
                long nowTime = System.currentTimeMillis();
                long createTime = identity.getCreateTime();
                long expiresTime = identity.getExpiresTime();
               
                // Calculate max-age, avoiding negative values.
                long maxAgeSeconds = Math.max ((expiresTime - nowTime) / 1000, 0);
                   
                // Set HTTP 1.1 headers
                response.addHeader("Cache-Control", "max-age=" + maxAgeSeconds);
               
                // Set HTTP 1.0 headers
                response.setDateHeader("Date", createTime);
                response.setDateHeader("Expires", expiresTime);
               
                // Write HTTP contents
                PrintWriter out = response.getWriter();

                entity.getCacheObjectAsWritableCSSEntity().write(out);
               
                out.close();
            } else {
                response.sendError(HttpServletResponse.SC_NOT_FOUND);
            }
View Full Code Here

            }
        }

        // Create and store CSS Cache Entry.
        final CacheIdentity identity =
            cssCache.store(new CSSCacheEntry(entity, timeToLive));

        MarinerURL baseURL = getBaseURL();
        baseURL.setParameterValue("key", identity.getBase64KeyAsString());

        final String sessionType = configuration.getCssSessionType();
View Full Code Here

        cacheTime.expects.getTimeInMillis().returns(Integer.MAX_VALUE);

        // Create a new DefaultCacheStore with a TTL of 100
        CacheStore defaultCacheStore = new DefaultCacheStore(cacheTime,100);

        CacheEntry entry1 = new CSSCacheEntry(writableCSSEntityMock1);
        CacheEntry entry2 = new CSSCacheEntry(writableCSSEntityMock2, 50);
        CacheEntry entry3 = new CSSCacheEntry(writableCSSEntityMock2, 150);

        // We add the first identity which should get a cacheTime of 0,
        // expiresTime of 100 and a sequence number of 0
        CacheIdentity identity1 = defaultCacheStore.store(entry1);
        assertEquals("T1", identity1.getCreateTime(),0);
View Full Code Here

        // Create a new DefaultCacheStore with a TTL of 100
        CacheStore defaultCacheStore = new DefaultCacheStore(cacheTime,100);


        CacheEntry entry1 = new CSSCacheEntry(writableCSSEntityMock1);
        CacheEntry entry2 = new CSSCacheEntry(writableCSSEntityMock2, 40);

        CacheIdentity identity1 = defaultCacheStore.store(entry1);
        CacheIdentity identity2 = defaultCacheStore.store(entry2);

View Full Code Here

        // Create a new DefaultCacheStore with a TTL of 100
        CacheStore defaultCacheStore = new DefaultCacheStore(cacheTime,100);


        CacheEntry entry1 = new CSSCacheEntry(writableCSSEntityMock1);

        CacheIdentity identity1 = defaultCacheStore.store(entry1);

        assertEquals(entry1,defaultCacheStore.retrieve(identity1));
View Full Code Here

TOP

Related Classes of com.volantis.mcs.cache.css.CSSCacheEntry

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.