-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register resource classes for reflection when ContainerResponseFilter…
… exists This is needed because those filters can call setEntityStream which then forces the use of the slow path for calling writers Closes: #42537 (cherry picked from commit 2a050f7)
- Loading branch information
Showing
5 changed files
with
44 additions
and
2 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
28 changes: 28 additions & 0 deletions
28
...tlin/io/quarkus/it/resteasy/reactive/kotlin/EntityStreamSettingContainerResponseFilter.kt
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,28 @@ | ||
package io.quarkus.it.resteasy.reactive.kotlin | ||
|
||
import jakarta.ws.rs.container.ContainerRequestContext | ||
import jakarta.ws.rs.container.ContainerResponseContext | ||
import jakarta.ws.rs.container.ContainerResponseFilter | ||
import jakarta.ws.rs.ext.Provider | ||
import java.io.ByteArrayInputStream | ||
import org.jboss.resteasy.reactive.server.spi.ResteasyReactiveContainerRequestContext | ||
|
||
@Provider | ||
class EntityStreamSettingContainerResponseFilter : ContainerResponseFilter { | ||
override fun filter( | ||
requestContext: ContainerRequestContext?, | ||
responseContext: ContainerResponseContext? | ||
) { | ||
if (requestContext is ResteasyReactiveContainerRequestContext) { | ||
if ( | ||
"hello".equals( | ||
requestContext.serverRequestContext.resteasyReactiveResourceInfo.name | ||
) | ||
) { | ||
responseContext?.setEntity( | ||
ByteArrayInputStream("Hello Quarkus REST".toByteArray(Charsets.UTF_8)) | ||
) | ||
} | ||
} | ||
} | ||
} |
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