Examples of MetaAttributes


Examples of com.volantis.mcs.papi.MetaAttributes

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);
        VolantisProtocol protocol = pageContext.getProtocol();

        MetaAttributes attributes = (MetaAttributes) papiAttributes;
        // Copy the attributes.
        pattributes.setName(attributes.getName());
        pattributes.setHttpEquiv(attributes.getHttpEquiv());
        pattributes.setLang(attributes.getLang());
        pattributes.setContent(attributes.getContent());

        String name = pattributes.getName();

        if (null != name) {
            if (name.equals("mcs-" + TimedRefreshInfo.NAME)) {
                try {
                    TimedRefreshInfo tri =
                            new TimedRefreshInfo(attributes.getContent());
                    protocol.writeTimedRefresh(tri);
                } catch (NumberFormatException nfe) {
                    throw new PAPIException(EXCEPTION_LOCALIZER.format(
                            "invalid-attribute", new Object[]{
                            "mcs-" + TimedRefreshInfo.NAME,
                            pattributes.getContent()}), nfe);
                } catch (ProtocolException e) {
                    throw new PAPIException(EXCEPTION_LOCALIZER.format(
                            "invalid-attribute", new Object[]{
                            "mcs-" + TimedRefreshInfo.NAME,
                            pattributes.getContent()}), e);
                }
            } else if (name.equals(CACHE_AUTO)) {
                applyCacheAuto(context);
            } else if (name.equals(NO_CACHE)) {
                applyNoCache(context);
            } else if (name.equals(CACHE_MAX_AGE)) {
                applyCacheMaxAge(context, attributes.getContent());
            } else if (name.equals(CACHE_EXPIRES)) {
                applyCacheExpires(context, attributes.getContent());
            } else {
                protocol.writeMeta(pattributes);
            }
        } else {
            protocol.writeMeta(pattributes);
View Full Code Here

Examples of com.volantis.mcs.protocols.MetaAttributes

    }

    public void testDoMeta() throws Exception {
       privateSetUp();

       MetaAttributes attributes = new MetaAttributes();
       attributes.setContent("Test & encoding");
       attributes.setHttpEquiv("refresh");
       attributes.setName("URL");

       protocol.doMeta(buffer, attributes);

       // Check the meta tag and attributes
       Element nullElement = buffer.popElement();
View Full Code Here

Examples of com.volantis.mcs.protocols.MetaAttributes

     * This method tests the method public void writeMeta ( MetaAttributes )
     * for the com.volantis.mcs.protocols.VolantisProtocol class.
     * @todo fix this test
     */
    public void noTestWriteMeta() throws Exception {
        final MetaAttributes attributes =
                (MetaAttributes) ProtocolIntegrationTestHelper.
                provideAttributes(MetaAttributes.class);

        final VolantisProtocol protocol = getProtocol();

View Full Code Here

Examples of com.volantis.mcs.protocols.MetaAttributes

        ProtocolConfiguration conf = protocol.getProtocolConfiguration();
        int width = conf.getDevicePixelsX();
        String name = "viewport";
        String content = "width=" + width + ", initial-scale=1.0";

        MetaAttributes metaAttributes = new MetaAttributes();
        metaAttributes.setName(name);
        metaAttributes.setContent(content);

        // Write meta element to the head.
        protocol.doMeta(dom, metaAttributes);

    }
View Full Code Here

Examples of com.volantis.mcs.protocols.MetaAttributes

        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

Examples of com.volantis.mcs.protocols.MetaAttributes

    // Javadoc inherited from super class.
    protected void openHead(DOMOutputBuffer dom,
                            boolean empty) {

        // Write the meta tags to the head.
        MetaAttributes ma = new MetaAttributes();
        ma.setName("PalmComputingPlatform");
        ma.setContent("true");
        writeMeta(ma);

        ma.setName("HandheldFriendly");
        writeMeta(ma);

        super.openHead(dom, empty);
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.MetaAttributes

    // javadoc inherited
    protected void openHead(DOMOutputBuffer dom,
                            boolean empty) {

        // Write the meta tags to the head.
        MetaAttributes ma = new MetaAttributes();
        ma.setName("HandheldFriendly");
        ma.setContent("true");
        writeMeta(ma);

        super.openHead(dom, empty);
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.MetaAttributes

            context.getDevicePolicyValue(
                X_ELEMENT_SUPPORTS_META_REFRESH))) {
            if (logger.isDebugEnabled()) {
                logger.debug("writing timed refresh meta");
            }
            MetaAttributes attributes = new MetaAttributes();
            attributes.setHttpEquiv(TimedRefreshInfo.NAME);
            attributes.setContent(refreshInfo.getHTMLContent(context));


            DOMOutputBuffer dom =
                (DOMOutputBuffer) context.getProtocol().getPageHead().getHead();
            doMeta(dom, attributes);
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.