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

Handle javax.servlet.http.HttpServletResponse with tests, fixes #36 #37

Closed
wants to merge 0 commits into from
Closed

Conversation

uuf6429
Copy link
Contributor

@uuf6429 uuf6429 commented May 19, 2019

Fixes #36

@cc-jhr cc-jhr requested a review from lmller May 27, 2019 11:46
@cc-jhr
Copy link
Collaborator

cc-jhr commented May 27, 2019

Sorry to respond this late. Thank you so much for the PR. We'll have a look at it.

@cc-jhr cc-jhr added this to the v2.2.1 milestone Jun 2, 2019

private fun HandlerMethod.hasHttpServletResponseParam() = this.methodParameters
.any { javaxServletResponseClass !== null && it.parameterType.isAssignableFrom(javaxServletResponseClass) }
Copy link
Collaborator

@cc-jhr cc-jhr Jun 2, 2019

Choose a reason for hiding this comment

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

You get the Class using the full qualified class name here. Why not check the name directly in the any expression using that string like:

private fun HandlerMethod.hasHttpServletResponseParam() = this.methodParameters
        .any { it.parameterType.name == "javax.servlet.http.HttpServletResponse" }

It also gets rid of the nullable code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, HttpServletResponse is an interface, so that code snippet can never be true. Moreover, if it was a class, that snippet wouldn't support child classes.

@cc-jhr cc-jhr self-requested a review June 2, 2019 12:51
Copy link
Collaborator

@cc-jhr cc-jhr left a comment

Choose a reason for hiding this comment

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

Could you also add a note to spring/README.md file that this is supported? Probably under section Features => Produces would be best place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix endpoints with HttpServletResponse parameters causing empty produces
2 participants