+htt - 18781 - Fixes a SOE in javadsl.HttpsContext.create
This commit is contained in:
parent
630bd948d5
commit
e78eb54b43
3 changed files with 22 additions and 13 deletions
|
|
@ -8,6 +8,7 @@ import javax.net.ssl.SSLContext;
|
|||
import javax.net.ssl.SSLParameters;
|
||||
|
||||
import akka.japi.Option;
|
||||
import akka.japi.Util;
|
||||
import akka.stream.io.ClientAuth;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -32,7 +33,16 @@ public abstract class HttpsContext {
|
|||
Option<SSLParameters> sslParameters)
|
||||
//#http-context-creation
|
||||
{
|
||||
return akka.http.scaladsl.HttpsContext.create(sslContext, enabledCipherSuites, enabledProtocols,
|
||||
clientAuth, sslParameters);
|
||||
final scala.Option<scala.collection.immutable.Seq<String>> ecs;
|
||||
if (enabledCipherSuites.isDefined()) ecs = scala.Option.apply(Util.immutableSeq(enabledCipherSuites.get()));
|
||||
else ecs = scala.Option.empty();
|
||||
final scala.Option<scala.collection.immutable.Seq<String>> ep;
|
||||
if(enabledProtocols.isDefined()) ep = scala.Option.apply(Util.immutableSeq(enabledProtocols.get()));
|
||||
else ep = scala.Option.empty();
|
||||
return new akka.http.scaladsl.HttpsContext(sslContext,
|
||||
ecs,
|
||||
ep,
|
||||
clientAuth.asScala(),
|
||||
sslParameters.asScala());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -739,15 +739,4 @@ final case class HttpsContext(sslContext: SSLContext,
|
|||
|
||||
/** Java API */
|
||||
def getSslParameters: japi.Option[SSLParameters] = sslParameters
|
||||
}
|
||||
|
||||
object HttpsContext {
|
||||
/** INTERNAL API **/
|
||||
private[http] def create(sslContext: SSLContext,
|
||||
enabledCipherSuites: japi.Option[JCollection[String]],
|
||||
enabledProtocols: japi.Option[JCollection[String]],
|
||||
clientAuth: japi.Option[ClientAuth],
|
||||
sslParameters: japi.Option[SSLParameters]) =
|
||||
HttpsContext(sslContext, enabledCipherSuites.map(_.asScala.toList), enabledProtocols.map(_.asScala.toList),
|
||||
clientAuth, sslParameters)
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
package akka.http.javadsl.model
|
||||
|
||||
import javax.net.ssl.SSLContext
|
||||
|
||||
import akka.http.javadsl.model.headers.Cookie
|
||||
import akka.http.scaladsl.model
|
||||
import akka.http.scaladsl.model.headers.BasicHttpCredentials
|
||||
|
|
@ -56,5 +58,13 @@ class JavaApiTestCaseSpecs extends FreeSpec with MustMatchers {
|
|||
val origin = Uri.create("/order?orderId=123")
|
||||
JavaApiTestCases.addSessionId(origin) must be(Uri.create("/order?orderId=123&session=abcdefghijkl"))
|
||||
}
|
||||
"create HttpsContext" in {
|
||||
import akka.japi.{ Option ⇒ JOption }
|
||||
akka.http.javadsl.HttpsContext.create(SSLContext.getDefault,
|
||||
JOption.none,
|
||||
JOption.none,
|
||||
JOption.none,
|
||||
JOption.none) mustNot be(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue