Skip to content

servlet: introduce ServletServerBuilder.buildServlet() #10921

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

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

panchenko
Copy link
Contributor

I am trying to use gRPC in the existing Spring Boot application, servlets are registered programmatically there.
The code is supposed to look like the following:

@Bean
public ServletRegistrationBean<GrpcServlet> myServiceServlet(MyServiceImpl serviceImpl) {
    GrpcServlet servlet = new ServletServerBuilder()
            .addService(serviceImpl)
            .intercept(TransmitStatusRuntimeExceptionInterceptor.instance())
            .buildServlet();
    return new ServletRegistrationBean<>(servlet, "/" + MyServiceGrpc.SERVICE_NAME + "/*");
}

Copy link

linux-foundation-easycla bot commented Feb 16, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, in this specific case you are wanting an interceptor. You could do that "manually" with ServerInterceptors.intercept(), but I don't see a reason why things were limited to only build the adapter from the builder. So this seems beneficial in general.

@ejona86 ejona86 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 16, 2024
@ejona86 ejona86 requested a review from larry-safran February 16, 2024 17:27
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 16, 2024
@larry-safran larry-safran added the kokoro:force-run Add this label to a PR to tell Kokoro to re-run all tests. Not generally necessary label Feb 16, 2024
@grpc-kokoro grpc-kokoro removed the kokoro:force-run Add this label to a PR to tell Kokoro to re-run all tests. Not generally necessary label Feb 16, 2024
@ejona86 ejona86 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 16, 2024
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Feb 16, 2024
@ejona86 ejona86 merged commit 257d1c2 into grpc:master Feb 16, 2024
@ejona86
Copy link
Member

ejona86 commented Feb 16, 2024

Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants