-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* develop: Adding support for multipart request for JDK11 HTTP client Adding support for multipart request for JDK11 HTTP client Adding support for multipart request for JDK11 HTTP client Solving: javax.net.ssl.SSLProtocolException with openjdk11 on Travis Solving: javax.net.ssl.SSLProtocolException with openjdk11 on Travis A JDK11 HTTP Client provider. A JDK11 HTTP Client provider. A JDK11 HTTP Client provider. HTTP clients configuration tests.
- Loading branch information
Showing
63 changed files
with
1,813 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
VERSION = 1.0.5 | ||
systemProp.jdk.tls.client.protocols="TLSv1.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 55 additions & 2 deletions
57
shcf4j-ahc2/src/main/java/com/imperva/shcf4j/ahc2/client/async/ConversionUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,73 @@ | ||
package com.imperva.shcf4j.ahc2.client.async; | ||
|
||
import com.imperva.shcf4j.Header; | ||
import com.imperva.shcf4j.ProcessingException; | ||
import com.imperva.shcf4j.client.CredentialsProvider; | ||
import io.netty.handler.codec.http.HttpHeaders; | ||
import org.asynchttpclient.Realm; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.StreamSupport; | ||
|
||
class ConversionUtils { | ||
|
||
|
||
|
||
static List<Header> convert(HttpHeaders headers){ | ||
static List<Header> convert(HttpHeaders headers) { | ||
return StreamSupport | ||
.stream(headers.spliterator(), false) | ||
.map(e -> Header.builder().name(e.getKey()).name(e.getValue()).build()) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
static List<? extends Realm> convert(CredentialsProvider cp) { | ||
if (cp != null) { | ||
|
||
if (cp.getCredentials().size() > 1) { | ||
throw new ProcessingException("AHC2 supports only single credentials entry"); | ||
} | ||
|
||
return cp.getCredentials() | ||
.entrySet() | ||
.stream() | ||
.map(e -> { | ||
Realm.Builder realm = new Realm.Builder( | ||
e.getValue().getUserPrincipal().getName(), | ||
e.getValue().getPassword()); | ||
if (e.getKey().getScheme() != null) { // Auth scheme | ||
switch (e.getKey().getScheme().toUpperCase()) { | ||
case "BASIC": | ||
realm.setScheme(Realm.AuthScheme.BASIC); | ||
break; | ||
case "DIGEST": | ||
realm.setScheme(Realm.AuthScheme.DIGEST); | ||
break; | ||
case "NTLM": | ||
realm.setScheme(Realm.AuthScheme.NTLM); | ||
break; | ||
case "SPNEGO": | ||
realm.setScheme(Realm.AuthScheme.SPNEGO); | ||
break; | ||
case "KERBEROS": | ||
realm.setScheme(Realm.AuthScheme.KERBEROS); | ||
break; | ||
} | ||
} else { // Default scheme | ||
realm.setScheme(Realm.AuthScheme.BASIC); | ||
} | ||
|
||
if (e.getKey().getRealm() != null) { // Auth realm name | ||
realm.setRealmName(e.getKey().getRealm()); | ||
} | ||
|
||
// Auth hostname | ||
// Auth port | ||
|
||
return realm.build(); | ||
}).collect(Collectors.toList()); | ||
} else { | ||
return Collections.emptyList(); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
.../src/test/java/com/imperva/shcf4j/ahc2/client/config/AsyncAhcClientBuilderConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.imperva.shcf4j.ahc2.client.config; | ||
|
||
import com.imperva.shcf4j.AsyncClientBaseTest; | ||
import com.imperva.shcf4j.config.HttpClientBuilderConfigTest; | ||
|
||
public class AsyncAhcClientBuilderConfigTest extends HttpClientBuilderConfigTest implements AsyncClientBaseTest { | ||
} |
2 changes: 1 addition & 1 deletion
2
...ient/AsyncAhcClientRequestConfigTest.java → ...nfig/AsyncAhcClientRequestConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
config.stopBubbling = true | ||
lombok.addLombokGeneratedAnnotation = true |
9 changes: 9 additions & 0 deletions
9
shcf4j-api/src/main/java/com/imperva/shcf4j/HttpHeaderNames.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.imperva.shcf4j; | ||
|
||
public class HttpHeaderNames { | ||
|
||
public static final String CONTENT_TYPE = "content-type"; | ||
public static final String CONTENT_LENGTH = "content-length"; | ||
public static final String CONTENT_ENCODING = "content-encoding"; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.