Package com.volantis.mcs.utilities

Examples of com.volantis.mcs.utilities.MarinerURL


        AssetGroup assetGroup = new AssetGroup("Default Group");
        assetGroup.setPrefixURL(assetGroupURL);
        assetGroup.setLocationType(AssetGroup.ON_SERVER);
        assetGroup.setProject(project);

        MarinerURL url = new MarinerURL(assetURL);

        doRewriterTest(asset, assetGroup, url, expected);
    }
View Full Code Here


    RuntimeProjectMock createProject(final String baseUrl) {

        final RuntimeProjectMock projectMock =
                new RuntimeProjectMock("projectMock", expectations);
        MarinerURL baseURL = new MarinerURL(baseUrl);
        baseURL.makeReadOnly();
        projectMock.expects.getAssetsBaseURL().returns(baseURL).any();
        projectMock.expects.getContainsOrphans().returns(false).any();
        projectMock.expects.getPolicySource().returns(null).any();
        projectMock.expects.isPortable().returns(false).any();
View Full Code Here

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

                DefaultAssetURLRewriter rewriter = new DefaultAssetURLRewriter();
                MarinerURL url = rewriter.rewriteAssetURL(requestContext,
                                                          asset,
                                                          assetGroup,
                                                          marinerURL);
                assertNotNull(url);
                assertEquals("ExternalForm should match; expected=" +
                        expected + ", actual=" + url.getExternalForm() + ".",
                             expected,
                             url.getExternalForm());
            }
        });
    }
View Full Code Here

        // Set up an app context so we can enable fragmentation.
        ApplicationContext appContext = new ApplicationContext(requestContext);
        ContextInternals.setApplicationContext(requestContext, appContext);
        appContext.setFragmentationSupported(true);
        // Fragmentation needs a URL and rewriter for URL manipulation.
        pageContext.setRootPageURL(new MarinerURL());
        pageContext.setVolantis(new TestableVolantis() {
            public PageURLRewriter getLayoutURLRewriter() {
                return new PageURLRewriter() {
                    public MarinerURL rewriteURL(MarinerRequestContext context,
                                                 MarinerURL url,
View Full Code Here

        // Set up an app context so we can enable fragmentation.
        ApplicationContext appContext = new ApplicationContext(requestContext);
        ContextInternals.setApplicationContext(requestContext, appContext);
        appContext.setFragmentationSupported(true);
        // Fragmentation needs a URL and rewriter for URL manipulation.
        pageContext.setRootPageURL(new MarinerURL());
        pageContext.setVolantis(new TestableVolantis() {
            public PageURLRewriter getLayoutURLRewriter() {
                return new PageURLRewriter() {
                    public MarinerURL rewriteURL(MarinerRequestContext context,
                                                 MarinerURL url,
View Full Code Here

        } else {
            characteristics.setMaxPageSize(100000);
        }
        DissectionURLManager urlManager = new MyDissectionURLManager();
        DocumentInformationImpl docInfo = new DocumentInformationImpl();
        docInfo.setDocumentURL(new MarinerURL("common1.xml"));

        Dissector dissector = new Dissector();
        DissectedDocumentImpl dissected = (DissectedDocumentImpl)
            dissector.createDissectedDocument(context, characteristics,
                                              document, urlManager, docInfo);
View Full Code Here

        DissectionContext context = new MyDissectionContext();
        DissectionCharacteristicsImpl characteristics =
                new DissectionCharacteristicsImpl();
        DissectionURLManager urlManager = new MyDissectionURLManager();
        DocumentInformationImpl information = new DocumentInformationImpl();
        information.setDocumentURL(new MarinerURL("document-url.xml"));
        System.out.println("Page Size=" + pageSize);
        characteristics.setMaxPageSize(pageSize);
        DissectedDocument dissectedDocument =
                dissector.createDissectedDocument(context, characteristics,
                dissectionDocument, urlManager, information);
View Full Code Here

                throws PackagingException {
                try {
                    bodyContent.append("<html><body><div><img src=\"").
                        append(handler.rewriteAssetURL(
                            context, imageAsset,
                            null, new MarinerURL(imageAsset.getValue())).
                               getExternalForm()).
                        append("\"/></div><div><img src=\"").
                        append(handler.rewriteAssetURL(
                            context, noImageAsset,
                            null, new MarinerURL(noImageAsset.getValue())).
                               getExternalForm()).
                        append("\"/></div></body></html>");
                    writer.getWriter().write(bodyContent.toString());
                } catch (RepositoryException e) {
                    throw new PackagingException(e);
View Full Code Here

     * @param asset the asset
     * @return the URL as a String
     */
    public String computeURLAsString(Asset asset) {

        MarinerURL url = computeURL(asset);
        String urlStr = null;
        if (url != null) {
            urlStr = url.getExternalForm();
        }
        return urlStr;
    }
View Full Code Here

        Content content = variant.getContent();
        if (content instanceof EmbeddedContent) {
            EmbeddedContent embedded = (EmbeddedContent) content;
            return embedded.getData();
        } else {
            MarinerURL marinerURL = computeURL((Asset) selected.getOldObject());

            // Then, convert it to an absolute URL
            URL url;
            try {
                url = context.getAbsoluteURL(marinerURL);
            } catch (MalformedURLException e) {
                logger.warn("asset-mariner-url-retrieval-error",
                        new Object[]{
                            policy.getName(),
                            ((marinerURL == null) ? "" :
                        marinerURL.getExternalForm())},
                        e);
                return null;
            }

            // Finally, attempt to read out the URL's contents.
View Full Code Here

TOP

Related Classes of com.volantis.mcs.utilities.MarinerURL

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.