You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by mi...@apache.org on 2010/05/03 10:23:26 UTC
svn commit: r940390 -
/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.web.fileserver/src/main/java/org/apache/clerezza/web/fileserver/util/StaticWebResource.java
Author: mir
Date: Mon May 3 08:23:26 2010
New Revision: 940390
URL: http://svn.apache.org/viewvc?rev=940390&view=rev
Log:
CLEREZZA-200: added javadocs
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.web.fileserver/src/main/java/org/apache/clerezza/web/fileserver/util/StaticWebResource.java
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.web.fileserver/src/main/java/org/apache/clerezza/web/fileserver/util/StaticWebResource.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.web.fileserver/src/main/java/org/apache/clerezza/web/fileserver/util/StaticWebResource.java?rev=940390&r1=940389&r2=940390&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.web.fileserver/src/main/java/org/apache/clerezza/web/fileserver/util/StaticWebResource.java (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.web.fileserver/src/main/java/org/apache/clerezza/web/fileserver/util/StaticWebResource.java Mon May 3 08:23:26 2010
@@ -25,7 +25,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import org.apache.clerezza.web.fileserver.BundlePathNode;
import org.apache.clerezza.web.fileserver.FileServer;
-import org.apache.felix.scr.annotations.Reference;
import org.osgi.framework.Bundle;
import org.osgi.service.component.ComponentContext;
import org.wymiwyg.commons.util.dirbrowser.FilePathNode;
@@ -41,16 +40,34 @@ public class StaticWebResource {
private FileServer fileServer;
+ /**
+ * Sets up the 'staticweb' folder in the bundle associated to the specified
+ * scr component context.
+ *
+ * @param context The scr component context of the bundle containing the
+ * 'staticweb' path.
+ */
protected void setupStaticWeb(ComponentContext context) {
setupStaticWeb(context, "staticweb", false);
}
+ /**
+ * Sets up a path in a bundle or file system to be exposed over a
+ * <code>org.apache.clerezza.web.fileserver.FileServer</code>. You can
+ * specify over the 'local' parameter if the specified path is within a
+ * bundle (false) or file system (true). *
+ *
+ * @param context The scr component context of the bundle containing the path.
+ * Only needed if 'local' is false.
+ * @param path the path where the file are to be exposed
+ * @param local specifies if the path is within a bundle or the file system.
+ */
protected void setupStaticWeb(ComponentContext context, String path, boolean local) {
- Bundle bundle = context.getBundleContext().getBundle();
PathNode pathNode;
if (local) {
pathNode = new FilePathNode(path);
} else {
+ Bundle bundle = context.getBundleContext().getBundle();
URL resourceDir = getClass().getResource(path);
pathNode = new BundlePathNode(bundle, resourceDir.getPath());
}