cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject [07/11] git commit: Add JavaDoc for CordovaResourceApi
Date Tue, 06 May 2014 20:59:17 GMT
Add JavaDoc for CordovaResourceApi


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/7e98ec98
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/7e98ec98
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/7e98ec98

Branch: refs/heads/master
Commit: 7e98ec98ecd7362da2909bf8bae63a32e1a1666e
Parents: ca48cf5
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Apr 17 15:47:10 2014 -0400
Committer: Archana Naik <naika@lab126.com>
Committed: Tue May 6 13:58:47 2014 -0700

----------------------------------------------------------------------
 .../org/apache/cordova/CordovaResourceApi.java  | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/7e98ec98/framework/src/org/apache/cordova/CordovaResourceApi.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaResourceApi.java b/framework/src/org/apache/cordova/CordovaResourceApi.java
index ca4c965..f1770fd 100644
--- a/framework/src/org/apache/cordova/CordovaResourceApi.java
+++ b/framework/src/org/apache/cordova/CordovaResourceApi.java
@@ -45,6 +45,27 @@ import java.net.URL;
 import java.nio.channels.FileChannel;
 import java.util.Locale;
 
+/**
+ * What this class provides:
+ * 1. Helpers for reading & writing to URLs.
+ *   - E.g. handles assets, resources, content providers, files, data URIs, http[s]
+ *   - E.g. Can be used to query for mime-type & content length.
+ *
+ * 2. To allow plugins to redirect URLs (via remapUrl).
+ *   - All plugins should call remapUrl() on URLs they receive from JS *before*
+ *     passing the URL onto other utility functions in this class.
+ *   - For an example usage of this, refer to the org.apache.cordova.file plugin.
+ *
+ * 3. It exposes a way to use the OkHttp library that ships with Cordova.
+ *   - Through createHttpConnection().
+ *
+ * Future Work:
+ *   - Consider using a Cursor to query content URLs for their size (like the file plugin
does).
+ *   - Allow plugins to remapUri to "cdv-plugin://plugin-name/$ID", which CordovaResourceApi
+ *     would then delegate to pluginManager.getPlugin(plugin-name).openForRead($ID)
+ *     - Currently, plugins *can* do this by remapping to a data: URL, but it's inefficient
+ *       for large payloads.
+ */
 public class CordovaResourceApi {
     @SuppressWarnings("unused")
     private static final String LOG_TAG = "CordovaResourceApi";


Mime
View raw message