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

MVC Gateway Server #2949

Merged
merged 64 commits into from
Jul 5, 2023
Merged

MVC Gateway Server #2949

merged 64 commits into from
Jul 5, 2023

Conversation

spencergibb
Copy link
Member

@spencergibb spencergibb commented May 10, 2023

Fixes gh-36

TODO:

  • Header filters infrastructure
  • Load balancer filter
  • URI template variables (path params)
  • Webflux configuration compatibility
    • Shortcut configuration
      • For gateway defined predicates/filters @Shortcut(type=DEFAULT, fieldOrder="name,value", prefix="")
      • For framework predicates? A shortcut interface or class that includes the method reference? (Currently "overrides" RequestPredicates in GatewayRequestPredicates to add the annotation)
    • SpEL?
  • Post works
  • Form urlencoded post works
  • Form multipart form data post works
  • JdkClientHttpRequestFactory
  • RestClient ProxyExchange
  • Forward url
  • Websocket
  • Documentation
  • Observability
  • Actuator
    • Refresh
      • combines all config-based routes into a single RouterFucntion which delegates to a refreshable holder class.
    • RouterFucntion and RequestPredicate has an accept(Visitor) method, but HandlerFilterFunction does not.
  • Java DSL impl that overcomes global filter() method for each route() defined in a builder. andOther() works.
    • Created GatewayRouterFunctions.route(routeId)
  • AOT

Predicates

  • All MVC.fn request predicates
  • After
  • Before
  • Between
  • CloudFoundryRouteService
  • Cookie
  • Header
  • Host
  • ReadBody
  • Multipart form data
  • RemoteAddr
    • Webflux uses netty IpFilterRuleType & IpSubnetFilterRule. Copy? Find alternative?
  • Weight

Header filters

  • RemoveHopByHopHeaders
  • ForwardedHeaders
  • XForwardedHeaders
  • TransferEncodingNormalizationHeaders
  • ObservedRequestHttpHeaders
  • ObservedResponseHttpHeaders
  • GRPCRequestHeaders
  • GRPCResponseHeaders

TODO: Basic Filters

  • AddRequestHeader
  • AddRequestHeadersIfNotPresent
  • AddRequestParameter
  • AddResponseHeader
  • DedupeResponseHeader
  • PrefixPath
  • PreserveHostHeader
  • RedirectTo
  • RemoveRequestHeader
  • RemoveRequestParameter
  • RemoveResponseHeader
  • RequestHeaderSize
  • RequestHeaderToRequestUri
  • RequestSize
  • RewriteLocationResponseHeader
  • RewritePath
  • RewriteResponseHeader
  • SetPath
  • SetRequestHeader
  • SetRequestHostHeader
  • SetResponseHeader
  • SetStatus
  • StripPrefix

TODO: Advanced Filters

  • Retry
  • RequestRateLimiter
  • SpringCloudCircuitBreaker (Resilience4J)
  • MapRequestHeader
  • FallbackHeaders
  • TokenRelay
  • CacheRequestBody
  • ModifyRequestBody
  • ModifyResponseBody
  • JsonToGrpc
  • RemoveJsonAttributesResponseBody
  • SaveSession? (not sure this is needed in servlets)

TODO: Things that might be sharable

  • Observation Documentation & Convention
  • Most of Forwarded/XForwarded logic outside of specific request API
  • Route/Predicate/Filter Properties
  • Constants
  • HttpStatusHolder

@siganapathy

This comment was marked as off-topic.

@spencergibb
Copy link
Member Author

First milestone sometime in August. GA release late November early December after Framework 6.1 and Boot 3.2

@spencergibb spencergibb changed the title Gateway Server MVC MVC Gateway Server Jun 9, 2023
@spencergibb spencergibb force-pushed the mvc-server branch 3 times, most recently from c8481f0 to f22f1a3 Compare June 21, 2023 16:12
@spencergibb spencergibb force-pushed the mvc-server branch 2 times, most recently from d1fa032 to e18bbc7 Compare June 24, 2023 02:38
spencergibb added a commit that referenced this pull request Jul 10, 2023
Also adds add*() methods if the user just wants to add a value.

See gh-2949
spencergibb added a commit that referenced this pull request Jul 10, 2023
Adds statusCodes to fail on.

See gh-2949
spencergibb added a commit that referenced this pull request Jul 10, 2023
Renames CircuitBreakerFilterFunctions.Config to CircuitBreakerFilterFunctions.CircuitBreakerConfig.

Renames RetryFilterFunctions.Config to RetryFilterFunctions.RetryConfig

See gh-2949
spencergibb added a commit that referenced this pull request Jul 10, 2023
spencergibb added a commit that referenced this pull request Jul 10, 2023
spencergibb added a commit that referenced this pull request Jul 11, 2023
spencergibb added a commit that referenced this pull request Jul 11, 2023
spencergibb added a commit that referenced this pull request Jul 11, 2023
spencergibb added a commit that referenced this pull request Jul 11, 2023
spencergibb added a commit that referenced this pull request Jul 11, 2023
spencergibb added a commit that referenced this pull request Jul 12, 2023
Adds request attribute in CircuitBreakerFilterFunctions.circuitBreaker()
for use in fallbackHeaders().

See gh-2949
spencergibb added a commit that referenced this pull request Jul 12, 2023
Removes workaround in RestClientProxyExchange and ClientHttpRequestFactoryProxyExchange

See gh-2949
spencergibb added a commit that referenced this pull request Jul 13, 2023
This sets up the routeId filter and adds the routeId as metadata and puts the routeId in a request attribute on route()

See gh-2949
spencergibb added a commit that referenced this pull request Jul 13, 2023
Includes and ArgumentSupplier interface that, currently, predicates can implement that will, when accessed by the ArgumentSupplierBeanPostProcessor, send an ArgumentSupplier.ArgumentSuppliedEvent() that components can listen for.

In this case, the WeightCalculatorFilter needs the arguments for defined weight RequestPredicates.

Also GatewayRouterFunctions.route(routeId) was enhanced to add the routeId to requests via a custom Builder and delegating RouterFunction.

See gh-2949
spencergibb added a commit that referenced this pull request Jul 14, 2023
Sets up a gateway attributes map in request attributes because request attributes are cleared between predicates.

Added MvcUtils.getAttribute() and MvcUtils.putAttribute() to use the gateway attribute map for attributes that live across predicates.

Adds BodyFilterFunctions.adaptCachedBody(). This needs to be used in conjunction with readBody(), otherwise no body will be sent downstream.

See gh-2949
spencergibb added a commit that referenced this pull request Jul 14, 2023
Adds MvcUtils.cacheAndReadBody(), MvcUtils.readBody() and MvcUtils.cacheAndReadBody(). This is generalized from GatewayRequestPredicates.readBody().

See gh-2949
spencergibb added a commit that referenced this pull request Aug 16, 2023
@spencergibb spencergibb deleted the mvc-server branch February 26, 2024 20:28
@EtienneK
Copy link

@spencergibb - I know this has been merged, but I see in the comments that WebSocket support was not part of this deliverable.

Is WebSocket support still coming? Is it something being worked on?

@spencergibb
Copy link
Member Author

It is planned. Hopefully later this year

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.

Spring MVC/Servlet implementation
3 participants