Jetty/winstone connector configuration in Jenkins

◇◆丶佛笑我妖孽 提交于 2020-01-15 03:33:08

问题


I am experiencing slow download times over WAN links from JENKINS. Not going into details of the problem i would like to configure Jetty apparently used by Jenkins to add the following connector:

<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
 <Set name="host"><Property name="application-host"/></Set>
 <Set name="port"><Property name="application-port"/></Set>
 <Set name="forwarded">true</Set>
 <Set name="responseBufferSize">16777216</Set>
 <Set name="responseHeaderSize">1048576</Set>
</New>

but i am not sure what is the right spot to do it. I cannot find jetty.xml file anywhere in my installation. I am using Jenkins on Windows so i guess i am just launching it using java -jar jenkins.war which is supposed to use Jetty/Winstone.

EDIT: Looks like this cannot be done by just changing configuration. At least not in SSL context: https://github.com/J-cztery/winstone/blob/master/src/java/winstone/HttpsConnectorFactory.java hardcodes creation of ServerContext.


回答1:


If you don't use a custom servlet container like Tomcat, then Jenkins uses a built-in "Jetty/Winstone" container indeed. To be more precise: Jenkins uses a wrapper around Jetty that implements the Winstone command line interface (motivation was to switch from the old Winstone to Jetty without changing the interface).

The Jetty container can be customized by adding options directly on the Jenkins command line (that is, in your Windows case, by adding them to the <arguments> tag in the jenkins.xml file.

The available options (like, --httpPort or --sessionTimeout) are documented in the Jenkins winstone repository on github.

If those options are not sufficient, then you might be able to further customize the container by modifying this section in pom.xml:

      <connectors>
        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
            <port>${port}</port>
        </connector>
      </connectors>

...or by editing the web.xml file. At least the latter can be modified without changing the war file by editing the unpacked $JENKINS_HOME/war/WEB-INF/web.xml. I didn't try either yet, though.



来源:https://stackoverflow.com/questions/38929964/jetty-winstone-connector-configuration-in-jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!