如何配置jetty来侦听多个端口(how to configure jetty to listen to multiple ports)
我只是想配置jetty来监听多个端口。 我不想要多个实例,也不需要多个webapps,只需一个jetty,一个webapp,但是可以监听2个或多个端口。
默认方式不支持多个条目:
<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>感谢您的帮助!
I just want to configure jetty to listen to more than one port. I don't want multiple instances nor multiple webapps, just one jetty, one webapp, but listening to 2 or more ports.
The default way does not support multiple entries:
<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>Thank you for your help!
最满意答案
在您的jetty.xml文件中,添加一个新的连接器:
<!-- original connector on port 8080 --> <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> <!-- new connector on port 8081 --> <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="8081"/></Set> <Set name="maxIdleTime">300000</Set> <Set name="Acceptors">2</Set> <Set name="statsOn">false</Set> <Set name="lowResourcesConnections">20000</Set> <Set name="lowResourcesMaxIdleTime">5000</Set> </New> </Arg> </Call>然后开始码头
java -jar start.jar etc\jetty.xml应该做你想做的。
In your jetty.xml file, add a new connector:
<!-- original connector on port 8080 --> <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> <!-- new connector on port 8081 --> <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="8081"/></Set> <Set name="maxIdleTime">300000</Set> <Set name="Acceptors">2</Set> <Set name="statsOn">false</Set> <Set name="lowResourcesConnections">20000</Set> <Set name="lowResourcesMaxIdleTime">5000</Set> </New> </Arg> </Call>Then start jetty
java -jar start.jar etc\jetty.xmlShould do what you want.
更多推荐
jetty,port,default,multiple,webapp,电脑培训,计算机培训,IT培训"/> <meta name=
发布评论