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.pswp.cn/news/719776.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/719776.shtml
英文地址,請注明出處:http://en.pswp.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;可以讓計算機識別和理解圖像或視頻中的…