Skip to content

Commit

Permalink
Merge branch 'main' into update/scala3-library-3.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning authored Oct 3, 2024
2 parents 9df26ed + 64f031c commit 346ed68
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 68 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/publish-1.1-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ jobs:

- name: Build Documentation
run: |-
sbt -Dpekko.genjavadoc.enabled=true "set ThisBuild / version := \"1.1.0-M1\"; docs/paradox; unidoc"
sbt -Dpekko.genjavadoc.enabled=true "set ThisBuild / version := \"1.1.0\"; docs/paradox; unidoc"
env:
JAVA_OPTS: "-verbose:gc -Xmx4g"

# Create directory structure upfront since rsync does not create intermediate directories otherwise
- name: Create directory structure
run: |-
mkdir -p target/nightly-docs/docs/pekko-http/1.1.0-M1/
mkdir -p target/nightly-docs/docs/pekko-http/1.1.0/
mkdir -p target/nightly-docs/docs/pekko-http/1.1/
cp -r docs/target/paradox/site/main/ target/nightly-docs/docs/pekko-http/1.1.0-M1/docs
cp -r docs/target/paradox/site/main/ target/nightly-docs/docs/pekko-http/1.1.0/docs
cp -r docs/target/paradox/site/main/ target/nightly-docs/docs/pekko-http/1.1/docs
rm -r docs/target/paradox/site/main/
cp -r target/scala-2.13/unidoc target/nightly-docs/docs/pekko-http/1.1.0-M1/api
cp -r target/scala-2.13/unidoc target/nightly-docs/docs/pekko-http/1.1.0/api
cp -r target/scala-2.13/unidoc target/nightly-docs/docs/pekko-http/1.1/api
rm -r target/scala-2.13/unidoc
cp -r target/javaunidoc target/nightly-docs/docs/pekko-http/1.1.0-M1/japi
cp -r target/javaunidoc target/nightly-docs/docs/pekko-http/1.1.0/japi
cp -r target/javaunidoc target/nightly-docs/docs/pekko-http/1.1/japi
rm -r target/javaunidoc
Expand All @@ -67,7 +67,7 @@ jobs:
with:
upload: true
switches: --archive --compress --update --delete --progress --relative
local_path: target/nightly-docs/./docs/pekko-http/1.1.0-M1 # The intermediate dot is to show `--relative` which paths to operate on
local_path: target/nightly-docs/./docs/pekko-http/1.1.0 # The intermediate dot is to show `--relative` which paths to operate on
remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/pekko/
remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}
remote_port: ${{ secrets.NIGHTLIES_RSYNC_PORT }}
Expand Down
11 changes: 7 additions & 4 deletions docs/src/main/paradox/release-notes/releases-1.1.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# 0. Release Notes (1.1.x)

## 1.1.0-M1
## 1.1.0

Release notes for Apache Pekko HTTP 1.1.0-M1. See [GitHub Milestone](https://github.com/apache/pekko-http/milestone/1?closed=1) for fuller list of changes.
As with all milestone releases, this release is not recommended for production use - it is designed to allow users to try out the changes in a test environment.
Release notes for Apache Pekko HTTP 1.1.0. See [GitHub Milestone for 1.1.0-M1](https://github.com/apache/pekko-http/milestone/1?closed=1) and [GitHub Milestone for 1.1.0](https://github.com/apache/pekko-http/milestone/4?closed=1) for a fuller list of changes.

It is strongly recommended that you avoid using Pekko 1.0.x jars with this release, you should use Pekko 1.1.x jars where possible. We don't expect there to be problems running with Pekko 1.0.x jars but Pekko HTTP 1.1 jars are built with Pekko 1.1 jars.

All the changes in the @ref:[1.0.x releases](releases-1.0.md) up to and including v1.0.1.

### Bug Fix
* fix parse broken when header value is null ([PR575](https://github.com/apache/pekko-http/pull/575)) (not in v1.1.0-M1)

### Changes
* Changed names of HTTP status codes 413 and 422 ([PR87](https://github.com/apache/pekko-http/pull/87))
* Parse entire HTTP chunk size ([PR528](https://github.com/apache/pekko-http/pull/528))
* handle invalid Accept-Charset in requests - default to UTF-8 ([PR584](https://github.com/apache/pekko-http/pull/584)) (not in v1.1.0-M1)

### Additions
* Add UnsupportedContentTypeException Java DSL ([PR376](https://github.com/apache/pekko-http/pull/376))
Expand All @@ -22,4 +25,4 @@ All the changes in the @ref:[1.0.x releases](releases-1.0.md) up to and includin
Most of the dependency changes are small patch level upgrades. Some exceptions include:

* slf4j was updated to v2
* Jackson 2.17.1
* Jackson 2.17.2
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ public static MediaType.Binary applicationBinary(
: org.apache.pekko.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.applicationBinary(subType, comp, fileEx);
}
Expand All @@ -478,7 +478,7 @@ public static MediaType.Binary applicationBinary(
(org.apache.pekko.http.scaladsl.model.MediaType.Compressibility) compressibility;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.applicationBinary(subType, comp, fileEx);
}
Expand All @@ -489,7 +489,7 @@ public static MediaType.WithFixedCharset applicationWithFixedCharset(
(org.apache.pekko.http.scaladsl.model.HttpCharset) charset;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.applicationWithFixedCharset(
subType, cs, fileEx);
Expand All @@ -498,7 +498,7 @@ public static MediaType.WithFixedCharset applicationWithFixedCharset(
public static MediaType.WithOpenCharset applicationWithOpenCharset(
String subType, String... fileExtensions) {
scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.applicationWithOpenCharset(
subType, fileEx);
Expand All @@ -512,7 +512,7 @@ public static MediaType.Binary audio(
: org.apache.pekko.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.audio(subType, comp, fileEx);
}
Expand All @@ -523,7 +523,7 @@ public static MediaType.Binary audio(
(org.apache.pekko.http.scaladsl.model.MediaType.Compressibility) compressibility;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.audio(subType, comp, fileEx);
}
Expand All @@ -536,7 +536,7 @@ public static MediaType.Binary image(
: org.apache.pekko.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.image(subType, comp, fileEx);
}
Expand All @@ -547,7 +547,7 @@ public static MediaType.Binary image(
(org.apache.pekko.http.scaladsl.model.MediaType.Compressibility) compressibility;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.image(subType, comp, fileEx);
}
Expand All @@ -560,7 +560,7 @@ public static MediaType.Binary message(
: org.apache.pekko.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.message(subType, comp, fileEx);
}
Expand All @@ -571,14 +571,14 @@ public static MediaType.Binary message(
(org.apache.pekko.http.scaladsl.model.MediaType.Compressibility) compressibility;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.message(subType, comp, fileEx);
}

public static MediaType.WithOpenCharset text(String subType, String... fileExtensions) {
scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.text(subType, fileEx);
}
Expand All @@ -591,7 +591,7 @@ public static MediaType.Binary video(
: org.apache.pekko.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.video(subType, comp, fileEx);
}
Expand All @@ -602,7 +602,7 @@ public static MediaType.Binary video(
(org.apache.pekko.http.scaladsl.model.MediaType.Compressibility) compressibility;

scala.collection.immutable.Seq<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions));
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions));

return org.apache.pekko.http.scaladsl.model.MediaType.video(subType, comp, fileEx);
}
Expand Down Expand Up @@ -638,8 +638,7 @@ public static MediaType.Binary customBinary(
: org.apache.pekko.http.scaladsl.model.MediaType.NotCompressible$.MODULE$;

scala.collection.immutable.List<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions))
.toList();
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions)).toList();

scala.collection.immutable.Map<String, String> p = Util.convertMapToScala(params);

Expand All @@ -658,8 +657,7 @@ public static MediaType.Binary customBinary(
(org.apache.pekko.http.scaladsl.model.MediaType.Compressibility) compressibility;

scala.collection.immutable.List<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions))
.toList();
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions)).toList();

scala.collection.immutable.Map<String, String> p = Util.convertMapToScala(params);

Expand All @@ -678,8 +676,7 @@ public static MediaType.WithFixedCharset customWithFixedCharset(
(org.apache.pekko.http.scaladsl.model.HttpCharset) charset;

scala.collection.immutable.List<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions))
.toList();
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions)).toList();

scala.collection.immutable.Map<String, String> p = Util.convertMapToScala(params);

Expand All @@ -694,8 +691,7 @@ public static MediaType.WithOpenCharset customWithOpenCharset(
boolean allowArbitrarySubtypes,
String... fileExtensions) {
scala.collection.immutable.List<String> fileEx =
org.apache.pekko.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions))
.toList();
Util.<String, String>convertIterable(java.util.Arrays.asList(fileExtensions)).toList();

scala.collection.immutable.Map<String, String> p = Util.convertMapToScala(params);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import java.util.{ Collection => JCollection, Optional }

import org.apache.pekko
import pekko.annotation.{ ApiMayChange, DoNotInherit }
import pekko.http.impl.util.Util
import pekko.http.scaladsl
import pekko.japi.Util
import pekko.stream.TLSClientAuth
import pekko.util.OptionConverters._
import com.typesafe.sslconfig.pekko.PekkoSSLConfig
Expand Down Expand Up @@ -80,8 +80,8 @@ object ConnectionContext {
scaladsl.ConnectionContext.https(
sslContext,
sslConfig.toScala,
enabledCipherSuites.toScala.map(Util.immutableSeq(_)),
enabledProtocols.toScala.map(Util.immutableSeq(_)),
enabledCipherSuites.toScala.map(Util.convertIterable[String, String](_)),
enabledProtocols.toScala.map(Util.convertIterable[String, String](_)),
clientAuth.toScala,
sslParameters.toScala)

Expand All @@ -97,8 +97,8 @@ object ConnectionContext {
scaladsl.ConnectionContext.https(
sslContext,
None,
enabledCipherSuites.toScala.map(Util.immutableSeq(_)),
enabledProtocols.toScala.map(Util.immutableSeq(_)),
enabledCipherSuites.toScala.map(Util.convertIterable[String, String](_)),
enabledProtocols.toScala.map(Util.convertIterable[String, String](_)),
clientAuth.toScala,
sslParameters.toScala)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import java.lang.{ Iterable => JIterable }

import pekko.annotation.DoNotInherit
import pekko.http.scaladsl
import pekko.japi.Util
import pekko.http.impl.util.Util
import pekko.pattern.CircuitBreakerOpenException
import pekko.util.OptionConverters._

Expand Down Expand Up @@ -416,7 +416,8 @@ object Rejections {
s.UnsupportedRequestEncodingRejection(supported.asScala)

def unsatisfiableRange(unsatisfiableRanges: java.lang.Iterable[ByteRange], actualEntityLength: Long) =
UnsatisfiableRangeRejection(Util.immutableSeq(unsatisfiableRanges).map(_.asScala), actualEntityLength)
UnsatisfiableRangeRejection(Util.convertIterable[ByteRange, ByteRange](unsatisfiableRanges).map(_.asScala),
actualEntityLength)

def tooManyRanges(maxRanges: Int) = TooManyRangesRejection(maxRanges)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ trait Rejected extends RouteResult {

object RouteResults {
import pekko.http.scaladsl.{ server => s }
import pekko.japi.Util
import pekko.http.impl.util.JavaMapping
import pekko.http.impl.util.{ JavaMapping, Util }
import JavaMapping.Implicits._
import RoutingJavaMapping._

Expand All @@ -38,7 +37,7 @@ object RouteResults {
}

def rejected(rejections: java.lang.Iterable[Rejection]): Rejected = {
s.RouteResult.Rejected(Util.immutableSeq(rejections).map(_.asScala))
s.RouteResult.Rejected(Util.convertIterable[Rejection, Rejection](rejections).map(_.asScala))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,36 @@ import java.util.function.{ Function => JFunction }

import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.http.impl.util.JavaMapping
import pekko.http.javadsl.settings.ParserSettings
import pekko.http.javadsl.settings.RoutingSettings
import pekko.dispatch.ExecutionContexts
import pekko.event.LoggingAdapter
import pekko.japi.Util
import pekko.stream.Materializer
import pekko.stream.javadsl.Source
import pekko.util.ByteString
import pekko.util.FutureConverters._

import scala.concurrent.ExecutionContextExecutor
import pekko.http.impl.model.JavaUri
import pekko.http.javadsl.model.HttpRequest
import pekko.http.javadsl.model.HttpEntity
import pekko.http.javadsl.model.RequestEntity
import pekko.http.javadsl.model.Uri
import pekko.http.impl.util.JavaMapping
import pekko.http.impl.util.Util.convertIterable
import pekko.http.javadsl.model.{ HttpEntity, HttpRequest, RequestEntity, Uri }
import pekko.http.javadsl.server._
import pekko.http.scaladsl.server.{ Directives => D }
import pekko.http.javadsl.settings.{ ParserSettings, RoutingSettings }
import pekko.http.scaladsl
import pekko.stream.Materializer
import java.util.function.Supplier
import java.util.{ List => JList }
import pekko.http.scaladsl.server.{ Directives => D }

import pekko.http.javadsl.model.HttpResponse
import pekko.http.javadsl.model.ResponseEntity
import pekko.http.javadsl.model.HttpHeader
import pekko.http.scaladsl.util.FastFuture._
import pekko.http.javadsl.server

import java.lang.{ Iterable => JIterable }
import java.util.function.Supplier
import java.util.{ List => JList }
import java.util.concurrent.CompletionStage
import java.util.function.Predicate

import pekko.dispatch.ExecutionContexts
import pekko.event.LoggingAdapter
import pekko.http.javadsl.server
import pekko.util.FutureConverters._

import scala.concurrent.ExecutionContextExecutor
import scala.concurrent.duration.FiniteDuration

abstract class BasicDirectives {
Expand All @@ -66,7 +63,8 @@ abstract class BasicDirectives {

def mapRejections(f: JFunction[JList[Rejection], JList[Rejection]], inner: Supplier[Route]): Route = RouteAdapter {
D.mapRejections(rejections =>
Util.immutableSeq(f.apply(Util.javaArrayList(rejections.map(_.asJava)))).map(_.asScala)) { inner.get.delegate }
convertIterable[Rejection, Rejection](f.apply(Util.javaArrayList(rejections.map(_.asJava)))).map(
_.asScala)) { inner.get.delegate }
}

def mapResponse(f: JFunction[HttpResponse, HttpResponse], inner: Supplier[Route]): Route = RouteAdapter {
Expand All @@ -79,7 +77,10 @@ abstract class BasicDirectives {

def mapResponseHeaders(f: JFunction[JList[HttpHeader], JList[HttpHeader]], inner: Supplier[Route]): Route =
RouteAdapter {
D.mapResponseHeaders(l => Util.immutableSeq(f.apply(Util.javaArrayList(l))).map(_.asScala)) { inner.get.delegate } // TODO try to remove map()
D.mapResponseHeaders(l =>
convertIterable[HttpHeader, HttpHeader](f.apply(Util.javaArrayList(l))).map(_.asScala)) {
inner.get.delegate
} // TODO try to remove map()
}

def mapInnerRoute(f: JFunction[Route, Route], inner: Supplier[Route]): Route = RouteAdapter {
Expand Down Expand Up @@ -155,7 +156,7 @@ abstract class BasicDirectives {
* to the list of rejections potentially coming back from the inner route.
*/
def cancelRejections(classes: JIterable[Class[_]], inner: Supplier[Route]): Route = RouteAdapter {
D.cancelRejections(Util.immutableSeq(classes): _*) { inner.get.delegate }
D.cancelRejections(convertIterable[Class[_], Class[_]](classes): _*) { inner.get.delegate }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import java.util.Optional
import java.util.function.Function

import org.apache.pekko
import pekko.japi.Util
import pekko.http.impl.util.Util
import pekko.http.scaladsl.model._
import pekko.http.scaladsl.model.headers.{ ByteRange, HttpChallenge, HttpEncoding }
import pekko.http.javadsl.{ model, server => jserver }
Expand Down Expand Up @@ -335,7 +335,9 @@ final case class TransformationRejection(transform: immutable.Seq[Rejection] =>
override def apply(t: Iterable[jserver.Rejection]): Iterable[jserver.Rejection] = {
// explicit collects assignment is because of unidoc failing compilation on .asScala and .asJava here
val transformed: Seq[jserver.Rejection] =
transform(Util.immutableSeq(t).collect { case r: Rejection => r }).collect { case j: jserver.Rejection => j }
transform(Util.convertIterable[jserver.Rejection, jserver.Rejection](t).collect { case r: Rejection =>
r
}).collect { case j: jserver.Rejection => j }
transformed.asJava // TODO "asJavaDeep" and optimise?
}
}
Expand Down
Loading

0 comments on commit 346ed68

Please sign in to comment.