Jetty使用入门

Jetty使用入门

社区当前推荐开发者使用Jetty 12.X版本。

依据End of Community Support for Jetty 9.x - June 2022,社区对Jetty 9.x的支持,已在2022年6月1日停止。
依据End of Community Support for Jetty 10 / Jetty 11 - January 2024,社区对Jetty 10.X、Jetty 11.X的支持,已在2024年1月停止。

官方资料

  • jetty
  • 官方文档主页
    • jetty-9 The Definitive Reference
    • jetty-12 Operations Guide
    • jetty-12 Programming Guide
    • jetty-11 Operations Guide
    • jetty-11 Programming Guide
    • jetty-10 Operations Guide
    • jetty-10 Programming Guide
  • jetty.project

参考资料

  • ubuntu 安装jdk21开发环境

使用入门

安装JDK

使用JDK21,安装过程的命令如下:


cd ~/software
mkdir testwget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz
tar vxfz jdk-21_linux-x64_bin.tar.gz -C test
mv test/jdk-21.0.2 .
ln -s jdk-21.0.2 jdk21rm -rf testexport JAVA_HOME=~/software/jdk21
export PATH=$JAVA_HOME/bin:$PATH

查看版本,命令如下:

java --version

输出样例,如下:

java 21.0.2 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 21.0.2+13-LTS-58)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.2+13-LTS-58, mixed mode, sharing)

查看Jetty的版本

执行如下命令:

java -jar $JETTY_HOME/start.jar --version

命令的输出,如下:

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}/resources1:                    2.0.9 | ${jetty.home}/lib/logging/slf4j-api-2.0.9.jar2:                   12.0.6 | ${jetty.home}/lib/logging/jetty-slf4j-impl-12.0.6.jar3:                   12.0.6 | ${jetty.home}/lib/jetty-http-12.0.6.jar4:                   12.0.6 | ${jetty.home}/lib/jetty-server-12.0.6.jar5:                   12.0.6 | ${jetty.home}/lib/jetty-xml-12.0.6.jar6:                   12.0.6 | ${jetty.home}/lib/jetty-util-12.0.6.jar7:                   12.0.6 | ${jetty.home}/lib/jetty-io-12.0.6.jar

创建Jetty的环境变量

export JETTY_BASE=~/workspace/jetty_run
mkdir -p $JETTY_BASEexport JETTY_HOME=~/software/jetty-home-12.0.6
mkdir -p $JETTY_HOME

JETTY_HOME指向jetty软件包解压的路径。
JETTY_BASE指向应用的路径。

列出指定模块

比如指定列出connector的模块,命令样例如下:

java -jar $JETTY_HOME/start.jar --list-modules=connector

输出样例

Modules [connector]:
====================connector modules:
------------------acceptratelimit - Enables a server-wide accept rate limit.connectionlimit - Enables a server-wide connection limit.http - Enables a clear-text HTTP connector.http-forwarded - Enables processing of the "Forwarded" HTTP header (and its predecessors "X-Forwarded-*" HTTP headers).http2 - Enables the support for the secure HTTP/2 protocol.http2c - Enables the support for the clear-text HTTP/2 protocol.http3 - Enables experimental support for the HTTP/3 protocol.https - Adds HTTPS protocol support to the TLS(SSL) Connector.inetaccess - Enables the InetAccessHandler.
proxy-protocol-ssl - Enables the Proxy Protocol on the TLS(SSL) Connector.ssl-reload - Enables the KeyStore to be reloaded when the KeyStore file changes.unixdomain-http - Enables support for clear-text HTTP/1.1 over Java 16 Unix-Domain server sockets.

列出全部模块

命令样例如下:

java -jar $JETTY_HOME/start.jar --list-modules=*

命令的输出如下:

Modules [*]:
============acceptratelimit - Enables a server-wide accept rate limit.alpn-java - Provides the ALPN implementation based on the Java APIs.bytebufferpool - Configures the ByteBufferPool used by ServerConnectors.bytebufferpool-quadratic - Configures the ByteBufferPool used by ServerConnectors.client - Adds the Jetty HTTP client to the server classpath.connectionlimit - Enables a server-wide connection limit.conscrypt - Installs the Conscrypt JSSE provider.console-capture - Redirects the JVM console stderr and stdout to a rolling log file.core-demos - A meta module to enable all core demo modules.core-deploy - Enables application based on core handlers deployed from the $JETTY_BASE/webapps/ directory.cross-origin - Enables CrossOriginHandler to support the CORS protocol and protect from cross-site request forgery (CSRF) attacks.debug - Enables the DebugListener.decorate - Jetty setup to support Decoration of Listeners, Filters and Servlets within a deployed webapp.delay-until-content - Applies DelayedHandler to entire server.demo-handler - Demo Handlerdemo-jaas - Setup for jaas demos.demo-moved-context - Demonstrate a Moved Context Handler setup in XMLdemo-realm - Configure a demo authentication realm.demo-root - Demo root context.demos - A meta module to enable all demo modules.deploy - This module enables web application deployment from the `$JETTY_BASE/webapps` directory.ee10-annotations - Enables Annotation scanning for deployed web applications.ee10-apache-jsp - Enables use of the apache implementation of JSP.ee10-cdi - Provides integration of CDI within webapp to Jetty container object lifecycles.ee10-cdi-decorate - Configures Jetty to use the "CdiDecoratingListener" as the default CDI mode.ee10-cdi-spi - Configures Jetty to use the "CdiSpiDecorator" as the default CDI mode.ee10-demo-async-rest - Demo Async Rest webappee10-demo-jaas - Demo EE10 JAAS webappee10-demo-jetty - Demo Jetty Webappee10-demo-jndi - Demo JNDI Resources Webappee10-demo-jsp - Demo Simple JSP Webappee10-demo-mock-resources - Download and install some Demo Mock Resourcesee10-demo-proxy - Demo Proxy Webappee10-demo-rewrite - Demonstrate the rewrite module.ee10-demo-simple - Demo Simple Webappee10-demo-spec - Download and deploy the Test Spec webapp demo.ee10-demos - A meta module to enable all EE10 demo modules.ee10-deploy - This module enables webapp deployment from the `$JETTY_BASE/webapps` directory.ee10-fcgi-proxy - Enables support for EE10 FastCGI proxying.ee10-glassfish-jstl - Enables the glassfish version of JSTL for all webapps.ee10-jaspi - Enables JASPI authentication for deployed web applications.
ee10-jaspi-default-auth-config-factory - Provides a DefaultAuthConfigFactory for jaspiee10-jaspi-demo - Enables JASPI basic authentication the /test context path.ee10-jndi - Adds the Jetty EE10 JNDI reference factoriesee10-jsp - Enables JSP for all web applications deployed on the server.ee10-jstl - Enables JSTL for all web applications deployed on the server.ee10-openid - Adds openid security for EE10.ee10-plus - Enables Servlet resource injection.ee10-proxy - Enables the Jetty Proxy service.ee10-quickstart - Enables the Jetty Quickstart module for rapid deployment of preconfigured web applications.ee10-security - Adds servlet standard security handling to the classpath.ee10-servlet - Enables standard Servlet handling.ee10-servlets - Adds Jetty EE10 utility servlets and filters available to a webapp.ee10-webapp - This module enables deployment of Java Servlet web applications.ee10-websocket-jakarta - Enable jakarta.websocket APIs for deployed web applications.ee10-websocket-jetty - Enable the Jetty WebSocket API support for deployed web applications.ee10-websocket-jetty-client-webapp - Expose the Jetty WebSocket Client classes to deployed web applications.ee8-annotations - Enables Annotation scanning for deployed web applications.ee8-apache-jsp - Enables use of the apache implementation of JSP.ee8-demo-async-rest - Demo Async Rest webappee8-demo-jaas - Demo EE8 JAAS webappee8-demo-jetty - Demo Jetty Webappee8-demo-jndi - Demo JNDI Resources Webappee8-demo-jsp - Demo Simple JSP Webappee8-demo-mock-resources - Download and install some Demo Mock Resourcesee8-demo-moved-context - Demonstrate a Moved Context Handler.ee8-demo-proxy - Demo Proxy Webappee8-demo-rewrite - Demonstrate the rewrite module.ee8-demo-simple - Demo EE8 Simple Webappee8-demo-spec - Download and deploy the Test Spec webapp demo.ee8-demos - A meta module to enable all EE8 demo modules.ee8-deploy - This module enables webapp deployment from the `$JETTY_BASE/webapps` directory.ee8-glassfish-jstl - Enables the glassfish version of JSTL for all webapps.ee8-jndi - Adds the Jetty EE8 JNDI reference factoriesee8-jsp - Enables JSP for all web applications deployed on the server.ee8-jstl - Enables JSTL for all web applications deployed on the server.ee8-openid - Adds OpenId Connect authentication to the server.ee8-plus - Enables Servlet 3.1 resource injection.ee8-proxy - Enables the Jetty Proxy service.ee8-quickstart - Enables the Jetty Quickstart module for rapid deployment of preconfigured web applications.ee8-security - Adds servlet standard security handling to the classpath.ee8-servlet - Enables standard Servlet handling.ee8-servlets - Adds Jetty EE8 utility servlets and filters available to a webapp.ee8-webapp - Adds support for servlet specification web applications to the server classpath.ee8-websocket-javax - Enable javax.websocket APIs for deployed web applications.ee8-websocket-jetty - Enable the Jetty WebSocket API support for deployed web applications.ee8-websocket-jetty-client - Expose the Jetty WebSocket Client classes to deployed web applications.ee8-websocket-jetty-client-webapp - Expose the Jetty WebSocket Client classes to deployed web applications.ee9-annotations - Enables Annotation scanning for deployed web applications.ee9-apache-jsp - Enables use of the apache implementation of JSP.ee9-cdi - Provides integration of CDI within webapp to Jetty container object lifecycles.ee9-cdi-decorate - Configures Jetty to use the "CdiDecoratingListener" as the default CDI mode.ee9-cdi-spi - Configures Jetty to use the "CdiSpiDecorator" as the default CDI mode.ee9-demo-async-rest - Demo Async Rest webappee9-demo-jaas - Demo EE9 JAAS webappee9-demo-jetty - Demo Jetty Webappee9-demo-jndi - Demo JNDI Resources Webappee9-demo-jsp - Demo Simple JSP Webappee9-demo-mock-resources - Download and install some Demo Mock Resourcesee9-demo-proxy - Demo Proxy Webappee9-demo-rewrite - Demonstrate the rewrite module.ee9-demo-simple - Demo EE9 Simple Webappee9-demo-spec - Download and deploy the Test Spec webapp demo.ee9-demos - A meta module to enable all EE9 demo modules.ee9-deploy - This module enables webapp deployment from the `$JETTY_BASE/webapps` directory.ee9-fcgi-proxy - Enables support for EE9 FastCGI proxying.ee9-glassfish-jstl - Enables the glassfish version of JSTL for all webapps.ee9-jaspi - Enables JASPI authentication for deployed web applications.ee9-jaspi-default-auth-config-factory - Provides a DefaultAuthConfigFactory for jaspiee9-jaspi-demo - Enables JASPI basic authentication the /test context path.ee9-jndi - Adds the Jetty EE9 JNDI reference factoriesee9-jsp - Enables JSP for all web applications deployed on the server.ee9-jstl - Enables JSTL for all web applications deployed on the server.ee9-openid - Adds OpenId Connect authentication to the server.ee9-plus - Enables Servlet 3.1 resource injection.ee9-proxy - Enables the Jetty Proxy service.ee9-quickstart - Enables the Jetty Quickstart module for rapid deployment of preconfigured web applications.ee9-security - Adds servlet standard security handling to the classpath.ee9-servlet - Enables standard Servlet handling.ee9-servlets - Adds Jetty EE9 utility servlets and filters available to a webapp.ee9-webapp - Adds support for servlet specification web applications to the server classpath.ee9-websocket-jakarta - Enable jakarta.websocket APIs for deployed web applications.ee9-websocket-jetty - Enable the Jetty WebSocket API support for deployed web applications.ee9-websocket-jetty-client-webapp - Expose the Jetty WebSocket Client classes to deployed web applications.ext - Adds the jar file from $JETTY_HOME/lib/ext and $JETTY_BASE/lib/ext to the server classpath.fcgi - Enables support for the FastCGI protocol.fcgi-proxy - Enables support for HTTP to FastCGI proxying.flight-recorder - Enables Java Mission Control's Flight Recorder for low overhead profiling.gcloud - Controls GCloud API classpath.gcloud-datastore - Enables GCloud Datastore API and implementation.global-webapp-common - Enables Deployer to apply common configuration to all webapp deployments.graceful - Enables Graceful processing of requestsgzip - Enables GzipHandler for dynamic gzip compression for the entire server.home-base-warning - Generates a warning that server has been run from $JETTY_HOME rather than from a $JETTY_BASE.http - Enables a clear-text HTTP connector.http-forwarded - Enables processing of the "Forwarded" HTTP header (and its predecessors "X-Forwarded-*" HTTP headers).http2 - Enables the support for the secure HTTP/2 protocol.http2c - Enables the support for the clear-text HTTP/2 protocol.http3 - Enables experimental support for the HTTP/3 protocol.https - Adds HTTPS protocol support to the TLS(SSL) Connector.inetaccess - Enables the InetAccessHandler.infinispan-embedded - Setup infinispan embedded without querying.infinispan-embedded-query - Enables querying with the Infinispan session cache.infinispan-remote - Default setup for the remote infinispan cache without queries.infinispan-remote-query - Enables querying with a remote Infinispan cache.jaas - Enables JAAS for deployed web applications.jdbc - Enables the java.sql JPMS module.jmx - This module enables local Java Management Extension (JMX) support for Jetty components.jmx-remote - Enables clear-text remote RMI access to platform MBeans.jmx-remote-auth - Enables authentication and authorization for remote clientsjmx-remote-ssl - Enables secure remote RMI access to platform MBeans.jna - Provides Java Native Access (JNA) support.jndi - Adds the Jetty JNDI implementation to the classpath.jvm - Creates an ini template for setting JVM arguments (eg -Xmx ).logging-jcl-capture - Captures jakarta-commons-logging events and bridges them to SLF4J.logging-jetty - Base configuration for the jetty logging mechanism.logging-jul - Configures jetty logging to use Java Util Logging (jul).logging-jul-capture - Captures java.util.logging events and bridges them to slf4j.logging-log4j1 - Configures Jetty logging to use Log4j.logging-log4j1-capture - Captures Apache log4j events and bridges them to SLF4J.logging-log4j2 - Configures Jetty logging to use log4j version 2.logging-logback - Configures Jetty logging to use Logback Logging.logging-noop - Configures Jetty logging to use SLF4J No-Op Implementation.logging/slf4j - Configures logging to use SLF4J.lowresources - Enables a low resource monitor on the server.openid - Adds OpenId Connect authentication to the server.pid - Creates the PID file for the Jetty processplus - Adds the Jetty Plus JNDI support to the classpath.proxy - Enables support for HTTP proxying.proxy-protocol - Enables PROXY Protocol (https://www.haproxy.org/download/2.1/doc/proxy-protocol.txt)proxy-protocol-ssl - Enables the Proxy Protocol on the TLS(SSL) Connector.quiche - Provides Native binary builds for the Quiche library.requestlog - Logs requests using CustomRequestLog and AsyncRequestLogWriter.resources - This module adds the `$JETTY_BASE/resources` directory to the server's classpath.rewrite - Enables the jetty-rewrite handler.rewrite-compactpath - Add a rule to the rewrite module to compact paths.rewrite-customizer - Enables a rewrite Rules container as a request customizer.secure-redirect - Enable SecuredRedirectHandler to redirect all http requests to https on the secure port configured in the server.ini file.security - Adds core security handling to the classpath.server - Enables and configures the Jetty server.session-cache-hash - Enable first level session cache.session-cache-null - A SessionCache that does not actually cache sessions.session-store-cache - Enables caching of SessionData in front of a SessionDataStore.session-store-file - Enables session persistent storage in files.session-store-gcloud - Enables GCloudDatastore session management.session-store-hazelcast-embedded - Enables session data store in an embedded Hazelcast Map.session-store-hazelcast-remote - Enables session data store in a remote Hazelcast Map.session-store-infinispan-embedded - Enables session data store in a local Infinispan cache.session-store-infinispan-remote - Enables session data store in a remote Infinispan cache.session-store-jdbc - Enables JDBC persistent/distributed session storage.session-store-mongo - Enables NoSql session management with a MongoDB driver.sessions - Enables session management.setuid - Enables the UNIX setUID configuration.ssl-reload - Enables the KeyStore to be reloaded when the KeyStore file changes.state - Creates and updates state file used by jetty.shstatistics - Enables statistics collection for the server.stop - This module causes Jetty to stop immediately after starting.test-keystore - Test keystore with self-signed SSL Certificate.threadlimit - Applies ThreadLimitHandler to entire server, to limit the threads per IP address for DOS protection.threadpool - Enables and configures the Server ThreadPool.threadpool-virtual - Enables and configures the Server ThreadPool with support for virtual threads in Java 21 or later.threadpool-virtual-preview - Enables and configures the Server ThreadPool with support for virtual threads in Java 19 and Java 20.unixdomain-http - Enables support for clear-text HTTP/1.1 over Java 16 Unix-Domain server sockets.websocket-jetty - Enables the Jetty WebSocket API support for deployed web applications.websocket-jetty-client - Expose the Jetty WebSocket Client classes to deployed web applications.well-known - Serve static files from a directory for the "/.well-known" context path.work - Creates the $JETTY_BASE/work directory as a persistent temp directory.Enabled Modules:
----------------0) resources                 transitive provider of resources for logging-jetty1) logging/slf4j             transitive provider of logging/slf4j for logging-jettydynamic dependency of logging-jetty2) logging-jetty             transitive provider of logging for threadpooltransitive provider of logging for bytebufferpooltransitive provider of logging for server3) bytebufferpool            transitive provider of bytebufferpool for serverini template available with --add-modules=bytebufferpool4) threadpool                transitive provider of threadpool for serverini template available with --add-modules=threadpool5) server                    ${jetty.base}/start.d/server.ini6) http                      ${jetty.base}/start.d/http.ini7) ssl                       ${jetty.base}/start.d/ssl.ini8) https                     ${jetty.base}/start.d/https.ini

启用模块

http为例,执行如下命令:

java -jar $JETTY_HOME/start.jar --add-modules=http

命令的输出,如下:

INFO  : mkdir ${jetty.base}/start.d
INFO  : server          transitively enabled, ini template available with --add-modules=server
INFO  : logging-jetty   transitively enabled
INFO  : http            initialized in ${jetty.base}/start.d/http.ini
INFO  : resources       transitively enabled
INFO  : threadpool      transitively enabled, ini template available with --add-modules=threadpool
INFO  : logging/slf4j   dynamic dependency of logging-jetty
INFO  : bytebufferpool  transitively enabled, ini template available with --add-modules=bytebufferpool
INFO  : mkdir ${jetty.base}/resources
INFO  : copy ${jetty.home}/modules/logging/jetty/resources/jetty-logging.properties to ${jetty.base}/resources/jetty-logging.properties
INFO  : Base directory was modified

检查$JETTY_BASE目录下的文件,执行如下命令:

tree $JETTY_BASE

命令的输出,如下:

.
├── resources
│   └── jetty-logging.properties
└── start.d└── http.ini2 directories, 2 files

查看帮助

命令样例,如下:

java -jar $JETTY_HOME/start.jar --help

命令的输出,如下:


Usage:$ java -jar $JETTY_HOME/start.jar [command] [options...]Commands can be of two types: report commands or configuration commands.
Commands execute and then exit the JVM.
Options can be specified with or without commands.
When no command is specified, Jetty is started with the given options.Report Commands:
------------------helpPrints this help / usage information.--versionPrints the version information for Jetty anddependent jars, then exits.--list-classpathPrints the class-path (or module-path) information thatwill be used to start Jetty.--list-configLists the resolved configuration that will be used tostart Jetty.Output includes:o  Enabled Jetty moduleso  Java environmento  Jetty environmento  Config file search ordero  JVM argumentso  System propertieso  Propertieso  Java class-path or module-patho  XML configuration files--list-modulesLists the modules defined in ${jetty.base}/modules/*.modand then in ${jetty.home}/modules/*.mod.--list-modules=<tag>(,<tag>)*Lists the modules by tag. Use '*' for all tags.Prefix a tag with '-' to exclude the tag.The special tag "internal" is always excluded unless it isexplicitly included.--list-all-modulesLists all modules.--show-modules=<module>(,<module>)*Shows the detail of the listed modules, includingdependencies, tags, libraries and XMLs.--stopSends a stop signal to the running Jetty instance.The running Jetty instance must have been started with astop.port=<port> property and the --stop command mustbe executed with the same property.--dry-runPrints the command line that start.jar generates,in a format usable by a POSIX compliant shell, then exits.This may be used to generate command lines into scripts:$ java -jar start.jar --dry-run > jetty.sh--dry-run=<part>(,<part>)*Prints specific parts of the command line in a format usable bya POSIX compliant shell. The parts are:o  "java" - the JVM to runo  "opts" - the JVM options (e.g. -D, -X and -XX flags)o  "path" - the JVM class-path and/or the JPMS module-patho  "main" - the main class to runo  "args" - the arguments passed to the main classo  "envs" - the generated XML files to create the environmentsConfigure Commands:
---------------------add-modules=<moduleName>(,<moduleName>)*Adds the given modules to the list of modules enabled atwhen Jetty starts.Transitive dependencies are followed and dependentmodules may also explicitly added.Modules are added by creating an *.ini file in the${jetty.base}/start.d/ directory.The *.ini file contains the --module option that enablesthe module, and any other option defined in the module's[ini-template] section.If the *.ini file specifies properties, these may beoverridden by specifying the same properties on thecommand line.If a module is transitively enabled, its *.ini file willnot be generated.To generate the *.ini file, the module must be explicitlylisted in the --add-modules=... command.This option replaces the deprecated --add-to-start and--add-to-startd commands.--create-start-dCreates a ${jetty.base}/start.d directory.If the ${jetty.base}/start.ini file exists, then it ismoved into the ${jetty.base}/start.d/ directory.Using a ${jetty.base}/start.d/ directory is the default andthis option is only needed to either force the creation ofthe ${jetty.base}/start.d/ directory, or to move a${jetty.base}/start.ini file to ${jetty.base}/start.d/.--create-start-iniCreates a ${jetty.base}/start.ini file.If a ${jetty.base}/start.d/ directory exists, then allthe contained *.ini files are concatenated into the${jetty.base}/start.ini file.--update-iniScans all the ${jetty.base}/start.d/*.ini files and updatesany property with values specified on the command line.For example:$ java -jar ${jetty.host}/start.jar --update-ini jetty.http.port=8888--create-filesCreates any missing files that are required by enabledmodules, as specified in their [files] section.This may download a file from the network if a HTTP URIis specified in the [files] section.--write-module-graph=<filename>Creates a graphviz *.dot file of the module graph as itis configured for the current ${jetty.base}.See https://graphviz.org/ for details on how to post-processthis file into the output best suited for your needs.Options:
----------modules=<moduleName>(,<moduleName>)*Enables a module for this execution.To enable a module for all future executions, use the--add-modules command.Note: this option is used in the ${jetty.base}/start.inifile or in ${jetty.base}/start.d/*.ini files created bythe --add-modules command.--libs=<classpath>Adds the specified class-path entries to the the serverclass-path (or module-path).--download=<http-uri>|<location>Downloads a file from the given HTTP URI, if it doesnot already exist at the given location.Note: the location is always relative to ${jetty.base}.You might need to escape the pipe "\|" to use it insome shell environments.--execExecutes the generated command line in a forked JVM(see the --dry-run command).This can be used when ${jetty.base}/start.d/*.ini filescontain -D, -X or -XX arguments, but creates an extraJVM process.--exec-properties=<filename>Assigns a fixed name to the file used to transferproperties to the sub process. This allows thegenerated properties file to be saved and reused.Without this option, a temporary file is used.--commands=<filename>Uses each line of the specified file as arguments on theJVM command line.--jpmsStarts Jetty in JPMS mode in a forked JVM (see also the--dry-run command).The library *.jar files are set on the forked JVM module-path(rather than the forked JVM class-path), while directoriesare set on the forked JVM class-path.The main class is specified with the JPMS option--module <moduleName>/<mainClassName>.--debugEnables debug output of the startup execution.Note: this does not setup debug logging for Jetty itself,only for the startup execution.If you want debug logging for Jetty, configure one of theavailable logging modules using the --add-modules command.--start-log-file=<filename>A filename, relative to ${jetty.base}, where all startupoutput will be sent.  This is useful for capturing startupissues when the Jetty logging module has not yet starteddue to configuration errors.--allow-insecure-http-downloadsAllow the use of insecure `http://` scheme for content download.--approve-all-licensesApproves all license questions from modules that haveparticular license requirements.Useful for enabling modules from a script, so that itdoes not require user interaction.--skip-file-validation=<moduleName>(,<moduleName>)*Disables the creation of files as specified by the[files] section of the specified modules.Useful if a logging module specifies a *.propertiesconfig file, but you want to use that module with an*.xml config file instead.--include-jetty-dir=<path>Includes the specified directory as a configuration source.This directory behaves similarly to ${jetty.base} but sitsat a layer between ${jetty.home} and ${jetty.base}.Useful when you want to apply a common "corporate"configuration to all specific ${jetty.base} directorieswithout having to modify ${jetty.home}.jetty.home=<directory>Sets the ${jetty.home} directory.By default it is resolved from the start.jar file path.jetty.base=<directory>Sets the ${jetty.base} directory.By default it is resolved from the current directory path.stop.host=<string>Used with the --stop command.Specifies the host where the Jetty server to stop isrunning (defaults to 127.0.0.1).stop.port=<number>Used with the --stop command.Specifies the port to use to contact the Jetty serverto stop.stop.key=<alphanumeric>Used with the --stop command.The passphrase required to stop the Jetty server.stop.wait=<number>Used with the --stop command.The time, in seconds, to wait for confirmation that therunning Jetty server has stopped.If not specified, the stopper will not wait.maven.repo.uri=<url>The base URL to use to download Maven dependencies.Defaults to: https://repo1.maven.org/maven2/.<name>=<value>Specifies a property value that overrides the sameproperty defined in a ${jetty.base}/start.d/*.ini file,or in the [ini] section of a *.mod file.<name>=<value>Sets the property value unconditionally.<name>+=<value>Appends the given value to the existing value.<name>?=<value>Sets the property value only if it is not already set.-D<name>=<value>Specifies a system property, as well as a start property.Note: this is a program argument that is interpreted andadded to the existing JVM system properties.<xml-file>Specifies a Jetty XML file relative to ${jetty.base}.This file is in addition to the Jetty XML files resolvedfrom the [xml] sections of the enabled modules.

查看模块的信息

命令样例如下:

java -jar $JETTY_HOME/start.jar --show-modules=http

命令的输出,如下:

Module: http: Enables a clear-text HTTP connector.: By default clear-text HTTP/1.1 is enabled, and clear-text HTTP/2 may be added by enabling the "http2c" module.Tags: connector, httpDepend: serverXML: etc/jetty-http.xmlEnabled: ${jetty.base}/start.d/http.ini

查看Jetty的命令行选项

命令样例,如下:

java -jar $JETTY_HOME/start.jar --dry-run

命令的输出,如下:

/home/jackie/software/jdk-21.0.2/bin/java -Djava.io.tmpdir=/tmp -Djetty.home=/home/jackie/software/jetty-home-12.0.6 -Djetty.base=/home/jackie/workspace/jetty_run --class-path /home/jackie/workspace/jetty_run/resources:/home/jackie/software/jetty-home-12.0.6/lib/logging/slf4j-api-2.0.9.jar:/home/jackie/software/jetty-home-12.0.6/lib/logging/jetty-slf4j-impl-12.0.6.jar:/home/jackie/software/jetty-home-12.0.6/lib/jetty-http-12.0.6.jar:/home/jackie/software/jetty-home-12.0.6/lib/jetty-server-12.0.6.jar:/home/jackie/software/jetty-home-12.0.6/lib/jetty-xml-12.0.6.jar:/home/jackie/software/jetty-home-12.0.6/lib/jetty-util-12.0.6.jar:/home/jackie/software/jetty-home-12.0.6/lib/jetty-io-12.0.6.jar org.eclipse.jetty.xml.XmlConfiguration java.version=21.0.2 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.,file:///home/jackie/software/jetty-home-12.0.6/lib/logging/,org.slf4j. runtime.feature.alpn=true slf4j.version=2.0.9 /home/jackie/software/jetty-home-12.0.6/etc/jetty-bytebufferpool.xml /home/jackie/software/jetty-home-12.0.6/etc/jetty-threadpool.xml /home/jackie/software/jetty-home-12.0.6/etc/jetty.xml /home/jackie/software/jetty-home-12.0.6/etc/jetty-http.xml /home/jackie/software/jetty-home-12.0.6/etc/jetty-ssl.xml /home/jackie/software/jetty-home-12.0.6/etc/jetty-ssl-context.xml /home/jackie/software/jetty-home-12.0.6/etc/jetty-https.xml

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/719776.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

带使能控制的锂电池充放电解决方案

一、产品概述 TP4594R 是一款集成线性充电管理、同步升压转换、电池电量指示和多种保护功能的单芯片电源管理 SOC&#xff0c;为锂电池的充放电提供完整的单芯片电源解决方案。 TP4594R 内部集成了线性充电管理模块、同步升压放电管理模块、电量检测与 LED 指示模块、保护模块…

关于python函数参数传递

参数传递 在 python 中&#xff0c;类型属于对象&#xff0c;对象有不同类型的区分&#xff0c;变量是没有类型的&#xff1a; 在下面的代码示例重&#xff0c;[1,2,3] 是 List 类型&#xff0c;“qayrup” 是 String 类型&#xff0c;而变量 a 是没有类型&#xff0c;它仅仅…

#WEB前端

1.实验&#xff1a;vscode安装&#xff0c;及HTML常用文本标签 2.IDE&#xff1a;VSCODE 3.记录&#xff1a; &#xff08;1&#xff09;网页直接搜索安装vscode &#xff08;2&#xff09;打开vscode&#xff0c;在下图分别安装以下插件&#xff1a; Html Css Support …

C++11线程同步之互斥锁

C11线程同步之互斥锁 std::mutex成员函数线程同步 std::lock_guardstd::recursive_mutexstd::timed_mutex 进行多线程编程&#xff0c;如果多个线程需要对同一块内存进行操作&#xff0c;比如&#xff1a;同时读、同时写、同时读写对于后两种情况来说&#xff0c;如果不做任何的…

《互联网的世界》第四讲-拥塞控制与编码

需要澄清的一个误区是&#xff0c;拥塞绝不是发送的数据量太大导致&#xff0c;而是数据在极短的时间段内到达了同一个地方以至于超过了网络处理容量导致&#xff0c;拥塞的成因一定要考虑时间因素。换句话说&#xff0c;拥塞由大突发导致。 只要 pacing&#xff0c;再多的数据…

2024.3.4训练记录(8)

文章目录 CF 459D Pashmak and Parmidas problemCF 1388C Uncle Bogdan and Country HappinessCF 1525D ArmchairsCF 220B Little Elephant and Array CF 459D Pashmak and Parmida’s problem 题目链接 最近感觉对数据结构题的反应度提升了&#xff0c;这一题是上午看的但是…

动态规划(算法竞赛、蓝桥杯)--树形DP树形背包

1、B站视频链接&#xff1a;E18 树形DP 树形背包_哔哩哔哩_bilibili #include <bits/stdc.h> using namespace std; const int N110; int n,V,p,root; int v[N],w[N]; int h[N],to[N],ne[N],tot; //邻接表 int f[N][N];void add(int a,int b){to[tot]b;ne[tot]h[a];h[a…

数仓项目6.0(一)

尚硅谷大数据项目【电商数仓6.0】企业数据仓库项目_bilibili 数据流转过程 用户➡️业务服务器➡️数据库存储➡️数仓统计分析➡️数据可视化 数据仓库处理流程&#xff1a;数据源➡️加工数据➡️统计筛选数据➡️分析数据 数据库不是为了数据仓库服务的&#xff0c;需要…

B084-SpringCloud-Zuul Config

目录 zuul系统架构和zuul的作用zuul网关实现配置映射路径过滤器 Config概述云端管理本地配置 zuul zuul是分布式和集群后前端统一访问入口 系统架构和zuul的作用 zuul把自己注册进eureka&#xff0c;然后可通过前端传来的服务名发现和访问对应的服务集群 为了预防zuul单点故…

Java 枚举类的深入理解与应用

Java 的枚举类是一种特殊的类&#xff0c;通常表示一组常量。在编译或设计时&#xff0c;当我们知道所有变量的可能性时&#xff0c;尽量使用枚举类型。本文将通过一个具体的例子&#xff0c;深入探讨 Java 枚举类的定义、使用和高级特性。 目录 枚举类的定义与使用枚举类的构造…

【OJ】求和与计算日期

文章目录 1. 前言2. JZ64 求123...n2.1 题目分析2.2 代码 3. HJ73 计算日期到天数转换3.1 题目分析3.2 代码 4. KY222 打印日期4.1 题目分析4.2 代码 1. 前言 下面两个题目均来自牛客&#xff0c;使用的编程语言是c&#xff0c;分享个人的一些思路和代码。 2. JZ64 求123…n …

Vue 赋值后原数据随赋值后的数据的变化而变化

很常见的&#xff0c;当我们直接用“”号等方式直接赋值后 原数据会随赋值后的数据的变化而变化 但是有时候我们的需求是不需要原数据跟随变化 所以怎么解决呢&#xff1f; 解决办法有&#xff1a; 1.使用Object.assign() 方法 2.使用深拷贝函数 JSON.parse() 3.使用第三方库lo…

毕业生信息招聘平台|基于springboot+ Mysql+Java的毕业生信息招聘平台设计与实现(源码+数据库+文档+PPT)

目录 论文参考 摘 要 数据库设计 系统详细设计 文末获取源码联系 论文参考 摘 要 随着社会的发展&#xff0c;社会的各行各业都在利用信息化时代的优势。计算机的优势和普及使得各种信息系统的开发成为必需。 毕业生信息招聘平台&#xff0c;主要的模块包括查看管理员&a…

#ifndef 和 #pragma once的区别

#ifndef 和 #pragma once 都是用来防止头文件被重复包含的&#xff0c;但它们的工作方式和兼容性有所不同&#xff1a; #ifndef 是 C 的标准语法&#xff0c;它依赖于不重复的宏名称&#xff0c;保证了包含在 #endif 的内容不会被重复包含。这个内容可以是一个文件的所有内容&…

Webpack配置与运行基础教程

在前端开发中&#xff0c;Webpack是一款非常流行的模块打包工具&#xff0c;它可以帮助我们将多个文件打包成一个或多个静态资源文件&#xff0c;从而提高前端项目的性能和可维护性。本文将为你介绍Webpack的基础配置和运行方法&#xff0c;帮助你快速上手Webpack。 什么是Web…

基于Springboot的无人智慧超市管理系统(有报告)。Javaee项目,springboot项目。

演示视频&#xff1a; 基于Springboot的无人智慧超市管理系统&#xff08;有报告&#xff09;。Javaee项目&#xff0c;springboot项目。 项目介绍&#xff1a; 采用M&#xff08;model&#xff09;V&#xff08;view&#xff09;C&#xff08;controller&#xff09;三层体系…

1.3 有哪些文本表示模型?它们各有什么优缺点?

1.3 有哪些文本表示模型?它们各有什么优缺点? 场景描述 文本是一类非常重要的非结构化数据&#xff0c;如何表示文本数据一直是机器学习领域的一个重要研究方向。 知识点 词袋模型(Bag of Words)TF-IDF(Term Frequency-Inverse DocumentFrequency)主题模型(Topic Model)词…

【每日刷题】数组-LC56、LC238、随想录1、LC560

1. LC56 合并区间 题目链接 Arrays.sort先让intervals里的子数组按照子数组的第一个数字值从小到大排列。开一个新数组&#xff0c;newInterval&#xff0c;存放合并好的子数组让intervals的当前子数组i的第一个数字与newInterval的当前子数组index的最后一个数字比较大小&am…

ARM 架构下国密算法库

目录 前言GmSSL编译环境准备下载 GmSSL 源码编译 GmSSL 源码SM4 对称加密算法SM2 非对称加密算法小结前言 在当前的国际形式下,国替势不可挡。操作系统上,银河麒麟、统信 UOS、鸿蒙 OS 等国产系统开始发力,而 CPU 市场,也是百花齐放,有 龙芯(LoongArch架构)、兆芯(X86…

Intel/国产化无人叉车机器视觉专用控制器

无人叉车和机器视觉是两个独立的技术领域&#xff0c;但它们可以结合使用以实现更高效的物流自动化。无人叉车是一种自动化运输工具&#xff0c;可以在没有人为干预的情况下完成货物的搬运和运输。机器视觉是一种人工智能技术&#xff0c;可以让计算机识别和理解图像或视频中的…