oxsean commented on code in PR #14073:
URL: https://github.com/apache/dubbo/pull/14073#discussion_r1576516651
##########
dubbo-plugin/dubbo-rest-spring/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/support/spring/SpringMvcRequestMappingResolver.java:
##########
@@ -104,4 +113,31 @@ private Builder builder(AnnotationMeta<?> requestMapping,
AnnotationMeta<?> resp
.consume(requestMapping.getStringArray("consumes"))
.produce(requestMapping.getStringArray("produces"));
}
+
+ private CorsMeta createCorsMeta(AnnotationMeta<?> crossOrigin) {
+ CorsMeta meta = new CorsMeta();
+ if (crossOrigin == null) {
+ return meta;
+ }
+ String[] allowedHeaders = crossOrigin.getStringArray("allowedHeaders");
+ meta.setAllowedHeaders(allowedHeaders != null ?
Arrays.asList(allowedHeaders) : Collections.emptyList());
+ String[] methods = crossOrigin.getStringArray("methods");
+ meta.setAllowedMethods(methods != null ? Arrays.asList(methods) :
Collections.emptyList());
+ String[] origins = crossOrigin.getStringArray("origins");
+ meta.setAllowedOrigins(origins != null ? Arrays.asList(origins) :
Collections.emptyList());
+ String[] exposedHeaders = crossOrigin.getStringArray("exposedHeaders");
+ meta.setExposedHeaders(exposedHeaders != null ?
Arrays.asList(exposedHeaders) : Collections.emptyList());
+ String maxAge = crossOrigin.getString("maxAge");
+ meta.setMaxAge(maxAge != null ? Long.valueOf(maxAge) : null);
+ String allowCredentials = crossOrigin.getString("allowCredentials");
+ meta.setAllowCredentials(allowCredentials != null ?
Boolean.valueOf(allowCredentials) : null);
+ // Because allowPrivateNetwork does not exist in some spring versions,
we need to catch the exception
+ try {
+ String allowPrivateNetwork =
crossOrigin.getString("allowPrivateNetwork");
Review Comment:
As a service framework, I don’t think we need to support this. We just need
the basic capabilities.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]