Phase 1 of converting to new Headers mechanism for side-channel.
Introduces Header and uses it for propagating text-only header values over existing transports
Leaves Context & wire format otherwise unchanged
Next phases
- Remove context from interfaces
- Switch the wire format (ESF needs to be done in near lock-step)
Interface changes are relatively light
Headers class is functional but not optimal
All serialization is done as string until transports expose interface for binary headers
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=75050265
diff --git a/core/src/main/java/com/google/net/stubby/http2/netty/Http2Codec.java b/core/src/main/java/com/google/net/stubby/http2/netty/Http2Codec.java
index 6dc46a8..873a880 100644
--- a/core/src/main/java/com/google/net/stubby/http2/netty/Http2Codec.java
+++ b/core/src/main/java/com/google/net/stubby/http2/netty/Http2Codec.java
@@ -1,6 +1,6 @@
package com.google.net.stubby.http2.netty;
-import com.google.common.collect.ImmutableMap;
+import com.google.net.stubby.Metadata;
import com.google.net.stubby.NoOpRequest;
import com.google.net.stubby.Operation;
import com.google.net.stubby.Operation.Phase;
@@ -23,8 +23,6 @@
import io.netty.handler.codec.http2.Http2Headers;
import io.netty.handler.codec.http2.Http2Settings;
-import java.util.Map;
-
/**
* Codec used by clients and servers to interpret HTTP2 frames in the context of an ongoing
* request-response dialog
@@ -212,12 +210,9 @@
if (operationName == null) {
return null;
}
- ImmutableMap.Builder<String, String> headerMap = ImmutableMap.builder();
- for (Map.Entry<String, String> header : headers) {
- headerMap.put(header);
- }
+ Metadata.Headers grpcHeaders = new Metadata.Headers(headers);
// Create the operation and bind a HTTP2 response operation
- Request op = session.startRequest(operationName, headerMap.build(),
+ Request op = session.startRequest(operationName, grpcHeaders,
createResponse(new Http2Writer(ctx), streamId));
if (op == null) {
return null;