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)
- Migrate server-webmvc properties to new namespace and deprecate old
- Serve Single Page Applications as static files in Spring Cloud Gateway HOT 5
- Custom GlobalFilter will have undeterministic hehavior when the Order is the same value. HOT 3
- openfeign java.lang.NoClassDefFoundError: feign/Request$Options
- Route pointing to self can be bypassed by direct controller access
- Cors handling with spring cloudgateway mvc HOT 1
- SCG Redis ratelimiter solution has unavailable issues when redis has problems HOT 3
- How can i block"/actuator" endpoint in gateway HOT 3
- can anyone provide a spring-cloud-gateway-mvc sample? HOT 2
- LEAK: ByteBuf.release() error HOT 6
- The cache works differently if the value of local-response-cache.enabled is default false or explicitly false
- Load balance per route read timeout in spring-cloud-gateway-server-mvc HOT 1
- Ratelimiter not working with aws elasticache redis 7.1 HOT 10
- Gateway MVC ServerRequest body broken when created from another
- Required Gobalfilter type interface in Spring Cloud Gateway MVC, and instead of bean creation properties level routes configuration HOT 2
- direct memory always increases when adding custom filter to get request body size
- Spring Cloud Gateway not allowing Encoded URL paths after Update HOT 1
- Documentation Link on spring.io for 4.1.3 does not work.
- Spring Cloud Gateway MVC, order of before and after functions. HOT 6
- Unable to integrate grpc with spring cloud gateway HOT 3
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.