Package com.volantis.mcs.context

Examples of com.volantis.mcs.context.ResponseCachingDirectives.enable()


    }

    public void testApplyCachingDirectivesNoExpires() {
        final ResponseCachingDirectives cachingDirectives =
            envContext.getCachingDirectives();
        cachingDirectives.enable();
        envContext.applyCachingDirectives();
        assertEquals("no-cache", response.getHeader("Pragma"));
        assertEquals("no-cache", response.getHeader("Cache-Control"));
        final Calendar calendar =
            new GregorianCalendar(1990, Calendar.JANUARY, 1);
View Full Code Here


    }

    public void testApplyCachingDirectivesWithExpires() {
        final ResponseCachingDirectives cachingDirectives =
            envContext.getCachingDirectives();
        cachingDirectives.enable();
        final long expiresInMilliSeconds = System.currentTimeMillis() + 50000;
        cachingDirectives.setExpires(Time.inMilliSeconds(expiresInMilliSeconds),
            ResponseCachingDirectives.PRIORITY_NORMAL);
        envContext.applyCachingDirectives();
View Full Code Here

    }

    public void testApplyCachingDirectivesWithMaxAge() {
        final ResponseCachingDirectives cachingDirectives =
            envContext.getCachingDirectives();
        cachingDirectives.enable();
        cachingDirectives.setMaxAge(Period.inSeconds(50),
            ResponseCachingDirectives.PRIORITY_NORMAL);
        envContext.applyCachingDirectives();

        final String maxAgeValue = response.getHeader("Cache-Control");
View Full Code Here

    }

    public void testApplyCachingDirectivesDisabled() {
        final ResponseCachingDirectives cachingDirectives =
            envContext.getCachingDirectives();
        cachingDirectives.enable();
        cachingDirectives.setMaxAge(Period.inSeconds(50),
            ResponseCachingDirectives.PRIORITY_NORMAL);
        cachingDirectives.disable();

        envContext.applyCachingDirectives();
View Full Code Here

        final ResponseCachingDirectives cachingDirectives =
            environmentContext.getCachingDirectives();
        if (cachingDirectives != null) {
            cachingDirectives.setExpires((Time) content,
                ResponseCachingDirectives.PRIORITY_HIGH);
            cachingDirectives.enable();
        }
    }
}
View Full Code Here

        final ResponseCachingDirectives cachingDirectives =
            environmentContext.getCachingDirectives();
        if (cachingDirectives != null) {
            cachingDirectives.setMaxAge((Period) content,
                ResponseCachingDirectives.PRIORITY_HIGH);
            cachingDirectives.enable();
        }
    }
}
View Full Code Here

            ContextInternals.getEnvironmentContext(
                context.getInitialRequestContext());
        final ResponseCachingDirectives cachingDirectives =
            environmentContext.getCachingDirectives();
        if (cachingDirectives != null) {
            cachingDirectives.enable();
        }
    }
}
View Full Code Here

        final ResponseCachingDirectives cachingDirectives =
            environmentContext.getCachingDirectives();
        if (cachingDirectives != null) {
            cachingDirectives.setMaxAge((Period) content,
                ResponseCachingDirectives.PRIORITY_HIGH);
            cachingDirectives.enable();
        }
    }
}
View Full Code Here

                    final Dependency dependency =
                        dependencyContext.extractDependency();
                    if (dependency.getCacheability() == Cacheability.CACHEABLE) {
                        cachingDirectives.setMaxAge(dependency.getTimeToLive(),
                            ResponseCachingDirectives.PRIORITY_NORMAL);
                        cachingDirectives.enable();
                    } else {
                        cachingDirectives.disable();
                    }
                }
            }
View Full Code Here

                Time expires = Time.inMilliSeconds(httpDate.getTime());

                cachingDirectives.setExpires(expires,
                        ResponseCachingDirectives.PRIORITY_HIGH);
                cachingDirectives.enable();
            } catch (NumberFormatException e) {

            }
        }
    }
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.