Skip to content

Commit 7f17ce9

Browse files
author
shimingxy
committed
connectors
1 parent a952c5a commit 7f17ce9

92 files changed

Lines changed: 3368 additions & 2321 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎build.gradle‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ subprojects {
292292
compile group: 'org.apache.santuario', name: 'xmlsec', version: '1.5.8'
293293
compile group: 'org.ogce', name: 'xpp3', version: '1.1.6'
294294
compile group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.10'
295+
295296
//local jars
296297
compile fileTree(dir: "${rootDir}/maxkey-lib/", include: '*.jar')
297298
//阿里云

‎maxkey-client-sdk/.classpath‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
<attribute name="test" value="true"/>
1414
</attributes>
1515
</classpathentry>
16+
<classpathentry kind="src" output="bin/main" path="src/main/resources">
17+
<attributes>
18+
<attribute name="gradle_scope" value="main"/>
19+
<attribute name="gradle_used_by_scope" value="main,test"/>
20+
</attributes>
21+
</classpathentry>
1622
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
1723
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
1824
<classpathentry kind="output" path="bin/default"/>

‎maxkey-client-sdk/.settings/org.eclipse.wst.common.component‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<wb-module deploy-name="maxkey-client-sdk">
33
<wb-resource deploy-path="/" source-path="/src/main/java"/>
44
<wb-resource deploy-path="/" source-path="/src/test/java"/>
5+
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
56
</wb-module>
67
</project-modules>

‎maxkey-client-sdk/build.gradle‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
description = "maxkey-client-sdk"
22

3-
dependencies {
4-
compile fileTree(dir: '../maxkey-lib/log/', include: '*slf4j*.jar')
5-
compile fileTree(dir: '../maxkey-lib/log/', include: 'log4j*.jar')
6-
compile fileTree(dir: '../maxkey-lib/apache/', include: 'commons-logging*.jar')
7-
compile fileTree(dir: '../maxkey-lib/apache/', include: 'commons-codec*.jar')
8-
compile fileTree(dir: '../maxkey-lib/json/', include: 'gson*.jar')
9-
compile fileTree(dir: '../maxkey-lib/java/', include: '*.jar')
3+
dependencies {
4+
/*compile group: 'commons-io', name: 'commons-io', version: '2.6'
5+
compile group: 'commons-logging', name: 'commons-logging', version: '1.2'
6+
compile group: 'log4j', name: 'log4j', version: '1.2.17'
7+
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.5.11'
8+
compile group: 'commons-codec', name: 'commons-codec', version: '1.14'
9+
compile group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '8.10'
10+
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
11+
*/
1012
}
-258 KB
Binary file not shown.
-59.4 KB
Binary file not shown.
-186 KB
Binary file not shown.
-478 KB
Binary file not shown.
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
package org.maxkey.client.http;
2+
3+
/*
4+
public class ApacheHttpClient{
5+
6+
private final CloseableHttpAsyncClient client;
7+
8+
public ApacheHttpClient() {
9+
this(ApacheHttpClientConfig.defaultConfig());
10+
}
11+
12+
public ApacheHttpClient(ApacheHttpClientConfig config) {
13+
this(config.getHttpAsyncClientBuilder());
14+
}
15+
16+
public ApacheHttpClient(HttpAsyncClientBuilder builder) {
17+
this(builder.build());
18+
}
19+
20+
public ApacheHttpClient(CloseableHttpAsyncClient client) {
21+
this.client = client;
22+
this.client.start();
23+
}
24+
25+
@Override
26+
public void close() throws IOException {
27+
client.close();
28+
}
29+
30+
@Override
31+
public <T> Future<T> executeAsync(String userAgent, Map<String, String> headers, Verb httpVerb, String completeUrl,
32+
byte[] bodyContents, OAuthAsyncRequestCallback<T> callback, OAuthRequest.ResponseConverter<T> converter) {
33+
final HttpEntity entity = bodyContents == null ? null : new ByteArrayEntity(bodyContents);
34+
return doExecuteAsync(userAgent, headers, httpVerb, completeUrl, entity, callback, converter);
35+
}
36+
37+
@Override
38+
public <T> Future<T> executeAsync(String userAgent, Map<String, String> headers, Verb httpVerb, String completeUrl,
39+
MultipartPayload bodyContents, OAuthAsyncRequestCallback<T> callback,
40+
OAuthRequest.ResponseConverter<T> converter) {
41+
42+
throw new UnsupportedOperationException("ApacheHttpClient does not support MultipartPayload yet.");
43+
}
44+
45+
@Override
46+
public <T> Future<T> executeAsync(String userAgent, Map<String, String> headers, Verb httpVerb, String completeUrl,
47+
String bodyContents, OAuthAsyncRequestCallback<T> callback, OAuthRequest.ResponseConverter<T> converter) {
48+
final HttpEntity entity = bodyContents == null ? null : new StringEntity(bodyContents, StandardCharsets.UTF_8);
49+
return doExecuteAsync(userAgent, headers, httpVerb, completeUrl, entity, callback, converter);
50+
}
51+
52+
@Override
53+
public <T> Future<T> executeAsync(String userAgent, Map<String, String> headers, Verb httpVerb, String completeUrl,
54+
File bodyContents, OAuthAsyncRequestCallback<T> callback, OAuthRequest.ResponseConverter<T> converter) {
55+
final HttpEntity entity = bodyContents == null ? null : new FileEntity(bodyContents);
56+
return doExecuteAsync(userAgent, headers, httpVerb, completeUrl, entity, callback, converter);
57+
}
58+
59+
private <T> Future<T> doExecuteAsync(String userAgent, Map<String, String> headers, Verb httpVerb,
60+
String completeUrl, HttpEntity entity, OAuthAsyncRequestCallback<T> callback,
61+
OAuthRequest.ResponseConverter<T> converter) {
62+
final RequestBuilder builder = getRequestBuilder(httpVerb);
63+
builder.setUri(completeUrl);
64+
65+
if (httpVerb.isPermitBody()) {
66+
if (!headers.containsKey(CONTENT_TYPE)) {
67+
builder.addHeader(CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
68+
}
69+
builder.setEntity(entity);
70+
}
71+
72+
for (Map.Entry<String, String> header : headers.entrySet()) {
73+
builder.addHeader(header.getKey(), header.getValue());
74+
}
75+
76+
if (userAgent != null) {
77+
builder.setHeader(OAuthConstants.USER_AGENT_HEADER_NAME, userAgent);
78+
}
79+
final OAuthAsyncCompletionHandler<T> handler = new OAuthAsyncCompletionHandler<>(callback, converter);
80+
final Future<HttpResponse> future = client.execute(builder.build(), handler);
81+
return new ApacheHttpFuture<>(future, handler);
82+
}
83+
84+
private static RequestBuilder getRequestBuilder(Verb httpVerb) {
85+
switch (httpVerb) {
86+
case GET:
87+
return RequestBuilder.get();
88+
case PUT:
89+
return RequestBuilder.put();
90+
case DELETE:
91+
return RequestBuilder.delete();
92+
case HEAD:
93+
return RequestBuilder.head();
94+
case POST:
95+
return RequestBuilder.post();
96+
case PATCH:
97+
return RequestBuilder.patch();
98+
case TRACE:
99+
return RequestBuilder.trace();
100+
case OPTIONS:
101+
return RequestBuilder.options();
102+
default:
103+
throw new IllegalArgumentException("message build error: unknown verb type");
104+
}
105+
}
106+
}*/

‎maxkey-client-sdk/src/main/java/org/maxkey/client/oauth/builder/api/DefaultApi10a.java‎

Lines changed: 0 additions & 160 deletions
This file was deleted.

0 commit comments

Comments
 (0)