Examples of HttpCache


Examples of com.volantis.xml.pipeline.sax.drivers.web.HTTPCache

     * @return 0 as it always succeeds. Note that the cache may not be empty
     * after the flush has completed if concurrent requests cause new entries
     * to be inserted as the flush is proceeding.
     */
    public HTTPCache getHTTPCache() {
        return new HTTPCache() {
            public int flushCache(String filterPattern) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Flushing the entire cache.");
                }
                cache.getRootGroup().flush(null);
View Full Code Here

Examples of net.sf.jpluck.http.HttpCache

    public HttpCache getHttpCache() {
        if (httpCache == null) {
            String dir = getCacheDirectory();
            if (dir.length() > 0) {
                httpCache = new HttpCache(dir + File.separator + "cache", getCacheExpiration());
            }
        }
        return httpCache;
    }
View Full Code Here

Examples of net.sf.jpluck.http.HttpCache

        CompactCacheAction() {
            super("Compact now");
        }

        public void actionPerformed(ActionEvent ev) {
            HttpCache httpCache = ClientConfiguration.getDefault().getHttpCache();
            if (httpCache != null) {
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                httpCache.open();
                httpCache.shutdownCompact();
                setCursor(Cursor.getDefaultCursor());
            }
        }
View Full Code Here

Examples of net.sourceforge.stripes.action.HttpCache

        if (ctx.isResolutionFromHandler() && (actionBean != null) && (handler != null)) {
            final Class<? extends ActionBean> beanClass = actionBean.getClass();
            // if caching is disabled, then set the appropriate response headers
            logger.debug("Looking for ", HttpCache.class.getSimpleName(), " on ", beanClass
                    .getName(), ".", handler.getName(), "()");
            HttpCache annotation = getAnnotation(handler, beanClass);
            if (annotation != null) {
                HttpServletResponse response = ctx.getActionBeanContext().getResponse();
                if (annotation.allow()) {
                    long expires = annotation.expires();
                    if (expires != HttpCache.DEFAULT_EXPIRES) {
                        logger.debug("Response expires in ", expires, " seconds");
                        expires = expires * 1000 + System.currentTimeMillis();
                        response.setDateHeader("Expires", expires);
                    }
View Full Code Here

Examples of net.sourceforge.stripes.action.HttpCache

     */
    protected HttpCache getAnnotation(Method method, Class<? extends ActionBean> beanClass) {
        // check cache first
        CacheKey cacheKey = new CacheKey(method, beanClass);
        if (cache.containsKey(cacheKey)) {
            HttpCache annotation = cache.get(cacheKey);
            return annotation;
        }

        // not found in cache so figure it out
        HttpCache annotation = method.getAnnotation(HttpCache.class);
        if (annotation == null) {
            // search the method's class and its superclasses
            Class<?> clazz = beanClass;
            do {
                annotation = clazz.getAnnotation(HttpCache.class);
                clazz = clazz.getSuperclass();
            } while (clazz != null && annotation == null);
        }

        // check for weirdness
        if (annotation != null) {
            logger.debug("Found ", HttpCache.class.getSimpleName(), " for ", beanClass.getName(),
                    ".", method.getName(), "()");
            int expires = annotation.expires();
            if (annotation.allow() && expires != HttpCache.DEFAULT_EXPIRES && expires < 0) {
                logger.warn(HttpCache.class.getSimpleName(), " for ", beanClass.getName(), ".",
                        method.getName(), "() allows caching but expires in the past");
            }
            else if (!annotation.allow() && expires != HttpCache.DEFAULT_EXPIRES) {
                logger.warn(HttpCache.class.getSimpleName(), " for ", beanClass.getName(), ".",
                        method.getName(), "() disables caching but explicitly sets expires");
            }
        }

View Full Code Here

Examples of net.sourceforge.stripes.action.HttpCache

        if (actionBean != null && handler != null) {
            final Class<? extends ActionBean> beanClass = actionBean.getClass();
            // if caching is disabled, then set the appropriate response headers
            logger.debug("Looking for ", HttpCache.class.getSimpleName(), " on ", beanClass
                    .getName(), ".", handler.getName(), "()");
            HttpCache annotation = getAnnotation(handler, beanClass);
            if (annotation != null) {
                HttpServletResponse response = ctx.getActionBeanContext().getResponse();
                if (annotation.allow()) {
                    long expires = annotation.expires();
                    if (expires != HttpCache.DEFAULT_EXPIRES) {
                        logger.debug("Response expires in ", expires, " seconds");
                        expires = expires * 1000 + System.currentTimeMillis();
                        response.setDateHeader("Expires", expires);
                    }
View Full Code Here

Examples of net.sourceforge.stripes.action.HttpCache

     */
    protected HttpCache getAnnotation(Method method, Class<? extends ActionBean> beanClass) {
        // check cache first
        CacheKey cacheKey = new CacheKey(method, beanClass);
        if (cache.containsKey(cacheKey)) {
            HttpCache annotation = cache.get(cacheKey);
            return annotation;
        }

        // not found in cache so figure it out
        HttpCache annotation = method.getAnnotation(HttpCache.class);
        if (annotation == null) {
            // search the method's class and its superclasses
            Class<?> clazz = beanClass;
            do {
                annotation = clazz.getAnnotation(HttpCache.class);
                clazz = clazz.getSuperclass();
            } while (clazz != null && annotation == null);
        }

        // check for weirdness
        if (annotation != null) {
            logger.debug("Found ", HttpCache.class.getSimpleName(), " for ", beanClass.getName(),
                    ".", method.getName(), "()");
            int expires = annotation.expires();
            if (annotation.allow() && expires != HttpCache.DEFAULT_EXPIRES && expires < 0) {
                logger.warn(HttpCache.class.getSimpleName(), " for ", beanClass.getName(), ".",
                        method.getName(), "() allows caching but expires in the past");
            }
            else if (!annotation.allow() && expires != HttpCache.DEFAULT_EXPIRES) {
                logger.warn(HttpCache.class.getSimpleName(), " for ", beanClass.getName(), ".",
                        method.getName(), "() disables caching but explicitly sets expires");
            }
        }

View Full Code Here

Examples of net.sourceforge.stripes.action.HttpCache

        if (actionBean != null && handler != null) {
            final Class<? extends ActionBean> beanClass = actionBean.getClass();
            // if caching is disabled, then set the appropriate response headers
            logger.debug("Looking for ", HttpCache.class.getSimpleName(), " on ",
                    beanClass.getName(), ".", handler.getName(), "()");
            final HttpCache annotation = getAnnotation(handler, beanClass);
            if (annotation != null) {
                final HttpServletResponse response = ctx.getActionBeanContext().getResponse();
                if (annotation.allow()) {
                    long expires = annotation.expires();
                    if (expires != HttpCache.DEFAULT_EXPIRES) {
                        logger.debug("Response expires in ", expires, " seconds");
                        expires = expires * 1000 + System.currentTimeMillis();
                        response.setDateHeader("Expires", expires);
                    }
View Full Code Here

Examples of net.sourceforge.stripes.action.HttpCache

     * @return The first {@link HttpCache} annotation found. If none is found then null.
     */
    protected HttpCache getAnnotation(Method method, Class<? extends ActionBean> beanClass) {
        // check cache first
        final CacheKey cacheKey = new CacheKey(method, beanClass);
        HttpCache annotation = cache.get(cacheKey);
        if (annotation != null) {
            return annotation == NULL_CACHE ? null : annotation;
        }

        // not found in cache so figure it out
        annotation = method.getAnnotation(HttpCache.class);
        if (annotation == null) {
            // search the method's class and its superclasses
            Class<?> clazz = beanClass;
            do {
                annotation = clazz.getAnnotation(HttpCache.class);
                clazz = clazz.getSuperclass();
            } while (clazz != null && annotation == null);
        }

        // check for weirdness
        if (annotation != null) {
            logger.debug("Found ", HttpCache.class.getSimpleName(), " for ", beanClass.getName(),
                    ".", method.getName(), "()");
            final int expires = annotation.expires();
            if (annotation.allow() && expires != HttpCache.DEFAULT_EXPIRES && expires < 0) {
                logger.warn(HttpCache.class.getSimpleName(), " for ", beanClass.getName(), ".",
                        method.getName(), "() allows caching but expires in the past");
            }
            else if (!annotation.allow() && expires != HttpCache.DEFAULT_EXPIRES) {
                logger.warn(HttpCache.class.getSimpleName(), " for ", beanClass.getName(), ".",
                        method.getName(), "() disables caching but explicitly sets expires");
            }
        }
        else {
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpCache

public class OAuthFetcherConfigTest extends EasyMockTestCase {

  @Test
  public void testOAuthFetcherConfig() {
    BlobCrypter crypter = mock(BlobCrypter.class);
    HttpCache cache = mock(HttpCache.class);
    GadgetOAuthTokenStore tokenStore = mock(GadgetOAuthTokenStore.class);
    OAuthFetcherConfig config = new OAuthFetcherConfig(crypter, tokenStore, cache, new TimeSource());
    assertEquals(crypter, config.getStateCrypter());
    assertEquals(cache, config.getHttpCache());
    assertEquals(tokenStore, config.getTokenStore());
View Full Code Here
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.