This section explains how to add SSL SelectChannelSelector in Adeptia Jetty.
Steps to add SSLSelectChannelSelector in jetty
- Go to /ServerKernel/etc/jetty folder and open the Jetty.xml file.
Add an sslContextFactory within sslContextFactory definition section as shown below.
<!-- sslContextFactory definition
*To add SslContextFactory( which is used in SslSelectChannelConnector definition)
modify id of SslContextFactory as it should be different from already defined sslContextFactory.
modify KeyStore properties as per the requirement.
<New id=
"sslContextFactory2"
class
=
"org.eclipse.jetty.http.ssl.SslContextFactory"
>
<Set name=
"KeyStore"
><Property name=
"jetty.home"
default
=
"."
/>/etc/jetty/custom.keystore</Set>
<Set name=
"KeyStorePassword"
>password</Set>
<Set name=
"KeyManagerPassword"
>password</Set>
<Set name=
"TrustStore"
><Property name=
"jetty.home"
default
=
"."
/>/etc/jetty/custom1.keystore</Set>
<Set name=
"TrustStorePassword"
>password</Set>
</New>
- Define the following details within the new sslContextFactory, which you have defined:
- Path and Name of the keystore file.
- Keystore password
- Key Manager password
- Path and Name of the truststore.
- Truststore password
Now add the SslSelectChannelConnector within Connector's definition as shown below.
<!-- Connector's definition
To add SslSelectChannelConnector modify below items:
*modify id as per the declared sslContextFactory(user has to define
new
sslContextFactory
if
new
keystore
for
this
connector is required)
*Declaration (refer to the section sslContextFactory definition).
*modify connector name from HttpsConnectorB to the required name.
*modify Port value as per the requirement
<Item>
<New
class
=
"org.eclipse.jetty.server.ssl.SslSelectChannelConnector"
>
<Arg><Ref id=
"sslContextFactory2"
/></Arg>
<Set name=
"name"
>HttpsConnectorB</Set>
<Set name=
"Port"
>
7443
</Set>
<Set name=
"maxIdleTime"
>
30000
</Set>
<!—- If you will set NeedClientAuth property to
true
it means you have enabled the client authentication
for
this
connector i.e. client will be authenticated
for
the each request and
if
you set it to
false
then it means client will not be authenticated at server side. -->
<Set name=
"NeedClientAuth"
>
true
</Set>
<Set name=
"Acceptors"
>
2
</Set>
<Set name=
"AcceptQueueSize"
>
100
</Set>
</New>
</Item>
Enter the following details within the new SslSelectChannelConnector, which you have added.
Define the name of the sslContextFactory, which you have added.
Enter the name of SslSelectChannelConnector.
Enter the port at which you want to publish the Web Service.
If you want to authenticate the client, set the value of NeedClientAuth attribute to true.
If you want to publish more than one Web Service each on different ports, then you have to define SslSelectChannelConnector for each port.
Save the file and restart the kernel and WebRunner.