Skip to content

Commit cbaaf25

Browse files
committed
Trim down interfaces and cleanup docs
1 parent 3e9c80e commit cbaaf25

57 files changed

Lines changed: 142 additions & 322 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

aws/client/aws-client-awsjson/src/main/java/software/amazon/smithy/java/aws/client/awsjson/AwsJsonProtocol.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public <I extends SerializableStruct, O extends SerializableStruct> HttpRequest
7979
SmithyUri endpoint
8080
) {
8181
var target = service.getName() + "." + operation.schema().id().getName();
82-
var builder = HttpRequest.create(requestFactory(context));
82+
var builder = HttpRequest.create();
8383
builder.setMethod("POST");
8484
builder.setUri(endpoint);
8585
if (operation.inputEventBuilderSupplier() != null) {

aws/client/aws-client-awsquery/src/main/java/software/amazon/smithy/java/aws/client/awsquery/AwsQueryClientProtocol.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public <I extends SerializableStruct, O extends SerializableStruct> HttpRequest
8080

8181
ByteBuffer body = serializer.finish();
8282

83-
return HttpRequest.create(requestFactory(context))
83+
return HttpRequest.create()
8484
.setMethod("POST")
8585
.setUri(endpoint)
8686
.setHeader(HeaderName.CONTENT_TYPE, CONTENT_TYPE)

aws/client/aws-client-awsquery/src/main/java/software/amazon/smithy/java/aws/client/awsquery/Ec2QueryClientProtocol.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public <I extends SerializableStruct, O extends SerializableStruct> HttpRequest
8080

8181
ByteBuffer body = serializer.finish();
8282

83-
return HttpRequest.create(requestFactory(context))
83+
return HttpRequest.create()
8484
.setMethod("POST")
8585
.setUri(endpoint)
8686
.setHeader(HeaderName.CONTENT_TYPE, CONTENT_TYPE)

aws/client/aws-client-restjson/src/main/java/software/amazon/smithy/java/aws/client/restjson/RestJsonClientProtocol.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ public <I extends SerializableStruct, O extends SerializableStruct> HttpRequest
7272
.shapeValue(input)
7373
.endpoint(endpoint)
7474
.omitEmptyPayload(omitEmptyPayload())
75-
.allowEmptyStructPayload(httpBinding().hasStructPayload(input.schema()))
76-
.requestFactory(requestFactory(context));
75+
.allowEmptyStructPayload(httpBinding().hasStructPayload(input.schema()));
7776

7877
if (operation.inputEventBuilderSupplier() != null) {
7978
serializer.eventEncoderFactory(getEventEncoderFactory(operation));

client/client-core/src/main/java/software/amazon/smithy/java/client/core/ClientPipeline.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@ <I extends SerializableStruct, O extends SerializableStruct> O send(ClientCall<I
118118
// 4. Interceptors: Invoke ReadBeforeSerialization.
119119
call.interceptor.readBeforeSerialization(inputHook);
120120

121-
// 4.a. Let the transport advertise per-call request-construction capabilities (e.g. a
122-
// request factory that serializes headers directly into the transport's native
123-
// representation). No-op for transports that do not opt in.
124-
transport.contributeRequestFactory(call.context);
125-
126121
// 5. Serialize the input message into a protocol request message.
127122
// Use the UNRESOLVED URI of "/" for now, and resolve the actual endpoint later.
128123
RequestT request = protocol.createRequest(call.operation, input, call.context, UNRESOLVED);

client/client-core/src/main/java/software/amazon/smithy/java/client/core/ClientTransport.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,6 @@ public interface ClientTransport<RequestT, ResponseT> extends Closeable {
4848
*/
4949
MessageExchange<RequestT, ResponseT> messageExchange();
5050

51-
/**
52-
* Hook invoked once per call, before the protocol serializes the request, letting a transport
53-
* advertise per-call request-construction capabilities into the context.
54-
*
55-
* <p>A transport overrides this to publish a request factory (e.g. one that backs request
56-
* headers with the transport's own native container) so the protocol serializes directly into
57-
* the transport's representation, avoiding a translation copy at send time. The default is a
58-
* no-op, so transports that do not opt in are unaffected.
59-
*
60-
* @param context the mutable per-call context.
61-
*/
62-
default void contributeRequestFactory(Context context) {}
63-
6451
/**
6552
* {@inheritDoc}
6653
*

client/client-http-binding/src/main/java/software/amazon/smithy/java/client/http/binding/HttpBindingClientProtocol.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ public <I extends SerializableStruct, O extends SerializableStruct> HttpRequest
7272
.payloadMediaType(payloadMediaType())
7373
.shapeValue(input)
7474
.endpoint(endpoint)
75-
.omitEmptyPayload(omitEmptyPayload())
76-
.requestFactory(requestFactory(context));
75+
.omitEmptyPayload(omitEmptyPayload());
7776

7877
if (operation.inputEventBuilderSupplier() != null) {
7978
serializer.eventEncoderFactory(getEventEncoderFactory(operation));

client/client-http/src/main/java/software/amazon/smithy/java/client/http/HttpClientProtocol.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77

88
import software.amazon.smithy.java.client.core.ClientProtocol;
99
import software.amazon.smithy.java.client.core.MessageExchange;
10-
import software.amazon.smithy.java.context.Context;
1110
import software.amazon.smithy.java.endpoints.Endpoint;
1211
import software.amazon.smithy.java.http.api.HttpRequest;
13-
import software.amazon.smithy.java.http.api.HttpRequestFactory;
1412
import software.amazon.smithy.java.http.api.HttpResponse;
1513
import software.amazon.smithy.model.shapes.ShapeId;
1614

@@ -35,21 +33,6 @@ public MessageExchange<HttpRequest, HttpResponse> messageExchange() {
3533
return HttpMessageExchange.INSTANCE;
3634
}
3735

38-
/**
39-
* The transport-supplied request factory for this call, if any.
40-
*
41-
* <p>HTTP protocols use this to serialize a request directly into the transport's native
42-
* representation (e.g. headers backed by the transport's own container) instead of a generic one
43-
* the transport then copies. Returns null when no transport opted in, in which case the default
44-
* array-backed containers are used.
45-
*
46-
* @param context the per-call context.
47-
* @return the transport request factory, or null.
48-
*/
49-
protected static HttpRequestFactory requestFactory(Context context) {
50-
return context == null ? null : context.get(HttpContext.TRANSPORT_REQUEST_FACTORY);
51-
}
52-
5336
@Override
5437
public HttpRequest setServiceEndpoint(HttpRequest request, Endpoint endpoint) {
5538
var merged = request.uri().withEndpoint(endpoint.uri());

client/client-http/src/main/java/software/amazon/smithy/java/client/http/HttpContext.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import software.amazon.smithy.java.context.Context;
1010
import software.amazon.smithy.java.endpoints.EndpointResolver;
1111
import software.amazon.smithy.java.http.api.HttpHeaders;
12-
import software.amazon.smithy.java.http.api.HttpRequestFactory;
1312

1413
/**
1514
* {@link Context} keys used with HTTP-based clients.
@@ -40,14 +39,5 @@ public final class HttpContext {
4039
public static final Context.Key<Boolean> DISABLE_REQUEST_COMPRESSION =
4140
Context.key("If request compression is disabled");
4241

43-
/**
44-
* A transport-supplied factory for the request's mutable containers (headers, and in future the
45-
* body), letting an HTTP protocol serialize the request directly into the transport's native
46-
* representation. Published by a transport via {@code ClientTransport.contributeRequestFactory}
47-
* and read by the protocol's {@code createRequest}. Absent for transports that do not opt in.
48-
*/
49-
public static final Context.Key<HttpRequestFactory> TRANSPORT_REQUEST_FACTORY =
50-
Context.key("Transport-supplied HTTP request factory");
51-
5242
private HttpContext() {}
5343
}

client/client-rpcv2/src/main/java/software/amazon/smithy/java/client/rpcv2/AbstractRpcV2ClientProtocol.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,7 @@ public <I extends SerializableStruct, O extends SerializableStruct> HttpRequest
108108
SmithyUri endpoint
109109
) {
110110
var target = targetPathPrefix + operation.schema().id().getName();
111-
// With a transport-supplied factory, build the request directly in the transport's native
112-
// representation; otherwise reuse the cached template (unchanged behavior).
113-
var factory = requestFactory(context);
114-
ModifiableHttpRequest builder;
115-
if (factory == null) {
116-
builder = templateRequest.toModifiableCopy();
117-
} else {
118-
builder = HttpRequest.create(factory);
119-
builder.setMethod("POST");
120-
builder.addHeader(HeaderName.SMITHY_PROTOCOL, smithyProtocolValue);
121-
builder.addHeader(HeaderName.ACCEPT, payloadMediaType);
122-
}
111+
ModifiableHttpRequest builder = templateRequest.toModifiableCopy();
123112
builder.setUri(endpoint.withConcatPath(target));
124113

125114
if (operation.inputSchema().hasTrait(TraitKey.UNIT_TYPE_TRAIT)) {

0 commit comments

Comments
 (0)