Java gRPC-web in-process proxy does not support java_package
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 802
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 5
Description
With the following proto file the connector fails to proxy the request:
```protobuf
syntax = "proto3";
package Package;
option java_package = "com.foo.bar";
service Service {
rpc Method (Request) returns (Reply) {}
}
```
The problem is that grpc-web calls "Package.Service/Method", and "Package.Service" is passed to `Class.forName` here:
https://github.com/grpc/grpc-web/blob/4a4923f92895126ddb716067a753d87b7ee98225/src/connector/src/main/java/io/grpcweb/RequestHandler.java#L119
I think this would work in case `java_package` is not set, in that case Java package would be just "Package". Related to this, `Class.forName` requires the fully qualified name, that is `com.foo.bar.ServiceGrpc` in this case. I think Guava has some means to fetch all classes, not sure how expensive that is.
I can prepare a PR, only need some guidance on what would be a proper fix.
Contributor guide
Assessment
This issue has not been assessed yet.