-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19217 from michalszynkiewicz/grpc-header-test
Add a test for gRPC header passing, remove unused filter from rest client
- Loading branch information
Showing
6 changed files
with
166 additions
and
102 deletions.
There are no files selected for viewing
91 changes: 0 additions & 91 deletions
91
...rc/main/java/io/quarkus/rest/client/reactive/runtime/RestClientReactiveRequestFilter.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 66 additions & 7 deletions
73
...pc-plain-text-mutiny/src/main/java/io/quarkus/grpc/examples/hello/HelloWorldEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...c-plain-text-mutiny/src/main/java/io/quarkus/grpc/examples/hello/IncomingInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.quarkus.grpc.examples.hello; | ||
|
||
import static java.util.Arrays.asList; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import io.grpc.Metadata; | ||
import io.grpc.ServerCall; | ||
import io.grpc.ServerCallHandler; | ||
import io.grpc.ServerInterceptor; | ||
|
||
@ApplicationScoped | ||
public class IncomingInterceptor implements ServerInterceptor { | ||
|
||
public static final Metadata.Key<String> EXTRA_HEADER = Metadata.Key.of("my-extra-header", | ||
Metadata.ASCII_STRING_MARSHALLER); | ||
public static final Metadata.Key<String> INTERFACE_HEADER = Metadata.Key.of("my-interface-header", | ||
Metadata.ASCII_STRING_MARSHALLER); | ||
public static final Metadata.Key<String> EXTRA_BLOCKING_HEADER = Metadata.Key.of("my-blocking-header", | ||
Metadata.ASCII_STRING_MARSHALLER); | ||
|
||
private final Map<String, String> headerValues = new HashMap<>(); | ||
|
||
@Override | ||
public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> serverCall, Metadata metadata, | ||
ServerCallHandler<ReqT, RespT> serverCallHandler) { | ||
|
||
for (Metadata.Key<String> key : asList(EXTRA_HEADER, INTERFACE_HEADER, EXTRA_BLOCKING_HEADER)) { | ||
String header = metadata.get(key); | ||
if (header != null) { | ||
headerValues.put(key.name(), header); | ||
} | ||
} | ||
|
||
return serverCallHandler.startCall(serverCall, metadata); | ||
} | ||
|
||
public void clear() { | ||
headerValues.clear(); | ||
} | ||
|
||
public Map<String, String> getCollectedHeaders() { | ||
return headerValues; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters