Package org.apache.lenya.cms.linking

Examples of org.apache.lenya.cms.linking.LinkResolver


        String queryString = null;
        if (uriAndQuery.length > 1) {
            queryString = uriAndQuery[1];
        }

        LinkResolver resolver = null;
        try {
            if (this.sourceResolver == null) {
                this.sourceResolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            }

            resolver = (LinkResolver) this.manager.lookup(LinkResolver.ROLE);
            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
            String webappUrl = ServletHelper.getWebappURI(request);
            LinkTarget target;
            if (factory.isDocument(webappUrl)) {
                Document currentDoc = factory.getFromURL(webappUrl);
                target = resolver.resolve(currentDoc, linkUri);
            }
            else {
                Link link = new Link(linkUri);
                contextualize(link, webappUrl);
                target = resolver.resolve(factory, link.getUri());
            }
           
            if (!target.exists()) {
                throw new SourceNotFoundException("Source not found: [" + location + "]");
            }
View Full Code Here


    protected void reportBrokenLinks() throws Exception {
        List brokenLinks = new ArrayList();
        Publication pub = getPublication();
        String[] areaNames = pub.getAreaNames();
        LinkManager linkManager = null;
        LinkResolver linkResolver = null;
        try {
            linkManager = (LinkManager) this.manager.lookup(LinkManager.ROLE);
            linkResolver = (LinkResolver) this.manager.lookup(LinkResolver.ROLE);
            for (int a = 0; a < areaNames.length; a++) {
                Area area = pub.getArea(areaNames[a]);
                Document[] docs = area.getDocuments();
                for (int d = 0; d < docs.length; d++) {
                    Link[] links = linkManager.getLinksFrom(docs[d]);
                    for (int l = 0; l < links.length; l++) {
                        String uri = links[l].getUri();
                        LinkTarget target = linkResolver.resolve(docs[d], uri);
                        if (!target.exists()) {
                            BrokenLink brokenLink = new BrokenLink(docs[d].getCanonicalWebappURL(), uri);
                            brokenLinks.add(brokenLink);
                        }
                    }
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.linking.LinkResolver

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.