Comments (2)
I don't understand your full configuration. Can you provide it. Where does return ServerResponse.ok().body(result);
live?
from spring-cloud-gateway.
I don't understand your full configuration. Can you provide it. Where does
return ServerResponse.ok().body(result);
live?
I have added a custom handler, the code in spring.factories is:
org.springframework.cloud.gateway.server.mvc.handler.HandlerSupplier=\
test.HandlerFunctions.MyHandlerSupplier
Custom handler code:
public abstract class HandlerFunctions {
public static HandlerFunction<ServerResponse> dubbo() {
return new DubboHandler();
}
public static class MyHandlerSupplier implements HandlerSupplier {
@Override
public Collection<Method> get() {
return Arrays.asList(HandlerFunctions.class.getMethods());
}
}
}
public class DubboHandler implements HandlerFunction<ServerResponse> {
@Override
public ServerResponse handle(@Nonnull ServerRequest request) {
try {
final JSONObject result = callDubboRPC(request);
return ServerResponse.ok().body(result);
} catch (Exception e) {
log.error("forward to rpc failed.", e);
return ServerResponse.status(BAD_GATEWAY).body(new Result<>(HTTP_FORWARD_DUBBO_ERROR));
}
}
}
The routing configuration is similar to the following (excluding the rate-limiting part):
spring:
cloud:
gateway:
mvc:
routes:
- id: im_route1
uri: dubbo://dubboserviceaddress
predicates:
- Path=/calltodubbo
- Method=POST
from spring-cloud-gateway.
Related Issues (20)
- Field routesToCache inner class AdaptCachedBodyGlobalFilter maybe should be modified
- Race condition deletes routes from Gateway when invoking /actuator/gateway/refresh for a subset of routes
- Server Side event Responses from an server behind Spring-clod-gateway-mvc HOT 1
- Gateway gives error while reading response from GRPC requests "ResponseFacade cannot be cast to class HttpServerResponse"
- Spring Cloud Gateway MVC: Request headers intermittently dropped.
- How can I configure different RedisRateLimiter to apply to different routes? HOT 1
- [SpringCloudGateway]: Netty HttpClient failed to connect with SSLHandshakeException after establishing HTTPS connection with endpoint HOT 13
- LEAK: ByteBuf.release() was not called before it's garbage-collected. HOT 1
- ProxyExchange function for pass-through forwarding of HTTP methods HOT 4
- GatewayMetricsFilter should have Ordered.HIGHEST_PRECEDENCE
- Max Header Size above 8KB seems in-configurable
- is there any plans to support Token Exchange? maybe An TokenExchangeGatewayFilterFactory or something else
- application run failed while built with native-image
- Spring cloud gateway MVC fails when adding a custom filter using yaml annotations HOT 4
- Request for SCG Team's suggestions- Using custom thread pool for SCG layer processing
- Property use-insecure-trust-manager not working on spring cloud gateway MVC HOT 1
- JsonToGrpc Filter doesn't work without jackson-dataformats-binary dependency
- Declarative Gateway Filter Factory for MVC HOT 1
- RemoveRequestParameterGatewayFilterFactory not support RFC 3986
- interface level registration and parameter validity HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-cloud-gateway.