Adding SSLSelectChannelSelector for jetty

This section explains how to add SSL SelectChannelSelector in Adeptia Jetty. 

Steps to add SSLSelectChannelSelector in jetty

  1. Go to /ServerKernel/etc/jetty folder and open the Jetty.xml file.
  2. 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>
  3. Define the following details within the new sslContextFactory, which you have defined:
    1. Path and Name of the keystore file.
    2. Keystore password
    3. Key Manager password
    4. Path and Name of the truststore.
    5. Truststore password
  4. 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>
  5. Enter the following details within the new SslSelectChannelConnector, which you have added.

    1. Define the name of the sslContextFactory, which you have added.

    2. Enter the name of SslSelectChannelConnector.

    3. Enter the port at which you want to publish the Web Service.

    4. 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.

  6. Save the file and restart the kernel and WebRunner.