Skip to content

Drop a constant from Servlet package in OrderedHiddenHttpMethodFilter #14228

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

Closed

Conversation

izeye
Copy link
Contributor

@izeye izeye commented Aug 29, 2018

The constant comes from Servlet package and has a value of 0, so this PR simply drops the constant.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 29, 2018
Copy link
Member

@snicoll snicoll left a comment

Choose a reason for hiding this comment

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

Thanks again for the PR. I am not sure about this one, I've added a comment.

@@ -32,8 +31,7 @@
/**
* The default order is high to ensure the filter is applied before Spring Security.
*/
public static final int DEFAULT_ORDER = FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER
- 10000;
public static final int DEFAULT_ORDER = -10000;
Copy link
Member

Choose a reason for hiding this comment

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

I can understand why you'd want to drop a reference to this class but I am not sure copy/pasting the default (I mean 0) is something we want to do. Perhaps we need a shared context for this?

WDYT?

Copy link
Contributor Author

@izeye izeye Aug 29, 2018

Choose a reason for hiding this comment

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

@snicoll Thanks for the quick feedback! I thought the same thing but couldn't find a good place to move them. So I considered adding a constant container class like FilterOrders but with only one member, I wasn't sure it's okay. Any suggestion?

Copy link
Member

Choose a reason for hiding this comment

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

@bclozel that was added as part of #14008 - Does the constant has to be the same for reactive? If it's the same then we should probably need some concept that gathers them. What do you think?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Aug 29, 2018
@snicoll
Copy link
Member

snicoll commented Aug 29, 2018

This should be applied to 2.0.x as well.

@philwebb
Copy link
Member

I think for 2.0.x we should just drop the reference and hard code 0 but it feels like we're missing something from the code. The constant was originally added in 1.3 (see #3613) but looking again I wonder if we should move it out of FilterRegistrationBean. It really feels quite specific to be in there.

I wonder if adding an OrderedFilter interface might be useful? We could add one in org.springframework.boot.web.servlet.filter which extended Ordered and Filter and another in org.springframework.boot.web.reactive.filter that extends Ordered and WebFilter. I don't think there's currently a need for a common constant. I think I'd rather copy/paste than introduce another package.

@izeye
Copy link
Contributor Author

izeye commented Oct 12, 2018

This looks resolved via 3ff20b2, so we can close this PR unless there needs to discuss more on this.

@philwebb
Copy link
Member

philwebb commented Oct 12, 2018

It might be worth still considering the OrderedFilter idea. Although we should probably open a different issue for that.

@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Oct 12, 2018
@philwebb philwebb added this to the 2.1.x milestone Oct 12, 2018
@philwebb philwebb self-assigned this Oct 12, 2018
@philwebb
Copy link
Member

Closing in favor of #14793

@philwebb philwebb closed this Oct 12, 2018
@philwebb philwebb removed the type: enhancement A general enhancement label Oct 12, 2018
@philwebb philwebb removed this from the 2.1.x milestone Oct 12, 2018
@philwebb philwebb added the status: superseded An issue that has been superseded by another label Oct 12, 2018
@izeye izeye deleted the drop-servlet-constant-reference branch October 12, 2018 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants