Jetty (Eclipse) listening on multiple IPs

1) what is the equivalent configuration in Jetty to listen on multiple IP addresses, like the Listen directive in Apache?

2) How can I configure a subdomain using a different context path?

+3
source share
1 answer

Question 1.

Assuming you are setting up a file jetty.xml, then you will have something that looks something like this:

<Call name="addConnector">
  <Arg>
    <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
      <Set name="host"><Property name="jetty.host" /></Set>
      <Set name="port"><Property name="jetty.port" default="8080"/></Set>
      <Set name="maxIdleTime">300000</Set>
      <Set name="Acceptors">2</Set>
      <Set name="statsOn">false</Set>
      <Set name="confidentialPort">8443</Set>
      <Set name="lowResourcesConnections">20000</Set>
      <Set name="lowResourcesMaxIdleTime">5000</Set>
    </New>
  </Arg>
</Call> 

You will need one connector for each IP address that you want to listen to. So, just duplicate this section as many times as you need. Then for each of them replace the line

   <Set name="host"><Property name="jetty.host" /></Set>

with

   <Set name="host">www.xxx.yyy.zzz</Set>

where www.xxx.yyy.zzz is the IP you want to listen to.

Question 2.

Cm.

+6

Source: https://habr.com/ru/post/1789840/


All Articles