Jetty的工作参数
Jetty加载参数的优先级:
- 命令行。
$JETTY_BASE
下的文件。- 使用
--include-jetty-dir
指定的目录下的文件。 $JETTY_HOME
下的文件。
查看当前的配置参数,执行如下命令:
java -jar $JETTY_HOME/start.jar --list-config
命令的输出如下:
Enabled Modules:
----------------
1) resources transitive provider of resources for logging-jetty
2) logging/slf4j transitive provider of logging/slf4j for logging-jetty
dynamic dependency of logging-jetty
3) logging-jetty transitive provider of logging for threadpool
transitive provider of logging for bytebufferpool
transitive provider of logging for server
4) bytebufferpool transitive provider of bytebufferpool for server
ini template available with --add-modules=bytebufferpool
5) threadpool transitive provider of threadpool for server
ini template available with --add-modules=threadpool
6) server ${jetty.base}/start.d/server.ini
7) http ${jetty.base}/start.d/http.ini
JVM Version & Properties:
-------------------------
java.home = /home/jackie/software/jdk-21.0.2
java.vm.vendor = Oracle Corporation
java.vm.version = 21.0.2+13-LTS-58
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.info = mixed mode, sharing
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 21.0.2+13-LTS-58
java.io.tmpdir = /tmp
user.dir = /home/jackie/workspace/jetty_run
user.language = en
user.country = US
Jetty Version & Properties:
---------------------------
jetty.version = 12.0.6
jetty.tag.version = jetty-12.0.6
jetty.build = 78ab6e6ba163f89cdd97f2ae0283fbb5e371cfaf
jetty.home = /home/jackie/software/jetty-home-12.0.6
jetty.base = /home/jackie/workspace/jetty_run
Config Search Order:
--------------------
<command-line>
${jetty.base} -> /home/jackie/workspace/jetty_run
${jetty.home} -> /home/jackie/software/jetty-home-12.0.6
System Properties:
------------------
(no system properties specified)
Properties: Jetty
-----------------
java.version = 21.0.2
java.version.major = 21
java.version.micro = 2
java.version.minor = 0
java.version.platform = 21
jetty.base = /home/jackie/workspace/jetty_run
jetty.base.uri = file:///home/jackie/workspace/jetty_run
jetty.home = /home/jackie/software/jetty-home-12.0.6
jetty.home.uri = file:///home/jackie/software/jetty-home-12.0.6
jetty.webapp.addServerClasses = org.eclipse.jetty.logging.,${jetty.home.uri}/lib/logging/,org.slf4j.
runtime.feature.alpn = true
slf4j.version = 2.0.9
Classpath: Jetty
----------------
Version Information on 8 entries in the classpath.
Note: order presented here is how they would appear on the classpath.
changes to the --module=name command line options will be reflected here.
0: (dir) | ${jetty.base}/resources
1: 2.0.9 | ${jetty.home}/lib/logging/slf4j-api-2.0.9.jar
2: 12.0.6 | ${jetty.home}/lib/logging/jetty-slf4j-impl-12.0.6.jar
3: 12.0.6 | ${jetty.home}/lib/jetty-http-12.0.6.jar
4: 12.0.6 | ${jetty.home}/lib/jetty-server-12.0.6.jar
5: 12.0.6 | ${jetty.home}/lib/jetty-xml-12.0.6.jar
6: 12.0.6 | ${jetty.home}/lib/jetty-util-12.0.6.jar
7: 12.0.6 | ${jetty.home}/lib/jetty-io-12.0.6.jar
Active XMLs: Jetty
------------------
${jetty.home}/etc/jetty-bytebufferpool.xml
${jetty.home}/etc/jetty-threadpool.xml
${jetty.home}/etc/jetty.xml
${jetty.home}/etc/jetty-http.xml
修改http
模块的配置文件$JETTY_BASE/start.d/http.ini
,指定jetty.http.port
为8081
。
查看配置文件中的参数,执行如下命令:
cat $JETTY_BASE/start.d/http.ini|grep "jetty.http.port"
命令的输出,如下:
jetty.http.port=8081
检查Jetty加载的参数,执行如下命令:
java -jar $JETTY_HOME/start.jar --list-config|grep "jetty.http.port"
命令的输出,如下:
jetty.http.port = 8081
在命令行指定指定jetty.http.port
为9091
,检查Jetty加载的参数,执行如下命令:
java -jar $JETTY_HOME/start.jar --list-config jetty.http.port=9091|grep "jetty.http.port"
命令的输出,如下:
jetty.http.port = 9091
本文来自博客园,作者:jackieathome,转载请注明原文链接:https://www.cnblogs.com/jackieathome/p/18053125