Skip to content

Adds StripContextPath filter [webflux] - #4129

Open
garvit-joshi wants to merge 4 commits into
spring-cloud:mainfrom
garvit-joshi:main
Open

Adds StripContextPath filter [webflux]#4129
garvit-joshi wants to merge 4 commits into
spring-cloud:mainfrom
garvit-joshi:main

Conversation

@garvit-joshi

Copy link
Copy Markdown
Contributor

closes: #1935

newPath = "/";
}

ServerHttpRequest newRequest = request.mutate().contextPath("").path(newPath).build();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not a big fan of setting things to an empty string. Does null work here instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried null, but it does not compile here. contextPath(...) is treated as non-null and NullAway fails the build with:

passing @Nullable parameter 'null' where @NonNull is required

So I kept contextPath("") for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Interesting, the field in the builder is nullable and in the constructor but not the builder method. @rstoyanchev is that an oversight?

@garvit-joshi

Copy link
Copy Markdown
Contributor Author

Hi @rstoyanchev, @spencergibb ,

Any update on this?

Signed-off-by: Garvit Joshi <garvitjoshi9@gmail.com>
…[webflux]

- Adds GatewayFilterSpec.stripContextPath() for the fluent Java DSL
- Adds integration tests with spring.webflux.base-path covering
  StripContextPath before RewritePath and the failure without it
- Shows base-path in the StripContextPath docs example and notes that
  Path predicate patterns are written without the base path
- Cross-links StripContextPath from StripPrefix, RewritePath, SetPath
  and PrefixPath docs

Signed-off-by: Garvit Joshi <garvitjoshi9@gmail.com>
…lux]

Signed-off-by: Garvit Joshi <garvitjoshi9@gmail.com>
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.

Support webflux.base-path in StripFilter and possibly others

3 participants