Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
HttpComponents Client Source Code Files
HttpComponents Client Source Code Files are provided in the source package file, httpcomponents-client-5.2-src.zip.
You can download httpcomponents-client-5.2-src.zip as described in the previous tutorial and go to the "httpclient5/src" sub-folder to view Source Code files.
You can also browse HttpComponents Client Source Code below:
✍: FYIcenter.com
⏎ org/apache/hc/client5/http/impl/async/H2AsyncClientProtocolStarter.java
/* * ==================================================================== * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.hc.client5.http.impl.async; import java.io.IOException; import java.util.List; import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.HttpConnection; import org.apache.hc.core5.http.config.CharCodingConfig; import org.apache.hc.core5.http.nio.AsyncPushConsumer; import org.apache.hc.core5.http.nio.HandlerFactory; import org.apache.hc.core5.http.protocol.HttpProcessor; import org.apache.hc.core5.http2.config.H2Config; import org.apache.hc.core5.http2.frame.FramePrinter; import org.apache.hc.core5.http2.frame.RawFrame; import org.apache.hc.core5.http2.impl.nio.ClientH2PrefaceHandler; import org.apache.hc.core5.http2.impl.nio.ClientH2StreamMultiplexerFactory; import org.apache.hc.core5.http2.impl.nio.H2StreamListener; import org.apache.hc.core5.reactor.IOEventHandler; import org.apache.hc.core5.reactor.IOEventHandlerFactory; import org.apache.hc.core5.reactor.ProtocolIOSession; import org.apache.hc.core5.util.Args; import org.slf4j.Logger; import org.slf4j.LoggerFactory; class H2AsyncClientProtocolStarter implements IOEventHandlerFactory { private static final Logger HEADER_LOG = LoggerFactory.getLogger("org.apache.hc.client5.http.headers"); private static final Logger FRAME_LOG = LoggerFactory.getLogger("org.apache.hc.client5.http2.frame"); private static final Logger FRAME_PAYLOAD_LOG = LoggerFactory.getLogger("org.apache.hc.client5.http2.frame.payload"); private static final Logger FLOW_CTRL_LOG = LoggerFactory.getLogger("org.apache.hc.client5.http2.flow"); private final HttpProcessor httpProcessor; private final HandlerFactory<AsyncPushConsumer> exchangeHandlerFactory; private final H2Config h2Config; private final CharCodingConfig charCodingConfig; H2AsyncClientProtocolStarter( final HttpProcessor httpProcessor, final HandlerFactory<AsyncPushConsumer> exchangeHandlerFactory, final H2Config h2Config, final CharCodingConfig charCodingConfig) { this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor"); this.exchangeHandlerFactory = exchangeHandlerFactory; this.h2Config = h2Config != null ? h2Config : H2Config.DEFAULT; this.charCodingConfig = charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT; } @Override public IOEventHandler createHandler(final ProtocolIOSession ioSession, final Object attachment) { if (HEADER_LOG.isDebugEnabled() || FRAME_LOG.isDebugEnabled() || FRAME_PAYLOAD_LOG.isDebugEnabled() || FLOW_CTRL_LOG.isDebugEnabled()) { final String id = ioSession.getId(); final ClientH2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientH2StreamMultiplexerFactory( httpProcessor, exchangeHandlerFactory, h2Config, charCodingConfig, new H2StreamListener() { final FramePrinter framePrinter = new FramePrinter(); private void logFrameInfo(final String prefix, final RawFrame frame) { try { final LogAppendable logAppendable = new LogAppendable(FRAME_LOG, prefix); framePrinter.printFrameInfo(frame, logAppendable); logAppendable.flush(); } catch (final IOException ignore) { } } private void logFramePayload(final String prefix, final RawFrame frame) { try { final LogAppendable logAppendable = new LogAppendable(FRAME_PAYLOAD_LOG, prefix); framePrinter.printPayload(frame, logAppendable); logAppendable.flush(); } catch (final IOException ignore) { } } private void logFlowControl(final String prefix, final int streamId, final int delta, final int actualSize) { FLOW_CTRL_LOG.debug("{} stream {} flow control {} -> {}", prefix, streamId, delta, actualSize); } @Override public void onHeaderInput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) { if (HEADER_LOG.isDebugEnabled()) { for (int i = 0; i < headers.size(); i++) { HEADER_LOG.debug("{} << {}", id, headers.get(i)); } } } @Override public void onHeaderOutput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) { if (HEADER_LOG.isDebugEnabled()) { for (int i = 0; i < headers.size(); i++) { HEADER_LOG.debug("{} >> {}", id, headers.get(i)); } } } @Override public void onFrameInput(final HttpConnection connection, final int streamId, final RawFrame frame) { if (FRAME_LOG.isDebugEnabled()) { logFrameInfo(id + " <<", frame); } if (FRAME_PAYLOAD_LOG.isDebugEnabled()) { logFramePayload(id + " <<", frame); } } @Override public void onFrameOutput(final HttpConnection connection, final int streamId, final RawFrame frame) { if (FRAME_LOG.isDebugEnabled()) { logFrameInfo(id + " >>", frame); } if (FRAME_PAYLOAD_LOG.isDebugEnabled()) { logFramePayload(id + " >>", frame); } } @Override public void onInputFlowControl(final HttpConnection connection, final int streamId, final int delta, final int actualSize) { if (FLOW_CTRL_LOG.isDebugEnabled()) { logFlowControl(id + " <<", streamId, delta, actualSize); } } @Override public void onOutputFlowControl(final HttpConnection connection, final int streamId, final int delta, final int actualSize) { if (FLOW_CTRL_LOG.isDebugEnabled()) { logFlowControl(id + " >>", streamId, delta, actualSize); } } }); return new ClientH2PrefaceHandler(ioSession, http2StreamHandlerFactory, false); } final ClientH2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientH2StreamMultiplexerFactory( httpProcessor, exchangeHandlerFactory, h2Config, charCodingConfig, null); return new ClientH2PrefaceHandler(ioSession, http2StreamHandlerFactory, false); } }
⏎ org/apache/hc/client5/http/impl/async/H2AsyncClientProtocolStarter.java
Or download all them as a single archive file:
File name: httpclient5-5.2-fyi.zip File size: 625318 bytes Release date: 2022-11-10 Download
⇒ Download and Install HttpComponents Core Binary Package
⇐ Download and Install HttpComponents Client Source Package
2023-03-26, 23298👍, 1💬
Popular Posts:
Commons Pool provides an Object-pooling API, with three major aspects: 1. A generic object pool inte...
What Is mail.jar of JavaMail 1.4.2? I got the JAR file from javamail-1.4.2.zip. mail.jar in javamail...
Apache Commons Codec library provides implementations of common encoders and decoders such as Base64...
What is the jaxp\SourceValidator.jav aprovided in the Apache Xerces package? I have Apache Xerces 2....
commons-io-1.4.jar is the JAR file for Commons IO 1.4, which is a library of utilities to assist wit...