-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Initial functionality for default function routing #3691
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
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5cb094e
Initial functionality for default function routing
olegz 159ce34
Adds support for retry with request body.
spencergibb 1982315
Merge branch '4.1.x' into 4.2.x
spencergibb ccde721
Merge branch '4.2.x'
spencergibb 4564a13
Guard for null pointer if no host header.
spencergibb 223c1ee
Merge branch '4.1.x' into 4.2.x
spencergibb ffb2db2
Merge branch '4.2.x'
spencergibb ec7e5f1
Bump @springio/antora-extensions from 1.14.2 to 1.14.4 in /docs
dependabot[bot] 3832179
Update SNAPSHOT to 4.3.0-M2
spring-builds 0affb76
Going back to snapshots
spring-builds ed9a24a
Query param route predicate - extension of QueryRoutePredicateFactory…
polifr 197aef7
Bump grpc.version from 1.70.0 to 1.71.0
dependabot[bot] 5045f05
Merge pull request #3712 from spring-cloud/dependabot/maven/main/grpc…
ryanjbaxter fec12b1
Merge pull request #3706 from spring-cloud/dependabot/npm_and_yarn/do…
ryanjbaxter 6e856fa
Initial functionality for default function routing
olegz 99d903a
Add ability to default to s-c-function's RoutingFunction if target fu…
olegz 5e0152f
Merge remote-tracking branch 'origin/DEFAULT-FUNC-ROUTING' into DEFAU…
olegz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
46 changes: 46 additions & 0 deletions
46
...ava/org/springframework/cloud/gateway/server/mvc/config/DefaultFunctionConfiguration.java
This file contains hidden or 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,46 @@ | ||
/* | ||
* Copyright 2013-2025 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.cloud.gateway.server.mvc.config; | ||
|
||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.function.RouterFunction; | ||
import org.springframework.web.servlet.function.ServerResponse; | ||
|
||
import static org.springframework.cloud.gateway.server.mvc.handler.GatewayRouterFunctions.route; | ||
import static org.springframework.cloud.gateway.server.mvc.handler.HandlerFunctions.fn; | ||
|
||
@Configuration | ||
@ConditionalOnClass(name = "org.springframework.cloud.function.context.FunctionCatalog") | ||
@ConditionalOnProperty(name = "spring.cloud.gateway.function.enabled", havingValue = "true", matchIfMissing = true) | ||
public class DefaultFunctionConfiguration { | ||
|
||
@Bean | ||
RouterFunction<ServerResponse> gatewayToFunctionRouter() { | ||
// @formatter:off | ||
return route("functionroute") | ||
.POST("/{path}/{name}", fn("{path}/{name}")) | ||
.POST("/{path}", fn("{path}")) | ||
.GET("/{path}/{name}", fn("{path}/{name}")) | ||
.GET("/{path}", fn("{path}")) | ||
.build(); | ||
// @formatter:on | ||
} | ||
|
||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
3 changes: 2 additions & 1 deletion
3
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
This file contains hidden or 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
org.springframework.cloud.gateway.server.mvc.GatewayServerMvcAutoConfiguration | ||
org.springframework.cloud.gateway.server.mvc.GatewayMvcClassPathWarningAutoConfiguration | ||
org.springframework.cloud.gateway.server.mvc.handler.GatewayMultipartAutoConfiguration | ||
org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration | ||
org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration | ||
org.springframework.cloud.gateway.server.mvc.config.DefaultFunctionConfiguration |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.