use of org.apache.hc.core5.http.protocol.HttpCoreContext in project httpcomponents-core by apache.
the class ClientH2StreamMultiplexer method createRemotelyInitiatedStream.
@Override
H2StreamHandler createRemotelyInitiatedStream(final H2StreamChannel channel, final HttpProcessor httpProcessor, final BasicHttpConnectionMetrics connMetrics, final HandlerFactory<AsyncPushConsumer> pushHandlerFactory) throws IOException {
final HttpCoreContext context = HttpCoreContext.create();
context.setAttribute(HttpCoreContext.SSL_SESSION, getSSLSession());
context.setAttribute(HttpCoreContext.CONNECTION_ENDPOINT, getEndpointDetails());
return new ClientPushH2StreamHandler(channel, httpProcessor, connMetrics, pushHandlerFactory != null ? pushHandlerFactory : this.pushHandlerFactory, context);
}
use of org.apache.hc.core5.http.protocol.HttpCoreContext in project httpcomponents-core by apache.
the class ServerH2StreamMultiplexer method createRemotelyInitiatedStream.
@Override
H2StreamHandler createRemotelyInitiatedStream(final H2StreamChannel channel, final HttpProcessor httpProcessor, final BasicHttpConnectionMetrics connMetrics, final HandlerFactory<AsyncPushConsumer> pushHandlerFactory) throws IOException {
final HttpCoreContext context = HttpCoreContext.create();
context.setAttribute(HttpCoreContext.SSL_SESSION, getSSLSession());
context.setAttribute(HttpCoreContext.CONNECTION_ENDPOINT, getEndpointDetails());
return new ServerH2StreamHandler(channel, httpProcessor, connMetrics, exchangeHandlerFactory, context);
}
use of org.apache.hc.core5.http.protocol.HttpCoreContext in project httpcomponents-core by apache.
the class ClientHttp1StreamDuplexer method execute.
@Override
void execute(final RequestExecutionCommand executionCommand) throws HttpException, IOException {
final AsyncClientExchangeHandler exchangeHandler = executionCommand.getExchangeHandler();
final HttpCoreContext context = HttpCoreContext.adapt(executionCommand.getContext());
context.setAttribute(HttpCoreContext.SSL_SESSION, getSSLSession());
context.setAttribute(HttpCoreContext.CONNECTION_ENDPOINT, getEndpointDetails());
final ClientHttp1StreamHandler handler = new ClientHttp1StreamHandler(outputChannel, httpProcessor, http1Config, connectionReuseStrategy, exchangeHandler, context);
pipeline.add(handler);
outgoing = handler;
if (handler.isOutputReady()) {
handler.produceOutput();
}
}
use of org.apache.hc.core5.http.protocol.HttpCoreContext in project httpcomponents-core by apache.
the class TestStandardInterceptors method testRequestExpectContinueHTTP10.
@Test
public void testRequestExpectContinueHTTP10() throws Exception {
final HttpCoreContext context = HttpCoreContext.create();
context.setProtocolVersion(HttpVersion.HTTP_1_0);
final BasicClassicHttpRequest request = new BasicClassicHttpRequest(Method.POST, "/");
request.setEntity(new StringEntity("whatever", StandardCharsets.US_ASCII));
final RequestExpectContinue interceptor = new RequestExpectContinue();
interceptor.process(request, request.getEntity(), context);
final Header header = request.getFirstHeader(HttpHeaders.EXPECT);
Assertions.assertNull(header);
}
use of org.apache.hc.core5.http.protocol.HttpCoreContext in project httpcomponents-core by apache.
the class TestStandardInterceptors method testRequestExpectContinueZeroContent.
@Test
public void testRequestExpectContinueZeroContent() throws Exception {
final HttpCoreContext context = HttpCoreContext.create();
final BasicClassicHttpRequest request = new BasicClassicHttpRequest(Method.POST, "/");
request.setEntity(new StringEntity("", StandardCharsets.US_ASCII));
final RequestExpectContinue interceptor = new RequestExpectContinue();
interceptor.process(request, request.getEntity(), context);
final Header header = request.getFirstHeader(HttpHeaders.EXPECT);
Assertions.assertNull(header);
}
Aggregations