On Thu, Apr 9, 2020 at 7:54 PM Filip Hanik <fha...@pivotal.io> wrote:

> Thanks Remy,
>
> On Wed, Apr 8, 2020 at 8:48 AM Rémy Maucherat <r...@apache.org> wrote:
>
>>
>>>
>> If we want to improve on the Connector situation regarding duplication
>> and reflection abuse, the only solution is to expose the different objects
>> involved.
>>
>> Since an example is usually better, I'll give one using server.xml.
>>
>> A typical Connector with TLS is at the moment:
>>     <Connector port="8443"
>> protocol="org.apache.coyote.http11.Http11NioProtocol"
>>                SSLEnabled="true" scheme="https" secure="true"
>>                socket.directBuffer="true" socket.directSslBuffer="true"
>> maxHeaderCount="10"
>>
>>  
>> sslImplementationName="org.apache.tomcat.util.net.openssl.OpenSSLImplementation">
>>         <SSLHostConfig honorCipherOrder="false">
>>             <Certificate
>> certificateKeyFile="${catalina.home}/conf/key.pem"
>>                          certificateFile="${catalina.home}/conf/cert.pem"
>>                          type="RSA" />
>>         </SSLHostConfig>
>>         <UpgradeProtocol
>> className="org.apache.coyote.http2.Http2Protocol" />
>>     </Connector>
>>
>> And it would become:
>>     <Connector scheme="https" secure="true">
>>         <Endpoint className="org.apache.tomcat.util.net.NioEndpoint"
>> port="8443" SSLEnabled="true"
>>
>>  
>> sslImplementationName="org.apache.tomcat.util.net.openssl.OpenSSLImplementation">
>>           <SocketProperties directBuffer="true" directSslBuffer="true" />
>>           <SSLHostConfig honorCipherOrder="false">
>>             <Certificate
>> certificateKeyFile="${catalina.home}/conf/key.pem"
>>                          certificateFile="${catalina.home}/conf/cert.pem"
>>                          type="RSA" />
>>           </SSLHostConfig>
>>         </Endpoint>
>>         <Protocol className="org.apache.coyote.http11.Http11Protocol"
>> maxHeaderCount="10" />
>>         <UpgradeProtocol
>> className="org.apache.coyote.http2.Http2Protocol" />
>>     </Connector>
>>
>
> This configuration gives the impression that the Endpoint is a child of
> the Connector.
> But the Connector truly only needs the ProtocolHandler interface to
> function. The injected object would then be better to an instance of a
> ProtocolHandler
>
> The XML can of course be configured to instantiate and inject the
> ProtocolHandler handler directly into the Connector
> In this setting, it doesn't make sense to have any properties on the
> Connector, since the Connector receives the protocol handler already
> configured.
>
> <Connector scheme="https" secure="true">
>     <Protocol className="org.apache.coyote.http11.Http11Protocol"
> maxHeaderCount="10" >
>       <Endpoint className="org.apache.tomcat.util.net.NioEndpoint"
> port="8443" SSLEnabled="true"
>
>  
> sslImplementationName="org.apache.tomcat.util.net.openssl.OpenSSLImplementation">
>           <SocketProperties directBuffer="true" directSslBuffer="true" />
>           <SSLHostConfig honorCipherOrder="false">
>             <Certificate certificateKeyFile="${catalina.home}/conf/key.pem"
>                          certificateFile="${catalina.home}/conf/cert.pem"
>                          type="RSA" />
>           </SSLHostConfig>
>           </Endpoint>
>           <UpgradeProtocol
> className="org.apache.coyote.http2.Http2Protocol" />
>        <Protocol
>     </Connector>
>

Either way, I experimented a bit and it's not doable. Too many intrusive
changes and impossibility to be compatible.

Rémy


>
> Filip
>
>
>> t
>> Each individual object is now created by the digester using normal bean
>> rules, and I suppose it will become wired up by the Connector during init.
>> Embedded can then do the same as the digester instead of having to go
>> through the Connector object.
>>
>> Rémy
>>
>>
>>>
>>> Mark
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>>>
>>>

Reply via email to