Examples of PackageResources


Examples of com.volantis.mcs.runtime.packagers.PackageResources

        // correctly
        MultipartPackageHandler handler =
            new MultipartPackageHandler();
        ApplicationContext applicationContext = new ApplicationContext(testRequestContext);
        applicationContext.setAssetURLRewriter(handler);
        PackageResources packageResources = new MultipartApplicationContext(testRequestContext);
        applicationContext.setPackageResources(packageResources);
        Packager packager = new MultipartPackageHandler();
        applicationContext.setPackager(packager);

        MarinerPageContext context = new MarinerPageContext();
View Full Code Here

Examples of com.volantis.mcs.runtime.packagers.PackageResources

        // correctly
        MultipartPackageHandler handler =
            new MultipartPackageHandler();
        ApplicationContext applicationContext = new ApplicationContext(testRequestContext);
        applicationContext.setAssetURLRewriter(handler);
        PackageResources packageResources = new MultipartApplicationContext(testRequestContext);
        applicationContext.setPackageResources(packageResources);
        Packager packager = new MultipartPackageHandler();
        applicationContext.setPackager(packager);

        MarinerPageContext context = new MarinerPageContext();
View Full Code Here

Examples of com.volantis.mcs.runtime.packagers.PackageResources

     * a value has been set).
     *
     * @return the application specific PackageResources instance
     */
    public PackageResources getPackageResources() {
        PackageResources pr = packageResources;

        if (packager == null) {
            pr = null;
        }

View Full Code Here

Examples of com.volantis.mcs.runtime.packagers.PackageResources

                if ((packagingType != null) &&
                        ((mode == MimePackagingMode.ALWAYS) ||
                        ((packagingType = findPackaging(protocol,
                                                        requestContext)) !=
                         null))) {
                    PackageResources packageResources;

                    synchronized (this) {
                        if (handler == null) {
                            handler = new MultipartPackageHandler(
                                    volantisBean.getAssetURLRewriter());
                        }
                    }

                    applicationContext.setPackager(handler);
                    applicationContext.setAssetURLRewriter(handler);
                    applicationContext.setPackagedURLEncoder(handler);
                    packagerAssigned = true;

                    // Must be fetched after setting the packager
                    packageResources =
                            applicationContext.getPackageResources();

                    // Since we're doing multipart packaging make sure the
                    // correct content type is assigned to the over-all package
                    // (This condition is expected to succeed)
                    if (packageResources != null) {
                        packageResources.setContentType(packagingType);
                    }
                }
            }
        }
View Full Code Here

Examples of com.volantis.mcs.runtime.packagers.PackageResources

        if (!(asset instanceof LinkAsset)) {
            String plain = rewritten.getExternalForm();
            String encoded = getEncodedURI(plain);
            ApplicationContext ac =
                ContextInternals.getApplicationContext(requestContext);
            PackageResources pr = ac.getPackageResources();

            if (pr != null) {
                boolean onClientSide = false;
                if (assetGroup != null) {
                    onClientSide = (assetGroup.getLocationType() ==
                            AssetGroup.ON_DEVICE);
                }
                if (!onClientSide && asset instanceof ImageAsset) {
                    onClientSide = ((ImageAsset) asset).isLocalSrc();
                }
               
                PackageResources.Asset prAsset =
                    new PackageResources.Asset(plain, onClientSide);

                pr.addAssetURLMapping(encoded, prAsset);

                rewritten = new MarinerURL(encoded);
            } else {
                throw new NullPointerException(
                    "PackageResources must be set in the application " +
View Full Code Here

Examples of com.volantis.mcs.runtime.packagers.PackageResources

        // device policy and that assets that are thought to already be
        // cached on the device should not be resent
        MarinerRequestContext requestContext = context.getRequestContext();
        ApplicationContext ac =
            ContextInternals.getApplicationContext(requestContext);
        PackageResources pr = ac.getPackageResources();
        List encodedURLs = pr.getEncodedURLs();
        Map assetURLMap = pr.getAssetURLMap();
        Iterator iterator;
        String encodedURL;
        PackageResources.Asset asset;
        String assetURL = null;
        BodyPart assetPart;
View Full Code Here

Examples of com.volantis.mcs.runtime.packagers.PackageResources

                                 MarinerPageContext context)
        throws PackagingException {
        MarinerRequestContext requestContext = context.getRequestContext();
        ApplicationContext ac =
            ContextInternals.getApplicationContext(requestContext);
        PackageResources pr = ac.getPackageResources();

        // Final stage is setting up the message's content, content type,
        // ensuring that the message has only those headers required and
        // writing the message to the response output stream
        OutputStream outputStream = null;

        try {
            // Construct the outer-most message
            Message message = new MimeMessage(Session.getInstance(
                System.getProperties(), null));
            String messageContentType;

            message.setContent(pkg);
            message.saveChanges();

            // Remove all erroneous headers from the parts
            for (int i = 0;
                 i < pkg.getCount();
                 i++) {
                BodyPart part = pkg.getBodyPart(i);

                // @todo ideally identified from the device repository
                part.removeHeader("Content-Transfer-Encoding");
            }

            // Store the content type for later use
            messageContentType = message.getContentType();

            // Remove the erroneous headers from the message
            // @todo ideally identified from the device repository
            message.removeHeader("Message-ID");
            message.removeHeader("Mime-Version");
            message.removeHeader("Content-Type");

            // Before anything is written to the output stream make sure that
            // the response content type is set.
            //
            // The message content type will always be of the form:
            // 'multipart/mixed;
            //  <whitespace>boundary="<text>"'
            //
            // The first, fixed, part must be replaced by the required
            // contentType but the boundary part must be preserved.
            messageContentType = pr.getContentType() +
                messageContentType.substring(messageContentType.indexOf(';'));
            context.getEnvironmentContext().setContentType(messageContentType);

            // Now write the message to the output stream
            try {
View Full Code Here

Examples of com.volantis.mcs.runtime.packagers.PackageResources

     */
    private void createFakeAssetURLMapEntry(MarinerRequestContext context,
                                            String url) {
        // copied from ObjectElement implementation       
        ApplicationContext ac = ContextInternals.getApplicationContext(context);
        PackageResources pr = ac.getPackageResources();
        if (pr != null) {
            PackagedURLEncoder packagedURLEncoder = ac.getPackagedURLEncoder();
            if (packagedURLEncoder != null) {
                String encoded = packagedURLEncoder.getEncodedURI(url);
                PackageResources.Asset prAsset = new PackageResources.Asset(
                        url, false);
                pr.addAssetURLMapping(encoded, prAsset);
            }
        }
    } 
View Full Code Here

Examples of com.volantis.mcs.runtime.packagers.PackageResources

                                            String url) {

        // TODO: factor together with AbstractImageElement

        ApplicationContext ac = ContextInternals.getApplicationContext(context);
        PackageResources pr = ac.getPackageResources();

        if (pr != null) {
            PackagedURLEncoder packagedURLEncoder = ac.getPackagedURLEncoder();

            if (packagedURLEncoder != null) {
                String encoded = packagedURLEncoder.getEncodedURI(url);

                PackageResources.Asset prAsset = new PackageResources.Asset(
                        url, false);

                pr.addAssetURLMapping(encoded, prAsset);
            } else if (logger.isDebugEnabled()) {
                logger.debug("Package resources is not null but the packaged " +
                        "url encoder is null: " + pr);
            }
        }
View Full Code Here

Examples of com.volantis.mcs.runtime.packagers.PackageResources

     */
    private void createFakeAssetURLMapEntry(
            MarinerRequestContext context,
            String url) {
        ApplicationContext ac = ContextInternals.getApplicationContext(context);
        PackageResources pr = ac.getPackageResources();

        if (pr != null) {
            PackagedURLEncoder packagedURLEncoder = ac.getPackagedURLEncoder();

            if (packagedURLEncoder != null) {
                String encoded = packagedURLEncoder.getEncodedURI(url);

                PackageResources.Asset prAsset = new PackageResources.Asset(
                        url, false);

                pr.addAssetURLMapping(encoded, prAsset);
            } else if (logger.isDebugEnabled()) {
                logger.debug("Package resources is not null but the packaged " +
                        "url encoder is null: " + pr);
            }
        }
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.