English 中文(简体)
如何配置喷气机倾听多港口的声音
原标题:how to configure jetty to listen to multiple ports

我只想召集喷气机聆听一个以上的港口。 我不想有多个例子或多个网吧,只需要一个喷气机、一个网吧,而是听说两个或两个以上的港口。

违约方式不支持多个条目:

<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>

感谢你的帮助!

最佳回答

在您的喷气机中,添加了一个新的连接器:

<!-- 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 etcjetty.xml

你们应该做些什么。

问题回答

如果使用喷气管,你就可以在 Java法中开辟多个港口:

Server server = new Server();
Connector c1 = new SelectChannelConnector();
c1.setPort(8080);
Connector c2 = new SelectChannelConnector();
c2.setPort(8081);
/* ... even more ports ... */
Connector[] ports = {c1, c2 /* ... */};
server.setConnectors(ports);




相关问题
Possible to sandbox Python configuration file?

I m thinking of implementing a configuration file written in Python syntax, not unlike what Django does. While I ve seen one or two SO questions about the merits of using executable code in ...

How to validate Java logging properties files?

I have a basic facility for allowing users to remotely apply changes to the logging files in my application. Some logs are configured using java.util.logging properties files, and some are configured ...

Where should I put this configuration setting?

I m designing a fairly small web application which will run on a Sun application server (v9.1). It only has a few pages, no database of its own, and will retrieve/update data via web services. There s ...

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

Dependency bundle (jar-files/sources/API docs) in Eclipse

I m developing various in-house extensions for JIRA, the issue tracker we use. So far I worked with Netbeans and everything worked like a charm. However, now I need to switch to Eclipse and I m ...

热门标签