Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for @ResponseStatus and @ResponseHeader #20311

Merged
merged 1 commit into from
Oct 14, 2021

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Sep 21, 2021

Closes: #20100

I took the tests from #20242 where @Yelzhasdev made a first attempt to implement the feature.

@quarkus-bot
Copy link

quarkus-bot bot commented Sep 21, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building ba2eeb8

Status Name Step Failures Logs Raw logs
Gradle Tests - JDK 11 Windows Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Gradle Tests - JDK 11 Windows #

- Failing: integration-tests/gradle 

📦 integration-tests/gradle

io.quarkus.gradle.devmode.MultiModuleIncludedBuildTest.main line 24 - More details - Source on GitHub

java.lang.AssertionError: 

Expecting actual:

@@ -432,6 +437,45 @@ public RuntimeResource buildResourceMethod(ResourceClass clazz,
pathParameterIndexes, score, sseElementType, clazz.resourceExceptionMapper());
}

private void addResponseHandler(ServerResourceMethod method, List<ServerRestHandler> handlers) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the new ResponseHandler.ResponseBuilderCustomizer and PublisherResponseHandler.StreamingResponseCustomizer integration classes?

Couldn't we just register a handler in HandlerChainCustomizer.Phase#AFTER_RESPONSE_CREATED and use it to update the response?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 reasons:

  1. we don't want to update the response if it is created by the user - a Response returned by the user always takes precedence over the annotations.
  2. In the case of streaming, there is no such phase. The streaming handler is essentially the last handler to be executed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 1 we could add an extra check and forgo the use of the customizer, but it would also mean that the Response would be created again - so slightly more overhead.

@geoand
Copy link
Contributor Author

geoand commented Sep 22, 2021

I am also wondering if using Response or RestResponse along with these annotations should be a build time error... Currently the annotations are silently ignored.

@geoand
Copy link
Contributor Author

geoand commented Sep 29, 2021

Fixed conflict

@quarkus-bot
Copy link

quarkus-bot bot commented Sep 29, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building f8b7d93

Status Name Step Failures Logs Raw logs
✔️ JVM Tests - JDK 11
JVM Tests - JDK 17 Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ JVM Tests - JDK 17 #

- Failing: extensions/grpc/deployment 
! Skipped: docs integration-tests/devmode integration-tests/grpc-health and 9 more

📦 extensions/grpc/deployment

io.quarkus.grpc.devconsole.DevConsoleUnaryMethodTest.websocketTest line 57 - More details - Source on GitHub

java.lang.AssertionError: 

Expected size: 2 but was: 1 in:

@geoand
Copy link
Contributor Author

geoand commented Oct 12, 2021

@stuartwdouglas @FroMage what is your take on this one?
If we want it, I can rebase to fix the conflicts

@geoand
Copy link
Contributor Author

geoand commented Oct 13, 2021

I rebased the PR.

I think this makes sense to have as it also affects Kotlin users who want to use Flow as the return type (see #20100 (comment))

@quarkus-bot
Copy link

quarkus-bot bot commented Oct 13, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building 9b1b0a2

Status Name Step Failures Logs Raw logs
✔️ JVM Tests - JDK 11
JVM Tests - JDK 17 Build Failures Logs Raw logs

Failures

⚙️ JVM Tests - JDK 17 #

- Failing: extensions/hibernate-search-orm-elasticsearch/deployment 
! Skipped: docs extensions/hibernate-search-orm-elasticsearch-aws/deployment integration-tests/hibernate-search-orm-elasticsearch and 1 more

📦 extensions/hibernate-search-orm-elasticsearch/deployment

Failed to execute goal io.fabric8:docker-maven-plugin:0.37.0:start (docker-start) on project quarkus-hibernate-search-orm-elasticsearch-deployment: I/O Error

@geoand geoand added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Oct 14, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 14, 2021

Failing Jobs - Building d6aa606

Status Name Step Failures Logs Raw logs
JVM Tests - JDK 11 Build Failures Logs Raw logs
✔️ JVM Tests - JDK 17

Full information is available in the Build summary check run.

Failures

⚙️ JVM Tests - JDK 11 #

- Failing: integration-tests/kafka-sasl-elytron 

📦 integration-tests/kafka-sasl-elytron

io.quarkus.it.kafka.KafkaSaslTest.test - More details - Source on GitHub

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:573)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:646)

@geoand
Copy link
Contributor Author

geoand commented Oct 14, 2021

The failure is completely unrelated

@geoand geoand merged commit ced07cc into quarkusio:main Oct 14, 2021
@quarkus-bot quarkus-bot bot added this to the 2.5 - main milestone Oct 14, 2021
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Oct 14, 2021
@geoand geoand deleted the #20100 branch October 14, 2021 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the ability to set HTTP headers and Response status when returning Reactive Types from RESTEasy Reactive
2 participants