|
|
Choosing A Webhost: |
svn commit: r387549 - /lenya/branches/BRANCH_1_2_X/src/java/org/apache/leny: msg#00186cms.lenya.cvs
Author: josias Date: Tue Mar 21 07:34:57 2006 New Revision: 387549 URL: http://svn.apache.org/viewcvs?rev=387549&view=rev Log: more code simplification Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java?rev=387549&r1=387548&r2=387549&view=diff ============================================================================== --- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java (original) +++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java Tue Mar 21 07:34:57 2006 @@ -125,11 +125,11 @@ return Pattern.compile( "href\\s*=\\s*\"" + pageEnvelope.getContext() - + "/" + + "(/" + pageEnvelope.getPublication().getId() + "/" + pageEnvelope.getDocument().getArea() - + "(/[-a-zA-Z0-9_/]+?)(_[a-z][a-z])?\\.html"); + + "(/[-a-zA-Z0-9_/]+?)(_[a-z][a-z])?\\.html)"); } /** @@ -222,59 +222,28 @@ pageEnvelope.getDocument().getFile(), internalLinkPattern, 1); - String[] internalLinksLanguages = - Grep.findPattern( - pageEnvelope.getDocument().getFile(), - internalLinkPattern, - 2); for (int i = 0; i < internalLinks.length; i++) { - String docId = internalLinks[i]; - String language = null; - - log.debug("docId: " + docId); - if (internalLinksLanguages[i] != null) { - // trim the leading '_' - language = internalLinksLanguages[i].substring(1); + Document document = builder.buildDocument(publication, internalLinks[i]); + + String docId = document.getId(); + String language = document.getLanguage(); + + if (log.isDebugEnabled()) { + log.debug("docId: " + docId); + log.debug("language: " + language); } - log.debug("language: " + language); SiteTreeNode documentNode = sitetree.getNode(docId); - if (language == null) { - String url = - "/" - + publication.getId() - + "/" - + pageEnvelope.getDocument().getArea() - + docId - + ".html"; - language = - builder.buildDocument(publication, url).getLanguage(); - } - log.debug("language: " + language); if (documentNode == null || documentNode.getLabel(language) == null) { // the docId has not been published for the given language - String url = null; - if (language != null) { - url = - builder.buildCanonicalUrl( - publication, - Publication.AUTHORING_AREA, - docId, - language); - log.debug("url: " + url); - } else { - url = - builder.buildCanonicalUrl( - publication, - Publication.AUTHORING_AREA, - docId); - log.debug("url: " + url); + if (log.isDebugEnabled()) { + log.debug("url: " + internalLinks[i]); } unpublishedReferences.add( - builder.buildDocument(publication, url)); + builder.buildDocument(publication, internalLinks[i])); } } } catch (SiteTreeException e) {
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | svn commit: r387544 - /lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java, josias |
|---|---|
| Next by Date: | svn commit: r387564 - /lenya/trunk/src/modules/xhtml/sitemap.xmap, thorsten |
| Previous by Thread: | svn commit: r387544 - /lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java, josias |
| Next by Thread: | svn commit: r387564 - /lenya/trunk/src/modules/xhtml/sitemap.xmap, thorsten |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |