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 2003/08/12 17:15:55 UTC
cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/ac2/cache CachedPolicy.java URLKeyUtil.java
andreas 2003/08/12 08:15:55
Modified: src/java/org/apache/lenya/cms/ac2/file
PublicationFilePolicyManager.java
FilePolicyManager.java
Added: src/java/org/apache/lenya/cms/ac2/cache CachedPolicy.java
URLKeyUtil.java
Log:
- improved policy caching
- using document-id for policy resolving
Revision Changes Path
1.3 +102 -22 cocoon-lenya/src/java/org/apache/lenya/cms/ac2/file/PublicationFilePolicyManager.java
Index: PublicationFilePolicyManager.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac2/file/PublicationFilePolicyManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PublicationFilePolicyManager.java 17 Jul 2003 16:24:20 -0000 1.2
+++ PublicationFilePolicyManager.java 12 Aug 2003 15:15:54 -0000 1.3
@@ -56,9 +56,19 @@
package org.apache.lenya.cms.ac2.file;
import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.lenya.cms.ac.AccessControlException;
+import org.apache.lenya.cms.ac2.AccreditableManager;
+import org.apache.lenya.cms.ac2.DefaultPolicy;
+import org.apache.lenya.cms.ac2.Policy;
+import org.apache.lenya.cms.publication.DefaultDocumentBuilder;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentBuildException;
import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationException;
+import org.apache.lenya.cms.publication.PublicationFactory;
/**
* A FilePolicyManager that resolves policies relative to the {publication}/config/ac/policies directory.<br/>
@@ -73,35 +83,105 @@
"config/ac/policies".replace('/', File.separatorChar);
/**
- * @see org.apache.lenya.cms.ac2.file.FilePolicyManager#getPolicyFile(java.lang.String, java.lang.String)
+ * @see org.apache.lenya.cms.ac2.file.FilePolicyManager#getPolicyURI(java.lang.String, java.lang.String)
*/
- protected File getPolicyFile(String url, String policyFilename) throws AccessControlException {
+ protected String getPolicyURI(String url, String policyFilename)
+ throws AccessControlException {
+
+ getLogger().debug("Resolving policy URI for URL [" + url + "]");
+
+ Publication publication = getPublication(url);
+ url = url.substring(("/" + publication.getId()).length());
- getLogger().debug("Resolving policy file for URL [" + url + "]");
+ String path = url.replace('/', File.separatorChar) + File.separator + policyFilename;
+ File policyDirectory = new File(publication.getDirectory(), POLICIES_PATH);
+ File policyFile = new File(policyDirectory, path);
+ return policyFile.toURI().toString();
+ }
- if (url.startsWith("/")) {
- url = url.substring(1);
- }
+ /**
+ * @see org.apache.lenya.cms.ac2.InheritingPolicyManager#getPolicies(org.apache.lenya.cms.ac2.AccreditableManager, java.lang.String)
+ */
+ public DefaultPolicy[] getPolicies(AccreditableManager controller, String url)
+ throws AccessControlException {
- int slashIndex = url.indexOf("/");
- if (slashIndex == -1) {
- slashIndex = url.length();
- }
+ getLogger().debug("Resolving policies for URL [" + url + "]");
+
+ Publication publication = getPublication(url);
+ String path = getPolicyPath(url, publication);
+
+ List policies = new ArrayList();
- String publicationId = url.substring(0, slashIndex);
- url = url.substring(publicationId.length());
+ String[] directories = path.split("/");
+ path = "/" + publication.getId();
+
+ getLogger().debug("Building URL policy for URL [" + path + "]");
+ Policy policy = buildURLPolicy(controller, path);
+ policies.add(policy);
+
+ for (int i = 0; i < directories.length; i++) {
+ path += directories[i] + "/";
+ getLogger().debug("Building subtree policy for URL [" + path + "]");
+ policy = buildSubtreePolicy(controller, path);
+ policies.add(policy);
+ }
- getLogger().debug("URL without publication ID: [" + url + "]");
+ return (DefaultPolicy[]) policies.toArray(new DefaultPolicy[policies.size()]);
+ }
- String path = url.replace('/', File.separatorChar) + File.separator + policyFilename;
+ /**
+ * Returns the publication for a certain URL.
+ * @param url The url.
+ * @return A publication.
+ * @throws AccessControlException when the publication could not be created.
+ */
+ protected Publication getPublication(String url) throws AccessControlException {
+ getLogger().debug("Building publication");
- File publicationDirectory =
- new File(
- getPoliciesDirectory(),
- Publication.PUBLICATION_PREFIX + File.separator + publicationId);
- File policiesConfigDirectory = new File(publicationDirectory, POLICIES_PATH);
- File policyFile = new File(policiesConfigDirectory, path);
- return policyFile;
+ Publication publication;
+ try {
+ File servletContext = getPoliciesDirectory();
+ getLogger().debug("Webapp URL: [" + url + "]");
+ getLogger().debug("Serlvet context: [" + servletContext.getAbsolutePath() + "]");
+ publication = PublicationFactory.getPublication(url, servletContext);
+ } catch (PublicationException e) {
+ throw new AccessControlException(e);
+ }
+ return publication;
+ }
+
+ /**
+ * Returns the policy path, containing the steps to look for policy files
+ * separated by slashes. If the webapp URL corresponds to an existing document,
+ * the document ID is used. Otherwise, the requested URL inside the publication
+ * is returned.
+ * @param webappUrl The webapp URL to obtain the policy for.
+ * @param publication The publication.
+ * @return A String.
+ * @throws AccessControlException when something went wrong.
+ */
+ protected String getPolicyPath(String webappUrl, Publication publication)
+ throws AccessControlException {
+
+ getLogger().debug("Resolving policy path for URL [" + webappUrl + "]");
+
+ Document document = null;
+ String path;
+
+ try {
+ document = DefaultDocumentBuilder.getInstance().buildDocument(publication, webappUrl);
+ } catch (DocumentBuildException e) {
+ throw new AccessControlException(e);
+ }
+
+ if (document.getFile().exists()) {
+ path = "/" + document.getArea() + document.getId();
+ getLogger().debug("Document exists, using document ID [" + path + "]");
+ } else {
+ path = webappUrl.substring(("/" + publication.getId()).length());
+ getLogger().debug("Document does not exist, using URL [" + path + "]");
+ }
+ return path;
}
}
1.14 +200 -24 cocoon-lenya/src/java/org/apache/lenya/cms/ac2/file/FilePolicyManager.java
Index: FilePolicyManager.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac2/file/FilePolicyManager.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- FilePolicyManager.java 7 Aug 2003 10:23:02 -0000 1.13
+++ FilePolicyManager.java 12 Aug 2003 15:15:54 -0000 1.14
@@ -55,6 +55,7 @@
*/
package org.apache.lenya.cms.ac2.file;
+import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.parameters.ParameterException;
import org.apache.avalon.framework.parameters.Parameterizable;
@@ -63,7 +64,9 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceNotFoundException;
import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.source.SourceValidity;
import org.apache.lenya.cms.ac.AccessControlException;
import org.apache.lenya.cms.ac2.AccreditableManager;
import org.apache.lenya.cms.ac2.DefaultPolicy;
@@ -71,6 +74,7 @@
import org.apache.lenya.cms.ac2.Policy;
import org.apache.lenya.cms.ac2.PolicyBuilder;
import org.apache.lenya.cms.ac2.URLPolicy;
+import org.apache.lenya.cms.ac2.cache.CachedPolicy;
import org.apache.lenya.util.CacheMap;
import org.apache.lenya.xml.DocumentHelper;
@@ -78,10 +82,11 @@
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
/**
* A PolicyBuilder is used to build policies.
@@ -89,7 +94,23 @@
*/
public class FilePolicyManager
extends AbstractLogEnabled
- implements InheritingPolicyManager, Parameterizable, Serviceable {
+ implements InheritingPolicyManager, Parameterizable, Serviceable, Disposable {
+
+ /**
+ * Returns the source cache.
+ * @return A source cache.
+ */
+ protected CacheMap getCache() {
+ return cache;
+ }
+
+ /**
+ * Returns the source resolver.
+ * @return A source resolver.
+ */
+ protected SourceResolver getResolver() {
+ return resolver;
+ }
/**
* Creates a new PolicyBuilder.
@@ -98,6 +119,10 @@
}
private File policyDirectory;
+ private SourceResolver resolver;
+ private CacheMap cache = new CacheMap(CAPACITY);
+
+ protected static final int CAPACITY = 1000;
protected static final String URL_FILENAME = "url-policy.acml";
protected static final String SUBTREE_FILENAME = "subtree-policy.acml";
@@ -140,22 +165,151 @@
String url,
String policyFilename)
throws AccessControlException {
- DefaultPolicy policy;
+
getLogger().debug("Building policy for URL [" + url + "]");
- File policyFile = getPolicyFile(url, policyFilename);
- getLogger().debug("Policy file resolved to: " + policyFile.getAbsolutePath());
- // getLogger().debug("", new IllegalStateException());
- if (policyFile.exists()) {
- policy = PolicyBuilder.getInstance().buildPolicy(controller, policyFile);
+ DefaultPolicy policy = null;
+
+ String policyUri = getPolicyURI(url, policyFilename);
+ getLogger().debug("Policy source URI resolved to: " + policyUri);
+
+ try {
+ String key = policyUri;
+
+ CachedPolicy cachedPolicy = (CachedPolicy) getCache().get(key);
+ boolean usedCache = false;
+ SourceValidity sourceValidity = null;
+ InputStream stream = null;
+
+ if (cachedPolicy != null) {
+ getLogger().debug("Found cached policy.");
+ SourceValidity cachedValidity = cachedPolicy.getValidityObject();
+
+ int result = cachedValidity.isValid();
+ boolean valid = false;
+ if (result == 0) {
+
+ // get source validity and compare
+
+ sourceValidity = getSourceValidity(policyUri);
+
+ if (sourceValidity != null) {
+ result = cachedValidity.isValid(sourceValidity);
+ if (result == 0) {
+ sourceValidity = null;
+ } else {
+ valid = (result == 1);
+ }
+ }
+ } else {
+ valid = (result > 0);
+ }
+
+ if (valid) {
+ if (this.getLogger().isDebugEnabled()) {
+ this.getLogger().debug(
+ "Using valid cached source for '" + policyUri + "'.");
+ }
+ usedCache = true;
+ policy = cachedPolicy.getPolicy();
+ } else {
+ if (this.getLogger().isDebugEnabled()) {
+ this.getLogger().debug(
+ "Cached content is invalid for '" + policyUri + "'.");
+ }
+ // remove invalid cached object
+ getCache().remove(key);
+ }
+
+ } else {
+ getLogger().debug("Did not find cached policy.");
+ }
+
+ if (!usedCache) {
+ getLogger().debug("Did not use cache.");
+ if (key != null) {
+ if (sourceValidity == null) {
+ sourceValidity = getSourceValidity(policyUri);
+ }
+ if (sourceValidity != null) {
+ getLogger().debug("Source validity is not null.");
+ } else {
+ getLogger().debug("Source validity is null - not caching.");
+ key = null;
+ }
+ }
+
+ stream = getInputStream(policyUri);
+ if (stream != null) {
+ policy = PolicyBuilder.getInstance().buildPolicy(controller, stream);
+ }
+
+ // store the response
+ if (key != null) {
+ if (this.getLogger().isDebugEnabled()) {
+ this.getLogger().debug(
+ "Caching content for further requests of '" + policyUri + "'.");
+ }
+ getCache().put(key, new CachedPolicy(sourceValidity, policy));
+ }
+ }
+ } catch (Exception e) {
+ throw new AccessControlException(e);
+ }
+
+ if (policy != null) {
+ getLogger().debug("Policy found.");
} else {
+ getLogger().debug("Using empty Policy.");
policy = new DefaultPolicy();
}
-
return policy;
}
/**
+ * Returns the input stream to read a policy from.
+ * @param policyUri The URI of the policy source.
+ * @return An input stream.
+ * @throws MalformedURLException when an error occurs.
+ * @throws IOException when an error occurs.
+ * @throws SourceNotFoundException when an error occurs.
+ */
+ protected InputStream getInputStream(String policyUri)
+ throws MalformedURLException, IOException, SourceNotFoundException {
+ InputStream stream = null;
+ Source source = null;
+ try {
+ source = getResolver().resolveURI(policyUri);
+ if (source.exists()) {
+ stream = source.getInputStream();
+ }
+ } finally {
+ getResolver().release(source);
+ }
+ return stream;
+ }
+
+ /**
+ * Returns the validity of a policy source.
+ * @param policyUri The URI of the policy source.
+ * @return A source validity object.
+ * @throws MalformedURLException when an error occurs.
+ * @throws IOException when an error occurs.
+ */
+ protected SourceValidity getSourceValidity(String policyUri)
+ throws MalformedURLException, IOException {
+ SourceValidity sourceValidity;
+ Source source = null;
+ try {
+ source = getResolver().resolveURI(policyUri);
+ sourceValidity = source.getValidity();
+ } finally {
+ getResolver().release(source);
+ }
+ return sourceValidity;
+ }
+
+ /**
* Returns the policy file for a URL and a policy filename.
* @param url The url to get the file for.
* @param policyFilename The name of the policy file.
@@ -163,15 +317,33 @@
*
* @throws AccessControlException if an error occurs
*/
- protected File getPolicyFile(String url, String policyFilename) throws AccessControlException {
+ protected String getPolicyURI(String url, String policyFilename)
+ throws AccessControlException {
if (url.startsWith("/")) {
url = url.substring(1);
}
String path = url.replace('/', File.separatorChar) + File.separator + policyFilename;
File policyFile = new File(getPoliciesDirectory(), path);
+ return policyFile.toURI().toString();
+ }
- return policyFile;
+ /**
+ * Returns the policy file for a certain URL.
+ * @param url The URL to get the policy for.
+ * @param policyFilename The policy filename.
+ * @return A file.
+ * @throws AccessControlException when an error occurs.
+ */
+ protected File getPolicyFile(String url, String policyFilename) throws AccessControlException {
+ String fileUri = getPolicyURI(url, policyFilename);
+ File file;
+ try {
+ file = new File(new URI(fileUri));
+ } catch (Exception e) {
+ throw new AccessControlException(e);
+ }
+ return file;
}
/**
@@ -205,7 +377,7 @@
*/
protected void savePolicy(String url, DefaultPolicy policy, String filename)
throws AccessControlException {
-
+
String key = getCacheKey(url);
cache.remove(key);
@@ -221,23 +393,13 @@
}
}
- protected static final int CACHE_CAPACITY = 1000;
- private static Map cache = new CacheMap(CACHE_CAPACITY);
-
/**
* @see org.apache.lenya.cms.ac2.PolicyManager#getPolicy(AccreditableManager, Publication, java.lang.String)
*/
public Policy getPolicy(AccreditableManager controller, String url)
throws AccessControlException {
- String key = getCacheKey(url);
- Policy policy = (Policy) cache.get(key);
- if (policy == null) {
- policy = new URLPolicy(controller, url, this);
- cache.put(key, policy);
- }
-
- return policy;
+ return new URLPolicy(controller, url, this);
}
/**
@@ -314,6 +476,7 @@
*/
public void service(ServiceManager manager) throws ServiceException {
this.manager = manager;
+ resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
}
/**
@@ -331,6 +494,7 @@
* @throws AccessControlException if the directory is not a directory
*/
public void setPoliciesDirectory(File directory) throws AccessControlException {
+ getLogger().debug("Setting policies directory [" + directory.getAbsolutePath() + "]");
if (!directory.isDirectory()) {
throw new AccessControlException(
"Policies directory invalid: [" + directory.getAbsolutePath() + "]");
@@ -359,6 +523,18 @@
}
return (DefaultPolicy[]) policies.toArray(new DefaultPolicy[policies.size()]);
+ }
+
+ /**
+ * @see org.apache.avalon.framework.activity.Disposable#dispose()
+ */
+ public void dispose() {
+ if (getResolver() != null) {
+ getManager().release(getResolver());
+ }
+ if (getCache() != null) {
+ getManager().release(getCache());
+ }
}
}
1.1 cocoon-lenya/src/java/org/apache/lenya/cms/ac2/cache/CachedPolicy.java
Index: CachedPolicy.java
===================================================================
/*
$Id: CachedPolicy.java,v 1.1 2003/08/12 15:15:55 andreas Exp $
<License>
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Lenya" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Michael Wechner <mi...@apache.org>. For more information on the Apache Soft-
ware Foundation, please see <http://www.apache.org/>.
Lenya includes software developed by the Apache Software Foundation, W3C,
DOM4J Project, BitfluxEditor, Xopus, and WebSHPINX.
</License>
*/
package org.apache.lenya.cms.ac2.cache;
import org.apache.excalibur.source.SourceValidity;
import org.apache.lenya.cms.ac2.DefaultPolicy;
/**
* @author andreas
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class CachedPolicy {
private SourceValidity validityObject;
private DefaultPolicy policy;
/**
* Returns the policy.
* @return A policy.
*/
public DefaultPolicy getPolicy() {
return policy;
}
/**
* Returns the source validity.
* @return A source validity.
*/
public SourceValidity getValidityObject() {
return validityObject;
}
/**
* Ctor.
* @param validity The source validity.
* @param policy The policy.
*/
public CachedPolicy(SourceValidity validity, DefaultPolicy policy) {
this.validityObject = validity;
this.policy = policy;
}
}
1.1 cocoon-lenya/src/java/org/apache/lenya/cms/ac2/cache/URLKeyUtil.java
Index: URLKeyUtil.java
===================================================================
/*
$Id: URLKeyUtil.java,v 1.1 2003/08/12 15:15:55 andreas Exp $
<License>
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Lenya" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Michael Wechner <mi...@apache.org>. For more information on the Apache Soft-
ware Foundation, please see <http://www.apache.org/>.
Lenya includes software developed by the Apache Software Foundation, W3C,
DOM4J Project, BitfluxEditor, Xopus, and WebSHPINX.
</License>
*/
package org.apache.lenya.cms.ac2.cache;
import java.io.IOException;
import java.net.MalformedURLException;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceResolver;
/**
* @author andreas
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public final class URLKeyUtil {
/**
* Ctor.
*/
private URLKeyUtil() {
}
/**
* Generates a cache key for a context and a webapp URL.
* @param resolver The resolver of the context.
* @param webappUrl The webapp Url.
* @return A String.
* @throws MalformedURLException when something went wrong.
* @throws IOException when something went wrong.
*/
public static String generateKey(SourceResolver resolver, String webappUrl)
throws MalformedURLException, IOException {
Source source = null;
String key;
try {
source = resolver.resolveURI("context:///");
key = source.getURI() + "_" + webappUrl;
}
finally {
if (source != null) {
resolver.release(source);
}
}
return key;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org