mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-05-31 00:00:07 +08:00
renamed classes and files
This commit is contained in:
+11
-11
@@ -16,23 +16,23 @@
|
||||
|
||||
<dependency id="org.apache.cordova.file" commit="r0.2.5" />
|
||||
|
||||
<js-module src="www/cordovaHTTP.js" name="CordovaHTTPPlugin">
|
||||
<clobbers target="plugins.cordovaHTTP" />
|
||||
<js-module src="www/CordovaHTTP.js" name="CordovaHttpPlugin">
|
||||
<clobbers target="plugins.CordovaHttpPlugin" />
|
||||
</js-module>
|
||||
|
||||
<!-- ios -->
|
||||
<platform name="ios">
|
||||
<config-file target="config.xml" parent="/*">
|
||||
<feature name="CordovaHTTP">
|
||||
<param name="ios-package" value="CordovaHTTP"/>
|
||||
<feature name="CordovaHttpPlugin">
|
||||
<param name="ios-package" value="CordovaHttpPlugin"/>
|
||||
</feature>
|
||||
</config-file>
|
||||
|
||||
<header-file src="src/ios/CordovaHttpPlugin.h" />
|
||||
<source-file src="src/ios/CordovaHttpPlugin.m" />
|
||||
|
||||
<header-file src="src/ios/HTTPManager.h" />
|
||||
<source-file src="src/ios/HTTPManager.m" />
|
||||
<header-file src="src/ios/HttpManager.h" />
|
||||
<source-file src="src/ios/HttpManager.m" />
|
||||
|
||||
<header-file src="src/ios/TextResponseSerializer.h" />
|
||||
<source-file src="src/ios/TextResponseSerializer.m" />
|
||||
@@ -72,14 +72,14 @@
|
||||
<!--android -->
|
||||
<platform name="android">
|
||||
<config-file target="res/xml/config.xml" parent="/*">
|
||||
<feature name="CordovaHTTP">
|
||||
<param name="android-package" value="com.synconset.CordovaHTTP"/>
|
||||
<feature name="CordovaHttpPlugin">
|
||||
<param name="android-package" value="com.synconset.CordovaHttpPlugin"/>
|
||||
</feature>
|
||||
</config-file>
|
||||
|
||||
<source-file src="src/Android/com/synconset/CordovaHTTP/HTTP.java" target-dir="src/com/synconset" />
|
||||
<source-file src="src/Android/com/synconset/CordovaHTTP/HTTPGet.java" target-dir="src/com/synconset" />
|
||||
<source-file src="src/Android/com/synconset/CordovaHTTP/HTTPPost.java" target-dir="src/com/synconset" />
|
||||
<source-file src="src/Android/com/synconset/CordovaHTTP/CordovaHttp.java" target-dir="src/com/synconset" />
|
||||
<source-file src="src/Android/com/synconset/CordovaHTTP/CordovaHttpGet.java" target-dir="src/com/synconset" />
|
||||
<source-file src="src/Android/com/synconset/CordovaHTTP/CordovaHttpPost.java" target-dir="src/com/synconset" />
|
||||
<source-file src="src/Android/com/synconset/CordovaHTTP/CordovaHttpPlugin.java" target-dir="src/com/synconset" />
|
||||
<source-file src="src/Android/com/synconset/CordovaHTTP/VeryTrustingTrustManager.java" target-dir="src/com/synconset" />
|
||||
<source-file src="src/Android/com/synconset/CordovaHTTP/VeryTrustingHostnameVerifier.java" target-dir="src/com/synconset" />
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ import java.util.Iterator;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class HTTP {
|
||||
public class CordovaHttp {
|
||||
protected static final String TAG = "CordovaHTTP";
|
||||
|
||||
protected String charset = "UTF-8";
|
||||
@@ -37,7 +37,7 @@ public class HTTP {
|
||||
private HostnameVerifier hostnameVerifier;
|
||||
private CallbackContext callbackContext;
|
||||
|
||||
public HTTP(String urlString, JSONObject params, JSONObject headers, SSLContext sslContext, HostnameVerifier hostnameVerifier, CallbackContext callbackContext) {
|
||||
public CordovaHttp(String urlString, JSONObject params, JSONObject headers, SSLContext sslContext, HostnameVerifier hostnameVerifier, CallbackContext callbackContext) {
|
||||
this.urlString = urlString;
|
||||
this.params = params;
|
||||
this.headers = headers;
|
||||
+2
-2
@@ -18,8 +18,8 @@ import org.json.JSONObject;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class HTTPGet extends HTTP implements Runnable {
|
||||
public HTTPGet(String urlString, JSONObject params, JSONObject headers, SSLContext sslContext, HostnameVerifier hostnameVerifier, CallbackContext callbackContext) {
|
||||
public class CordovaHttpGet extends CordovaHttp implements Runnable {
|
||||
public CordovaHttpGet(String urlString, JSONObject params, JSONObject headers, SSLContext sslContext, HostnameVerifier hostnameVerifier, CallbackContext callbackContext) {
|
||||
super(urlString, params, headers, sslContext, hostnameVerifier, callbackContext);
|
||||
}
|
||||
|
||||
@@ -56,14 +56,14 @@ public class CordovaHttpPlugin extends CordovaPlugin {
|
||||
JSONObject params = args.getJSONObject(1);
|
||||
JSONObject headers = args.getJSONObject(2);
|
||||
this.addToJSONObject(headers, this.globalHeaders);
|
||||
HTTPGet get = new HTTPGet(urlString, params, headers, this.sslContext, this.hostnameVerifier, callbackContext);
|
||||
CordovaHttpGet get = new CordovaHttpGet(urlString, params, headers, this.sslContext, this.hostnameVerifier, callbackContext);
|
||||
cordova.getThreadPool().execute(get);
|
||||
} else if (action.equals("post")) {
|
||||
String urlString = args.getString(0);
|
||||
JSONObject params = args.getJSONObject(1);
|
||||
JSONObject headers = args.getJSONObject(2);
|
||||
this.addToJSONObject(headers, this.globalHeaders);
|
||||
HTTPPost post = new HTTPPost(urlString, params, headers, this.sslContext, this.hostnameVerifier, callbackContext);
|
||||
CordovaHttpPost post = new CordovaHttpPost(urlString, params, headers, this.sslContext, this.hostnameVerifier, callbackContext);
|
||||
cordova.getThreadPool().execute(post);
|
||||
} else if (action.equals("setAuthorizationHeaderWithUsernameAndPassword")) {
|
||||
String username = args.getString(0);
|
||||
|
||||
+2
-2
@@ -21,8 +21,8 @@ import org.json.JSONObject;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class HTTPPost extends HTTP implements Runnable {
|
||||
public HTTPPost(String urlString, JSONObject params, JSONObject headers, SSLContext sslContext, HostnameVerifier hostnameVerifier, CallbackContext callbackContext) {
|
||||
public class CordovaHttpPost extends CordovaHttp implements Runnable {
|
||||
public CordovaHttpPost(String urlString, JSONObject params, JSONObject headers, SSLContext sslContext, HostnameVerifier hostnameVerifier, CallbackContext callbackContext) {
|
||||
super(urlString, params, headers, sslContext, hostnameVerifier, callbackContext);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
NSString *url = [command.arguments objectAtIndex:0];
|
||||
NSDictionary *parameters = [command.arguments objectAtIndex:1];
|
||||
|
||||
CordovaHTTP* __weak weakSelf = self;
|
||||
CordovaHttpPlugin* __weak weakSelf = self;
|
||||
|
||||
[manager POST:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
||||
@@ -100,7 +100,7 @@
|
||||
NSString *url = [command.arguments objectAtIndex:0];
|
||||
NSDictionary *parameters = [command.arguments objectAtIndex:1];
|
||||
|
||||
CordovaHTTP* __weak weakSelf = self;
|
||||
CordovaHttpPlugin* __weak weakSelf = self;
|
||||
|
||||
[manager GET:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
||||
@@ -126,7 +126,7 @@
|
||||
|
||||
NSURL *fileURL = [NSURL fileURLWithPath: filePath];
|
||||
|
||||
CordovaHTTP* __weak weakSelf = self;
|
||||
CordovaHttpPlugin* __weak weakSelf = self;
|
||||
[manager POST:url parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
|
||||
NSError *error;
|
||||
[formData appendPartWithFileURL:fileURL name:name error:&error];
|
||||
@@ -159,7 +159,7 @@
|
||||
NSDictionary *parameters = [command.arguments objectAtIndex:1];
|
||||
NSString *filePath = [command.arguments objectAtIndex: 2];
|
||||
|
||||
CordovaHTTP* __weak weakSelf = self;
|
||||
CordovaHttpPlugin* __weak weakSelf = self;
|
||||
[manager GET:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
|
||||
/*
|
||||
*
|
||||
@@ -23,10 +23,10 @@
|
||||
@implementation HttpManager
|
||||
|
||||
+ (instancetype)sharedClient {
|
||||
static HTTPManager *_sharedClient = nil;
|
||||
static HttpManager *_sharedClient = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
_sharedClient = [HTTPManager manager];
|
||||
_sharedClient = [HttpManager manager];
|
||||
});
|
||||
|
||||
return _sharedClient;
|
||||
|
||||
Vendored
+12
-12
@@ -8,37 +8,37 @@ var exec = require('cordova/exec');
|
||||
|
||||
var http = {
|
||||
setAuthorizationHeaderWithUsernameAndPassword: function(username, password, success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "setAuthorizationHeaderWithUsernameAndPassword", [username, password]);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "setAuthorizationHeaderWithUsernameAndPassword", [username, password]);
|
||||
},
|
||||
setHeader: function(header, value, success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "setHeader", [header, value]);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "setHeader", [header, value]);
|
||||
},
|
||||
enableSSLPinning: function(success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "enableSSLPinning", []);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "enableSSLPinning", []);
|
||||
},
|
||||
validateEntireCertificateChain: function(validateChain, success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "validateEntireCertificateChain", [validateChain]);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "validateEntireCertificateChain", [validateChain]);
|
||||
},
|
||||
allowInvalidCertificates: function(allow, success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "allowInvalidCertificates", [allow]);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "allowInvalidCertificates", [allow]);
|
||||
},
|
||||
acceptText: function(success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "acceptText", []);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "acceptText", []);
|
||||
},
|
||||
acceptData: function(success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "acceptData", []);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "acceptData", []);
|
||||
},
|
||||
setAcceptableContentTypes: function(contentTypes, success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "setAcceptableContentTypes", contentTypes);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "setAcceptableContentTypes", contentTypes);
|
||||
},
|
||||
post: function(url, params, headers, success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "post", [url, params, headers]);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "post", [url, params, headers]);
|
||||
},
|
||||
get: function(url, params, success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "get", [url, params]);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "get", [url, params]);
|
||||
},
|
||||
uploadFile: function(url, params, filePath, name, success, failure) {
|
||||
return exec(success, failure, "CordovaHTTP", "uploadFile", [url, params, filePath, name]);
|
||||
return exec(success, failure, "CordovaHttpPlugin", "uploadFile", [url, params, filePath, name]);
|
||||
},
|
||||
downloadFile: function(url, params, filePath, success, failure) {
|
||||
/*
|
||||
@@ -71,7 +71,7 @@ var http = {
|
||||
entry.fullPath = result.file.fullPath;
|
||||
success(entry);
|
||||
};
|
||||
return exec(win, failure, "CordovaHTTP", "downloadFile", [url, params, filePath]);
|
||||
return exec(win, failure, "CordovaHttpPlugin", "downloadFile", [url, params, filePath]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user