You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/02/13 01:29:16 UTC
svn commit: r627200 -
/lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java
Author: andreas
Date: Tue Feb 12 16:29:15 2008
New Revision: 627200
URL: http://svn.apache.org/viewvc?rev=627200&view=rev
Log:
PageEnvelope: use DocumentBuilder to extract path if necessary.
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java
Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java?rev=627200&r1=627199&r2=627200&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java Tue Feb 12 16:29:15 2008
@@ -264,14 +264,25 @@
public String getContext() {
return this.context;
}
+
+ private String path;
/**
- * Returns the document-path.
- * @return a <code>File<code> value
+ * Returns the document path. If the current URL doesn't point to a document, the document
+ * builder is used to extract the supposed path from the URL.
+ * @return A string.
*/
public String getDocumentPath() {
- return getPublication().getPathMapper().getPath(getDocument().getUUID(),
- getDocument().getLanguage());
+ if (this.path == null) {
+ final Document doc = getDocument();
+ try {
+ this.path = doc != null ? doc.getPath() :
+ getPublication().getDocumentBuilder().getLocator(this.factory, this.webappUrl).getPath();
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return this.path;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org