![]() All the changes outside libs.versions.toml and examples were because of ErrorProne. It didn't actually find anything to fix; signal vs noise has gotten pretty bad with the newer checks. Status was changed for ErrorProne's SuperCallToObjectMethod. With the old code it didn't notice the trivial implementation. The fail-for-test code wasn't used, so it was easiest to just remove it. Some of the libs had their versions inlined; now that we have :checkForUpdates it isn't much of a risk for versions to diverge when there's only a few artifacts sharing a version. If we need 4+ artifacts to have the same version, then it makes sense to still use a shared version. Dependencies not upgraded: google-auth-libray, mockito, netty, cronet |
||
---|---|---|
.. | ||
src/main | ||
README.md | ||
build.gradle | ||
settings.gradle |
README.md
Hello World Example using Servlets
This example uses Java Servlets instead of Netty for the gRPC server. This example requires grpc-java
and protoc-gen-grpc-java
to already be built. You are strongly encouraged to check out a git release
tag, since these builds will already be available.
git checkout v<major>.<minor>.<patch>
Otherwise, you must follow COMPILING.
To build the example,
-
Install gRPC Java library SNAPSHOT locally, including code generation plugin (Only need this step for non-released versions, e.g. master HEAD).
-
In this directory, build the war file
$ ../gradlew war
To run this, deploy the war, now found in build/libs/example-servlet.war
to your choice of servlet
container. Note that this container must support the Servlet 4.0 spec, for this particular example must
use javax.servlet
packages instead of the more modern jakarta.servlet
, though there is a grpc-servlet-jakarta
artifact that can be used for Jakarta support. Be sure to enable http/2 support in the servlet container,
or clients will not be able to connect.
To test that this is working properly, build the HelloWorldClient example and direct it to connect to your http/2 server. From the parent directory:
- Build the executables:
$ ../gradlew installDist
- Run the client app, specifying the name to say hello to and the server's address:
$ ./build/install/examples/bin/hello-world-client World localhost:8080