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

Allow the gRPC extension to be used with Jetty 12 #73

Open
leeturner opened this issue May 16, 2024 · 2 comments
Open

Allow the gRPC extension to be used with Jetty 12 #73

leeturner opened this issue May 16, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@leeturner
Copy link
Collaborator

leeturner commented May 16, 2024

Proposal

At the moment, the gRPC extension is tied to the Jetty11HttpServer in the buildHttpServer method.

@Override
  public HttpServer buildHttpServer(
      Options options,
      AdminRequestHandler adminRequestHandler,
      StubRequestHandler stubRequestHandler) {
    return new Jetty11HttpServer(options, adminRequestHandler, stubRequestHandler) {
      @Override
      protected void decorateMockServiceContextBeforeConfig(
          ServletContextHandler mockServiceContext) {

        final GrpcFilter grpcFilter = new GrpcFilter(stubRequestHandler, fileDescriptors);
        final FilterHolder filterHolder = new FilterHolder(grpcFilter);
        mockServiceContext.addFilter(filterHolder, "/*", EnumSet.of(DispatcherType.REQUEST));
      }
    };
  }

This means it won't work anywhere where we need to rely on Jetty12 like the 3.x.x releases of Spring Boot. It would be nice to support both Jetty 11 and 12 like we do in WireMock core

References

https://github.com/wiremock/wiremock/tree/master/wiremock-jetty12
https://wiremock-community.slack.com/archives/C04HHJ7F20G/p1715613366000319

@leeturner leeturner added the enhancement New feature or request label May 16, 2024
@marcinex7
Copy link

Is there any follow-up on this? Any plans to enable gRPC on Jetty 12?

@HuppiFluppi
Copy link

Also ran into this.
Wiremock has a jetty12 version, the grpc extension unfortunately does not.
This makes it very hard to use it in setups like with SpringBoot 3.x

For reference, i can actually run the combination of org.wiremock:wiremock-jetty12:3.9.1 and org.wiremock:wiremock-grpc-extension:0.8.0, but at runtime the call fails for mssing/invalid content type:

UNKNOWN: HTTP status code 200
invalid content-type: null
headers: Metadata(:status=200,grpc-status-name=OK,matched-stub-id=8a8efae9-1239-4f20-9fde-bd785dcf05d2)
DATA-----------------------------
{}
DATA-----------------------------

grpc: 1.66
protobuf: 4.28


The standalone versions of wiremock and the grpc-extension can be used, but this poses a new problem. The java style creation of stubs wont work with a mixed setup.

message() expects an wiremock.com.google.protobuf.MessageOrBuilder but the messages created for use in the project implement com.google.protobuf.MessageOrBuilder

I resorted to use standalone and json stubbing but it clearly is not an ideal solution.

Would be happy if this can be fixed in next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants