Package com.volantis.mcs.context

Examples of com.volantis.mcs.context.ResponseCachingDirectives$Priority


        // Set expires property on environment context. This would produce
        // appropriate cache-control/expires headers in HTTP response.
        final EnvironmentContext environmentContext =
            ContextInternals.getEnvironmentContext(
                context.getInitialRequestContext());
        final ResponseCachingDirectives cachingDirectives =
            environmentContext.getCachingDirectives();
        if (cachingDirectives != null) {
            cachingDirectives.setExpires((Time) content,
                ResponseCachingDirectives.PRIORITY_HIGH);
            cachingDirectives.enable();
        }
    }
View Full Code Here


        // Set maxAge property on environment context. This would produce
        // appropriate cache-control directives in HTTP response.
        final EnvironmentContext environmentContext =
            ContextInternals.getEnvironmentContext(
                context.getInitialRequestContext());
        final ResponseCachingDirectives cachingDirectives =
            environmentContext.getCachingDirectives();
        if (cachingDirectives != null) {
            cachingDirectives.setMaxAge((Period) content,
                ResponseCachingDirectives.PRIORITY_HIGH);
            cachingDirectives.enable();
        }
    }
View Full Code Here

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

        // Set maxAge property on environment context. This would produce
        // appropriate cache-control directives in HTTP response.
        final EnvironmentContext environmentContext =
            ContextInternals.getEnvironmentContext(
                context.getInitialRequestContext());
        final ResponseCachingDirectives cachingDirectives =
            environmentContext.getCachingDirectives();
        if (cachingDirectives != null) {
            cachingDirectives.setMaxAge((Period) content,
                ResponseCachingDirectives.PRIORITY_HIGH);
            cachingDirectives.enable();
        }
    }
View Full Code Here

        // Disable caching
        final EnvironmentContext environmentContext =
            ContextInternals.getEnvironmentContext(
                context.getInitialRequestContext());
        final ResponseCachingDirectives cachingDirectives =
            environmentContext.getCachingDirectives();
        if (cachingDirectives != null) {
            cachingDirectives.disable();
        }
    }
View Full Code Here

        if (context.isFragmentationSupported()) {
            if (!instance.isEmpty()) {
                final MarinerPageContext pageContext =
                    context.getDeviceLayoutContext().getMarinerPageContext();
                final ResponseCachingDirectives cachingDirectives =
                    pageContext.getEnvironmentContext().getCachingDirectives();
                // caching is not supported for fragmented forms
                if (cachingDirectives != null) {
                    cachingDirectives.disable();
                }

                FormFragment fragment = (FormFragment)instance.getFormat();
                Format child = fragment.getChildAt(0);
View Full Code Here

        final MediaAgent mediaAgent = context.getMediaAgent(false);
        if (mediaAgent != null) {

            final EnvironmentContext environmentContext =
                context.getEnvironmentContext();
            final ResponseCachingDirectives cachingDirectives =
                environmentContext.getCachingDirectives();
            if (cachingDirectives != null && cachingDirectives.isEnabled()) {
                final Period timeToLive =
                    cachingDirectives.getTimeToLive();
               
                // According to HTTp specification we treat "never expires" as "expires in approx. 1 year.
                // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
                final long ttl = ((Period.INDEFINITELY.equals(timeToLive))) ?
                        365 * 24 * 60 * 60 :
View Full Code Here

     */
    private void setResponseCacheHeaders() {

        final EnvironmentContext environmentContext =
            context.getEnvironmentContext();
        final ResponseCachingDirectives cachingDirectives =
            environmentContext.getCachingDirectives();
        if (cachingDirectives != null) {
            // disable caching if dissection is used
            if (isDissectionNeeded()) {
                cachingDirectives.disable();
            }
            if (cachingDirectives.isEnabled() &&
                    !ResponseCachingDirectives.PRIORITY_NORMAL.isLower(
                        cachingDirectives.getExpiresPriority())) {
                final XMLPipelineContext pipelineContext =
                    environmentContext.getPipelineContext();
                final DependencyContext dependencyContext =
                    pipelineContext.getDependencyContext();
                if (dependencyContext.isTrackingDependencies()) {
                    final Dependency dependency =
                        dependencyContext.extractDependency();
                    if (dependency.getCacheability() == Cacheability.CACHEABLE) {
                        cachingDirectives.setMaxAge(dependency.getTimeToLive(),
                            ResponseCachingDirectives.PRIORITY_NORMAL);
                        cachingDirectives.enable();
                    } else {
                        cachingDirectives.disable();
                    }
                }
            }
        }
        environmentContext.applyCachingDirectives();
View Full Code Here

        contextPathURL = new MarinerURL("/mariner/url");

        final EnvironmentContextMock environmentContextMock =
            new EnvironmentContextMock("environmentContextMock", expectations);

        cachingDirectives = new ResponseCachingDirectives(SystemClock.getDefaultInstance());
        cachingDirectives.enable();
        assertTrue(cachingDirectives.isEnabled());

        environmentContextMock.expects.getCachingDirectives().returns(
            cachingDirectives).any();
View Full Code Here

            throws PAPIException {

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        final ResponseCachingDirectives cachingDirectives =
                pageContext.getEnvironmentContext().getCachingDirectives();
        if (cachingDirectives != null) {
            cachingDirectives.disable();
        }

        XFFormAttributes attributes = (XFFormAttributes) papiAttributes;

        // Try and find the form with the specified name, if it could not be
View Full Code Here

TOP

Related Classes of com.volantis.mcs.context.ResponseCachingDirectives$Priority

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.