Package com.volantis.mcs.context

Examples of com.volantis.mcs.context.MarinerPageContext


  // Javadoc inherited from super class.
  public int elementStart (MarinerRequestContext context,
                           PAPIAttributes papiAttributes)
    throws PAPIException {

    MarinerPageContext pageContext
      = ContextInternals.getMarinerPageContext (context);

    VolantisProtocol protocol = pageContext.getProtocol ();
    protocol.pushHeadBuffer ();

    // Make sure that the attributes are of the correct type.
    PickleHeadAttributes attributes = (PickleHeadAttributes) papiAttributes;
   
View Full Code Here


    // Make sure that the attributes are of the correct type.
    PickleHeadAttributes attributes = (PickleHeadAttributes) papiAttributes;
   
    super.elementEnd (context, papiAttributes);

    MarinerPageContext pageContext
      = ContextInternals.getMarinerPageContext (context);

    VolantisProtocol protocol = pageContext.getProtocol ();
    protocol.popHeadBuffer ();

    return CONTINUE_PROCESSING;
  }
View Full Code Here

    public void process(Object content, XDIMEContextInternal context,
                        String id, String propertyName) throws XDIMEException {

        super.process(content, context, id, propertyName);

        MarinerPageContext ctx = ContextInternals.getMarinerPageContext(
            context.getInitialRequestContext());

        MetaData metaData = context.getPageMetaData();
        MetaAttributes attributes = new MetaAttributes();

        //add all search engine meta tags i.e. description, keywords, author       
        if(MetaPropertyHandlerFactory.DESCRIPTION.equals(propertyName)
                &&  DevicePolicyConstants.FULL_SUPPORT_POLICY_VALUE
                .equals(ctx.getDevicePolicyValue(DevicePolicyConstants.X_ELEMENT_SUPPORTS_META_DESCRIPTION))) {

            attributes.setName(MetaPropertyHandlerFactory.DESCRIPTION);
            attributes.setContent((String) metaData.getPropertyValue(MetaPropertyHandlerFactory.DESCRIPTION));
            ctx.getProtocol().writeMeta(attributes);           
        }   

        if(MetaPropertyHandlerFactory.KEYWORDS.equals(propertyName)
                &&  DevicePolicyConstants.FULL_SUPPORT_POLICY_VALUE
                .equals(ctx.getDevicePolicyValue(DevicePolicyConstants.X_ELEMENT_SUPPORTS_META_KEYWORDS))) {

            attributes.setName(MetaPropertyHandlerFactory.KEYWORDS);
            String value = null;
            if(metaData.getPropertyValue(MetaPropertyHandlerFactory.KEYWORDS) != null) {
                value = normalize((String) metaData.getPropertyValue(MetaPropertyHandlerFactory.KEYWORDS));
            }
            attributes.setContent(value);
            ctx.getProtocol().writeMeta(attributes);
        }           

        if(MetaPropertyHandlerFactory.AUTHOR.equals(propertyName)
                &&  DevicePolicyConstants.FULL_SUPPORT_POLICY_VALUE
                .equals(ctx.getDevicePolicyValue(DevicePolicyConstants.X_ELEMENT_SUPPORTS_META_AUTHOR))) {
           
            attributes.setName(AUTHOR_HTML_META);
            attributes.setContent((String) metaData.getPropertyValue(MetaPropertyHandlerFactory.AUTHOR));
            ctx.getProtocol().writeMeta(attributes);
        }
    }
View Full Code Here

            // As the first stage of this we deal with any per-project default
            // themes and layouts. These need to be set up before we get any
            // per-page versions.

            // Get the current project.
            MarinerPageContext pageContext = getPageContext(context);
            final RuntimeProject runtimeProject = (RuntimeProject)
                    pageContext.getCurrentProject();

            if (runtimeProject != null) {
                // Add any project specified style sheets into the list of
                // theme style sheets. These must be added before any style
                // sheets that are specified in the head.
View Full Code Here

     * @param runtimeProject
     */
    private void addProjectStyleSheets(XDIMEContextInternal context,
            RuntimeProject runtimeProject) {

        MarinerPageContext pageContext = getPageContext(context);

        // Find any theme style sheets which are specified in the project,
        // compile them and add them to the collection of compiled theme style
        // sheets.
        List projectThemeLocations =
                runtimeProject.getProjectThemesLocations();
        if (projectThemeLocations != null) {
            for (Iterator themeLocations = projectThemeLocations.iterator();
                 themeLocations.hasNext();) {
                String projectThemeLocation = (String) themeLocations.next();
                if (projectThemeLocation != null) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Project theme: " + projectThemeLocation);
                    }
                    CompiledStyleSheet projectStyleSheet =
                            pageContext.retrieveThemeStyleSheet(
                                    projectThemeLocation);
                    if (projectStyleSheet != null) {
                        themeStyleSheets.addStyleSheet(projectStyleSheet);
                    }
                }
View Full Code Here

  // Javadoc inherited from super class.
  public int elementStart (MarinerRequestContext context,
                           PAPIAttributes papiAttributes)
    throws PAPIException {

    MarinerPageContext pageContext
      = ContextInternals.getMarinerPageContext (context);

      if (pageContext.insideXDIMECPElement()) {
          throw new PAPIException(EXCEPTION_LOCALIZER.format(
                  "element-not-allowed-inside-xdimecp", papiAttributes.getElementName()));
      }

    PickleAttributes attributes = (PickleAttributes) papiAttributes;

    pattributes.setElementName (attributes.getElementName ());
    pattributes.setAttributes (attributes.getAttributes ());
   
    VolantisProtocol protocol = pageContext.getProtocol ();
    protocol.writeOpenElement (pattributes);

    // Push this element.
    pageContext.pushElement (this);
   
    return PROCESS_ELEMENT_BODY;
  }
View Full Code Here

  // Javadoc inherited from super class.
  public int elementEnd (MarinerRequestContext context,
                         PAPIAttributes papiAttributes)
    throws PAPIException {
   
    MarinerPageContext pageContext
      = ContextInternals.getMarinerPageContext (context);

    PickleAttributes attributes = (PickleAttributes) papiAttributes;
   
    // Pop this element.
    pageContext.popElement (this);

    VolantisProtocol protocol = pageContext.getProtocol ();
    protocol.writeCloseElement (pattributes);
   
    return CONTINUE_PROCESSING;
  }
View Full Code Here

    // javadoc inherited
    public void process(Object content, XDIMEContextInternal context,
                        String id, String propertyName) throws XDIMEException {
        super.process(content, context, id, propertyName);
        MarinerPageContext ctx = ContextInternals.getMarinerPageContext(
            context.getInitialRequestContext());
        TimedRefreshInfo tri = (TimedRefreshInfo) content;
        if (null != tri) {
            try {
                ctx.getProtocol().writeTimedRefresh(tri);
            } catch (ProtocolException e) {
                throw new XDIMEException(e);
            }
        }
    }
View Full Code Here

    public void render(final FormatRendererContext context, final FormatInstance instance)
            throws RendererException {

        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();
                }
View Full Code Here

                    factory.createExtractor(configuration, extractorContext);
            StyleSheet styleSheet = extractor.extract(document);

            StringWriter cssStringWriter = new StringWriter();
            StyleSheetRenderer renderer = getStyleSheetRenderer();
            MarinerPageContext marinerPageContext = getMarinerPageContext();

            // todo better detect empty style sheet here and avoid rendering,
            // and also remove dubious check for empty in renderStyleSheet?
            MarinerRequestContext requestContext =
                marinerPageContext.getRequestContext();
            com.volantis.mcs.css.renderer.RendererContext runtimeCSSRendererContext =
                    new RuntimeRendererContext(cssStringWriter,
                            renderer, this,
                            getProtocolConfiguration().getCssVersion());
            renderer.renderStyleSheet(styleSheet,
View Full Code Here

TOP

Related Classes of com.volantis.mcs.context.MarinerPageContext

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.