Package com.volantis.mcs.papi

Examples of com.volantis.mcs.papi.ScriptAttributes


        ContextInternals.setMarinerPageContext(requestContext, pageContext);
        protocol.setMarinerPageContext(pageContext);

        element = new ScriptElementImpl();
        attributes = new ScriptAttributes();       

    }
View Full Code Here


    protected int exprElementStart(
            MarinerRequestContext context,
            PAPIAttributes papiAttributes)
            throws PAPIException {

        ScriptAttributes attributes = (ScriptAttributes) papiAttributes;

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        VolantisProtocol protocol = pageContext.getProtocol();

        // Check if the Policy x-element.script.supported is set to default, via
        // the supportsScriptType() method of protocol. If so, exercise the same
        // behaviour as before VBM 20080131102 ie. check the "protocol"
        // support and followup check on boolean device policy "javascript".
        if ((protocol.supportsScriptType() == null) ||
             ("default".equals(protocol.supportsScriptType())) ) {

            // Check to see whether the protocol supports java script and the
            // device supports JavaScript, if either don't then skip the body.
            //
            // Note: This functionality is copied directly from the ScriptTag.
            if (!protocol.supportsJavaScript ()
              || !pageContext.getBooleanDevicePolicyValue (SUPPORTS_JAVASCRIPT)) {
               return SKIP_ELEMENT_BODY;
            }

        } else if ("full".equals(protocol.supportsScriptType())) {
            // Scripts are supported in an override due to the, so just check
            // on the device javascript policy to enable it fully. If it's not
            // set then return (SKIP), otherwise carry on. NOTE: Here, where are
            // getting the opinion of the actual device, not an inference derived
            // from the protocol.
            if (!pageContext.getBooleanDevicePolicyValue (SUPPORTS_JAVASCRIPT)) {
               return SKIP_ELEMENT_BODY;
            }
           
        } else {
        // If "none" or other is specified, SKIP this entirely irrespective
        // of any other settings.
               return SKIP_ELEMENT_BODY;
        }

        PolicyReferenceResolver resolver =
                pageContext.getPolicyReferenceResolver();

        // Parse the source expression.
        ScriptAssetReference src
                = resolver.resolveQuotedScriptExpression(attributes.getSrc());

        // Set the attributes used in both modes.
        String id = attributes.getId();
        pattributes.setId(id);
        pattributes.setDefer(attributes.getDefer());

        // @todo this code duplicates the functionality of the protocols Script
        // object. we should refactor it away...
        if (src != null && src.isPolicyReference()) {
            ScriptAsset asset = src.getScriptAsset();
            // If no asset was found then there is nothing more to do.
            if (asset == null) {
                return SKIP_ELEMENT_BODY;
            }

            // If an id was specified then we need to remember whether we found a
            // suitable ScriptAsset, or not.
            if (id != null) {
                pageContext.putIdValue(id, asset);
            }

            pattributes.setScriptReference(src);
            pattributes.setCharSet(asset.getCharacterSet());
            pattributes.setType(asset.getMimeType());
            pattributes.setLanguage(asset.getProgrammingLanguage());

            // Write the open script.
            protocol.writeOpenScript(pattributes);
            opened = true;
            return SKIP_ELEMENT_BODY;

        } else {
            // Use the deprecated attributes.
            pattributes.setTitle(attributes.getTitle());

            pattributes.setCharSet(attributes.getCharSet());
            pattributes.setLanguage(attributes.getLanguage());
            pattributes.setScriptReference(src);
            pattributes.setType(attributes.getType());

            protocol.writeOpenScript(pattributes);
            opened = true;

            return PROCESS_ELEMENT_BODY;
View Full Code Here

TOP

Related Classes of com.volantis.mcs.papi.ScriptAttributes

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.