Merge branch 'jetty-9.4.x' into jetty-10.0.x
This commit is contained in:
commit
c68c5e1e75
|
@ -82,6 +82,215 @@ Below is an illustration of how the various Jetty configuration files (`ini`, `m
|
|||
|
||||
image:images/Jetty_Configuration_File_Relationships.png[image,width=693]
|
||||
|
||||
==== A Closer Look
|
||||
|
||||
To put it simply: XML files are responsible for instantiating the Jetty POJOs that make up the server.
|
||||
They define properties which users can modify to meet the needs of their server.
|
||||
These XML files are broken up by type in the distribution so they can be consumed as a user/server needs them.
|
||||
For example, a server may need HTTP and HTTPS functionality, but opt out of using HTTP/2 and Websocket.
|
||||
|
||||
Module files allow users to enable and remove functionality quickly and easily from their server implementation.
|
||||
They include a template of the different properties included in the associated XML file, as well as a pointer to the XML or JAR file(s) they are referencing.
|
||||
When a module is activated these properties are added to a related `ini` file where users can configure them to meet their needs.
|
||||
We will discuss modules in further detail in an upcoming chapter.
|
||||
|
||||
Ini files are where most users will spend the bulk of their time editing the configuration for their server.
|
||||
As mentioned, they contain properties which were defined in their associated XML files which in turn reference Jetty Java objcts.
|
||||
|
||||
This can be a bit overwhelming at first, so let's look at an example - in this case the `http` module.
|
||||
We will work backwards from an ini file to the associated module and then the XML file in question.
|
||||
|
||||
First up, the `http.ini` file.
|
||||
If we take a look at it's contents, we will see the following:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
$ cat start.d/http.ini
|
||||
# ---------------------------------------
|
||||
# Module: http
|
||||
# Enables a HTTP connector on the server.
|
||||
# By default HTTP/1 is support, but HTTP2C can
|
||||
# be added to the connector with the http2c module.
|
||||
# ---------------------------------------
|
||||
--module=http
|
||||
|
||||
### HTTP Connector Configuration
|
||||
|
||||
## Connector host/address to bind to
|
||||
# jetty.http.host=0.0.0.0
|
||||
|
||||
## Connector port to listen on
|
||||
# jetty.http.port=8080
|
||||
|
||||
## Connector idle timeout in milliseconds
|
||||
# jetty.http.idleTimeout=30000
|
||||
|
||||
## Connector socket linger time in seconds (-1 to disable)
|
||||
# jetty.http.soLingerTime=-1
|
||||
|
||||
## Number of acceptors (-1 picks default based on number of cores)
|
||||
# jetty.http.acceptors=-1
|
||||
|
||||
## Number of selectors (-1 picks default based on number of cores)
|
||||
# jetty.http.selectors=-1
|
||||
|
||||
## ServerSocketChannel backlog (0 picks platform default)
|
||||
# jetty.http.acceptorQueueSize=0
|
||||
|
||||
## Thread priority delta to give to acceptor threads
|
||||
# jetty.http.acceptorPriorityDelta=0
|
||||
|
||||
## Reserve threads for high priority tasks (-1 use a heuristic, 0 no reserved threads)
|
||||
# jetty.http.reservedThreads=-1
|
||||
|
||||
## Connect Timeout in milliseconds
|
||||
# jetty.http.connectTimeout=15000
|
||||
|
||||
## HTTP Compliance: RFC7230, RFC2616, LEGACY
|
||||
# jetty.http.compliance=RFC7230
|
||||
----
|
||||
|
||||
So what do we see?
|
||||
We have a module name, the module activation (`--module=http`), as well as a description and what look like properties to configure.
|
||||
Those will some scripting/coding experience might notice that most of the lines are commented out with `#` and you'd be correct.
|
||||
When a module is enabled and an `ini` file is created, all of the properties you see here were set to these defaults - the server is already using the values shown
|
||||
If you wanted to change one of the properties though, say `jetty.http.port`, you'd simply uncomment the line and change the value.
|
||||
For example:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
$ cat start.d/http.ini
|
||||
# ---------------------------------------
|
||||
# Module: http
|
||||
# Enables a HTTP connector on the server.
|
||||
# By default HTTP/1 is support, but HTTP2C can
|
||||
# be added to the connector with the http2c module.
|
||||
# ---------------------------------------
|
||||
--module=http
|
||||
|
||||
### HTTP Connector Configuration
|
||||
|
||||
## Connector host/address to bind to
|
||||
# jetty.http.host=0.0.0.0
|
||||
|
||||
## Connector port to listen on
|
||||
jetty.http.port=1234
|
||||
...
|
||||
----
|
||||
|
||||
As seen before, these properties were populated in this ini file based on a related module.
|
||||
Standard Jetty modules live in the Home of the Jetty Distribution in the aptly named `modules` directory.
|
||||
So let's take a quick look at the associated `$JETTY_HOME/modules/http.mod` file:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
$ cat $JETTY_HOME/modules/http.mod
|
||||
[description]
|
||||
Enables a HTTP connector on the server.
|
||||
By default HTTP/1 is support, but HTTP2C can
|
||||
be added to the connector with the http2c module.
|
||||
|
||||
[tags]
|
||||
connector
|
||||
http
|
||||
|
||||
[depend]
|
||||
server
|
||||
|
||||
[xml]
|
||||
etc/jetty-http.xml
|
||||
|
||||
[ini-template]
|
||||
### HTTP Connector Configuration
|
||||
|
||||
## Connector host/address to bind to
|
||||
# jetty.http.host=0.0.0.0
|
||||
|
||||
## Connector port to listen on
|
||||
# jetty.http.port=8080
|
||||
|
||||
## Connector idle timeout in milliseconds
|
||||
# jetty.http.idleTimeout=30000
|
||||
|
||||
## Connector socket linger time in seconds (-1 to disable)
|
||||
# jetty.http.soLingerTime=-1
|
||||
...
|
||||
----
|
||||
At first blush, it looks remarkable similar to the `ini` file we just looked at.
|
||||
We still have a description and the properties we could edit, but now we also have several other sections.
|
||||
These other sections will be looked at further in our chapter on modules, but for now it is worth noting the `[xml]` and `[ini-template]` sections.
|
||||
As you could probably have puzzled out, the `[ini-template]` contains a template (go figure) for properties to be placed in the associated `ini` file when a module is activated.
|
||||
The `[xml]` section refers to the file and location of the XML file these properties are based on.
|
||||
It is important to note that not every module file will have the same sections, but most should look structurally the same.
|
||||
|
||||
Now that we know what XML file these properties relate to, we can navigate to it and have a look.
|
||||
|
||||
[source, xml, subs="{sub-order}"]
|
||||
----
|
||||
$ cat $JETTY_HOME/etc/jetty-http.xml
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
|
||||
|
||||
<!-- ============================================================= -->
|
||||
<!-- Configure the Jetty Server instance with an ID "Server" -->
|
||||
<!-- by adding a HTTP connector. -->
|
||||
<!-- This configuration must be used in conjunction with jetty.xml -->
|
||||
<!-- ============================================================= -->
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Add a HTTP Connector. -->
|
||||
<!-- Configure an o.e.j.server.ServerConnector with a single -->
|
||||
<!-- HttpConnectionFactory instance using the common httpConfig -->
|
||||
<!-- instance defined in jetty.xml -->
|
||||
<!-- -->
|
||||
<!-- Consult the javadoc of o.e.j.server.ServerConnector and -->
|
||||
<!-- o.e.j.server.HttpConnectionFactory for all configuration -->
|
||||
<!-- that may be set here. -->
|
||||
<!-- =========================================================== -->
|
||||
<Call name="addConnector">
|
||||
<Arg>
|
||||
<New id="httpConnector" class="org.eclipse.jetty.server.ServerConnector">
|
||||
<Arg name="server"><Ref refid="Server" /></Arg>
|
||||
<Arg name="acceptors" type="int"><Property name="jetty.http.acceptors" deprecated="http.acceptors" default="-1"/></Arg>
|
||||
<Arg name="selectors" type="int"><Property name="jetty.http.selectors" deprecated="http.selectors" default="-1"/></Arg>
|
||||
<Arg name="factories">
|
||||
<Array type="org.eclipse.jetty.server.ConnectionFactory">
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
|
||||
<Arg name="config"><Ref refid="httpConfig" /></Arg>
|
||||
<Arg name="compliance"><Call class="org.eclipse.jetty.http.HttpCompliance" name="valueOf"><Arg><Property name="jetty.http.compliance" default="RFC7230"/></Arg></Call></Arg>
|
||||
</New>
|
||||
</Item>
|
||||
</Array>
|
||||
</Arg>
|
||||
<Set name="host"><Property name="jetty.http.host" deprecated="jetty.host" /></Set>
|
||||
<Set name="port"><Property name="jetty.http.port" deprecated="jetty.port" default="8080" /></Set>
|
||||
<Set name="idleTimeout"><Property name="jetty.http.idleTimeout" deprecated="http.timeout" default="30000"/></Set>
|
||||
<Set name="soLingerTime"><Property name="jetty.http.soLingerTime" deprecated="http.soLingerTime" default="-1"/></Set>
|
||||
<Set name="acceptorPriorityDelta"><Property name="jetty.http.acceptorPriorityDelta" deprecated="http.acceptorPriorityDelta" default="0"/></Set>
|
||||
<Set name="acceptQueueSize"><Property name="jetty.http.acceptQueueSize" deprecated="http.acceptQueueSize" default="0"/></Set>
|
||||
<Get name="SelectorManager">
|
||||
<Set name="connectTimeout"><Property name="jetty.http.connectTimeout" default="15000"/></Set>
|
||||
<Set name="reservedThreads"><Property name="jetty.http.reservedThreads" default="-2"/></Set>
|
||||
</Get>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
||||
</Configure>
|
||||
----
|
||||
|
||||
Now we can see where those properties in our `ini` and module files came from.
|
||||
In Jetty XML files, Jetty objects come to life; defined properties are set which link back to the jar libraries and run the server to a user's specification.
|
||||
|
||||
____
|
||||
[IMPORTANT]
|
||||
It is important to remember that you should *not* modify the XML files in your `$JETTY_HOME`.
|
||||
If you do for some reason feel you want to change the way an XML file operates, it is best to make a copy of it in your `$JETTY_BASE` in an `/etc` directory.
|
||||
Jetty will always look first to the `$JETTY_BASE` for configuration.
|
||||
____
|
||||
|
||||
==== Other Configuration Files
|
||||
|
||||
In addition to the configuration files described above, the configuration of the server can use the following file types:
|
||||
|
|
|
@ -22,4 +22,5 @@ This guide covers the latter, a standalone distribution suitable for deploying w
|
|||
|
||||
include::jetty-installing.adoc[]
|
||||
include::jetty-running.adoc[]
|
||||
include::jetty-common-configuration.adoc[]
|
||||
include::jetty-deploying.adoc[]
|
||||
|
|
|
@ -0,0 +1,187 @@
|
|||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ========================================================================
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
[[quickstart-common-config]]
|
||||
|
||||
=== Common Jetty Configuration
|
||||
|
||||
[[creating-jetty-base]]
|
||||
==== Creating a new Jetty Base
|
||||
|
||||
The `demo-base` directory described earlier is an example of the link:#startup-base-and-home[`jetty.base`] mechanism.
|
||||
A Jetty base directory allows the configuration and web applications of a server instance to be stored separately from the Jetty distribution, so that upgrades can be done with minimal disruption.
|
||||
Jetty's default configuration is based on two properties:
|
||||
|
||||
jetty.home::
|
||||
The property that defines the location of the Jetty distribution, its libs, default modules and default XML files (typically start.jar, lib, etc).
|
||||
jetty.base::
|
||||
The property that defines the location of a specific implementation of a Jetty server, its configuration, logs and web applications (typically start.d/*.ini files, logs and webapps).
|
||||
|
||||
____
|
||||
[IMPORTANT]
|
||||
Your Jetty Home directory should be treated as a standard of truth and remain unmodified or changed.
|
||||
Changes or additions to your configuration should take place in the Jetty Base directory.
|
||||
____
|
||||
|
||||
The `jetty.home` and `jetty.base` properties may be explicitly set on the command line, or they can be inferred from the environment if used with commands like:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> cd $JETTY_BASE
|
||||
> java -jar $JETTY_HOME/start.jar
|
||||
----
|
||||
|
||||
The following commands create a new base directory, enables both the HTTP connector and the web application deployer modules, and copies a demo webapp to be deployed:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> JETTY_BASE=/tmp/mybase
|
||||
> mkdir $JETTY_BASE
|
||||
> cd $JETTY_BASE
|
||||
> java -jar $JETTY_HOME/start.jar
|
||||
|
||||
WARNING: Nothing to start, exiting ...
|
||||
|
||||
Usage: java -jar start.jar [options] [properties] [configs]
|
||||
java -jar start.jar --help # for more information
|
||||
|
||||
> java -jar $JETTY_HOME/start.jar --create-startd
|
||||
INFO : Base directory was modified
|
||||
> java -jar $JETTY_HOME/start.jar --add-to-start=http,deploy
|
||||
|
||||
INFO: server initialised (transitively) in ${jetty.base}/start.d/server.ini
|
||||
INFO: http initialised in ${jetty.base}/start.d/http.ini
|
||||
INFO: security initialised (transitively) in ${jetty.base}/start.d/security.ini
|
||||
INFO: servlet initialised (transitively) in ${jetty.base}/start.d/servlet.ini
|
||||
INFO: webapp initialised (transitively) in ${jetty.base}/start.d/webapp.ini
|
||||
INFO: deploy initialised in ${jetty.base}/start.d/deploy.ini
|
||||
MKDIR: ${jetty.base}/webapps
|
||||
INFO: Base directory was modified
|
||||
|
||||
> cp $JETTY_HOME/demo-base/webapps/async-rest.war webapps/ROOT.war
|
||||
> java -jar $JETTY_HOME/start.jar
|
||||
|
||||
2015-06-04 11:10:16.286:INFO::main: Logging initialized @274ms
|
||||
2015-06-04 11:10:16.440:INFO:oejs.Server:main: jetty-9.3.0.v20150601
|
||||
2015-06-04 11:10:16.460:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///tmp/mybase/webapps/] at interval 1
|
||||
2015-06-04 11:10:16.581:WARN::main: async-rest webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2015-06-04 11:10:16.589:INFO:oejw.StandardDescriptorProcessor:main: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
|
||||
2015-06-04 11:10:16.628:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@1a407d53{/,[file:///tmp/jetty-0.0.0.0-8080-ROOT.war-_-any-4510228025526425427.dir/webapp/, jar:file:///tmp/jetty-0.0.0.0-8080-ROOT.war-_-any-4510228025526425427.dir/webapp/WEB-INF/lib/example-async-rest-jar-{VERSION}.jar!/META-INF/resources],AVAILABLE}{/ROOT.war}
|
||||
2015-06-04 11:10:16.645:INFO:oejs.ServerConnector:main: Started ServerConnector@3abbfa04{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
|
||||
2015-06-04 11:10:16.646:INFO:oejs.Server:main: Started @634ms
|
||||
----
|
||||
|
||||
[[quickstart-changing-jetty-port]]
|
||||
==== Changing the Jetty Port
|
||||
|
||||
You can configure Jetty to run on a different port by setting the `jetty.http.port` property on the command line:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> cd $JETTY_BASE
|
||||
> java -jar $JETTY_HOME/start.jar jetty.http.port=8081
|
||||
...
|
||||
----
|
||||
|
||||
When the server starts, it will now run on port `8081`.
|
||||
It is important to note that setting properties on the command line will only take affect for that instance of the server.
|
||||
To change the configuration so that the server will always start on the desired port, you will need to edit the `start.d/http.ini`
|
||||
|
||||
____
|
||||
[NOTE]
|
||||
--
|
||||
The configuration by properties works via the following chain:
|
||||
|
||||
* The `start.d/http.ini` file is part of the effective command line and contains the `--module=http` argument which activates the http module.
|
||||
* The `modules/http.mod` file defines the http module which specifies the `etc/jetty-http.xml` configuration file and the template ini properties it uses.
|
||||
* The `jetty.http.port` property is used by the Property XML element in `etc/jetty.http.xml` to inject the `ServerConnector` instance with the port.
|
||||
|
||||
For more information see the link:#quick-start-configure[Quickstart Configuration Guide] and link:#configuring-connectors[Configuring Connectors].
|
||||
--
|
||||
____
|
||||
|
||||
[[quickstart-starting-https]]
|
||||
==== Adding SSL for HTTPS & HTTP2
|
||||
|
||||
Building on the example above, we can activate additional modules to add support HTTPS and HTTP2 for the server.
|
||||
To add HTTPS and HTTP2 connectors to a Jetty configuration, the modules can be activated by the following command:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> java -jar $JETTY_HOME/start.jar --add-to-start=https,http2
|
||||
|
||||
ALERT: There are enabled module(s) with licenses.
|
||||
The following 1 module(s):
|
||||
+ contains software not provided by the Eclipse Foundation!
|
||||
+ contains software not covered by the Eclipse Public License!
|
||||
+ has not been audited for compliance with its license
|
||||
|
||||
Module: alpn-impl/alpn-8
|
||||
+ ALPN is a hosted at github under the GPL v2 with ClassPath Exception.
|
||||
+ ALPN replaces/modifies OpenJDK classes in the sun.security.ssl package.
|
||||
+ http://github.com/jetty-project/jetty-alpn
|
||||
+ http://openjdk.java.net/legal/gplv2+ce.html
|
||||
|
||||
Proceed (y/N)? y
|
||||
INFO : alpn-impl/alpn-1.8.0_92 dynamic dependency of alpn-impl/alpn-8
|
||||
INFO : alpn transitively enabled, ini template available with --add-to-start=alpn
|
||||
INFO : alpn-impl/alpn-8 dynamic dependency of alpn
|
||||
INFO : http2 initialized in ${jetty.base}/start.d/http2.ini
|
||||
INFO : https initialized in ${jetty.base}/start.d/https.ini
|
||||
INFO : ssl transitively enabled, ini template available with --add-to-start=ssl
|
||||
MKDIR : ${jetty.base}/lib/alpn
|
||||
DOWNLD: http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.8.v20160420/alpn-boot-8.1.8.v20160420.jar to ${jetty.base}/lib/alpn/alpn-boot-8.1.8.v20160420.jar
|
||||
MKDIR : ${jetty.base}/etc
|
||||
COPY : ${jetty.home}/modules/ssl/keystore to ${jetty.base}/etc/keystore
|
||||
INFO : Base directory was modified
|
||||
|
||||
> java -jar $JETTY_HOME/start.jar
|
||||
[...]
|
||||
2017-05-22 12:48:23.271:INFO:oejs.AbstractConnector:main: Started ServerConnector@134d0064{SSL,[ssl, alpn, h2, http/1.1]}{0.0.0.0:8443}
|
||||
[...]
|
||||
----
|
||||
|
||||
The `--add-to-start` command sets up the effective command line in the ini files to run an ssl connection that supports the HTTPS and HTTP2 protocols as follows:
|
||||
|
||||
* transitively enabled the `ssl` module that configures an SSL connector (eg port, keystore etc.) by adding `etc/jetty-ssl.xml` and `etc/jetty-ssl-context.xml` to the effective command line.
|
||||
* transitively enabled the `alpn` module that configures protocol negotiation on the SSL connector by adding `etc/jetty-alpn.xml` to the effective command line.
|
||||
* creates `start.d/https.ini` that configures the HTTPS protocol on the SSL connector by adding `etc/jetty-https.xml` to the effective command line.
|
||||
* creates `start.d/http2.ini` that configures the HTTP/2 protocol on the SSL connector by adding `etc/jetty-http2.xml` to the effective command line.
|
||||
* checks for the existence of a `etc/keystore` file and if not present, downloads a demonstration keystore file.
|
||||
|
||||
[[quickstart-changing-https-port]]
|
||||
===== Changing the Jetty HTTPS Port
|
||||
|
||||
You can configure the SSL connector to run on a different port by setting the `jetty.ssl.port` property on the command line:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> cd $JETTY_BASE
|
||||
> java -jar $JETTY_HOME/start.jar jetty.ssl.port=8444
|
||||
----
|
||||
|
||||
Alternatively, property values can be added to the effective command line built from the `start.ini` file or `start.d/*.ini` files, depending on your set up.
|
||||
Please see the section on link:#start-vs-startd[Start.ini vs. Start.d] for more information.
|
||||
|
||||
==== More start.jar Options
|
||||
|
||||
The job of the `start.jar` is to interpret the command line, `start.ini` and `start.d` directory (and associated .ini files) to build a Java classpath and list of properties and configuration files to pass to the main class of the Jetty XML configuration mechanism.
|
||||
The `start.jar` mechanism has many options which are documented in the xref:startup[] administration section and you can see them in summary by using the command:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> java -jar $JETTY_HOME/start.jar --help
|
||||
----
|
|
@ -28,16 +28,16 @@ ____
|
|||
It is available in both zip and gzip formats; download the one most appropriate for your system.
|
||||
When you download and unpack the binary, it is extracted into a directory called `jetty-distribution-VERSION.`
|
||||
Put this directory in a convenient location.
|
||||
The rest of the instructions in this documentation refer to this location as either `JETTY_HOME` or as `$(jetty.home).`
|
||||
The rest of the instructions in this documentation refer to this location as either `$JETTY_HOME` or as `$(jetty.home).`
|
||||
|
||||
_____
|
||||
[IMPORTANT]
|
||||
It is important that only stable releases are used in production environments.
|
||||
Versions that have been deprecated or are released as Milestones (M) or Release Candidates (RC) are not suitable for production as they may contain security flaws or incomplete/non-functioning feature sets.
|
||||
It is important that *only* stable releases are used in production environments.
|
||||
Versions that have been deprecated or are released as Milestones (M) or Release Candidates (RC) are *not* suitable for production as they may contain security flaws or incomplete/non-functioning feature sets.
|
||||
_____
|
||||
|
||||
[[distribution-content]]
|
||||
==== Distribution Content
|
||||
===== Distribution Content
|
||||
|
||||
A summary of the distribution's contents follows.
|
||||
The top-level directory contains:
|
||||
|
@ -79,7 +79,7 @@ When you download and unpack the binary, it is extracted into a directory called
|
|||
Put this directory in a convenient location.
|
||||
|
||||
[[jetty-home-distribution-content]]
|
||||
==== Distribution Content
|
||||
===== Distribution Content
|
||||
|
||||
A summary of the Jetty-Home's distribution contents follows.
|
||||
The top-level directory contains:
|
||||
|
|
|
@ -17,24 +17,26 @@
|
|||
[[quickstart-running-jetty]]
|
||||
=== Running Jetty
|
||||
|
||||
Once you have a copy of the Jetty distribution downloaded, extract the `zip` or `tar.gz` file to a location where you have read and write access.
|
||||
Jetty has no GUI (Graphical User Interface), so running the server and performing many configuration options is done from the command line.
|
||||
|
||||
Once you have access to your system's command line, navigate to the directory where you unpacked your copy of the Jetty distribution.
|
||||
To start Jetty on the default port of 8080, run the following command:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> cd $JETTY_HOME
|
||||
> java -jar start.jar
|
||||
|
||||
2015-06-04 10:50:44.806:INFO::main: Logging initialized @334ms
|
||||
2015-06-04 10:50:44.858:WARN:oejs.HomeBaseWarning:main: This instance of Jetty is not running from a separate {jetty.base} directory, this is not recommended. See documentation at http://www.eclipse.org/jetty/documentation/current/startup.html
|
||||
2015-06-04 10:50:44.995:INFO:oejs.Server:main: jetty-{VERSION}
|
||||
2015-06-04 10:50:45.012:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///opt/jetty-distribution-{VERSION}/webapps/] at interval 1
|
||||
2015-06-04 10:50:45.030:INFO:oejs.ServerConnector:main: Started ServerConnector@19dfb72a{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
|
||||
2015-06-04 10:50:45.030:INFO:oejs.Server:main: Started @558ms
|
||||
$ java -jar start.jar
|
||||
2017-09-20 15:45:11.986:INFO::main: Logging initialized @683ms to org.eclipse.jetty.util.log.StdErrLog
|
||||
2017-09-20 15:45:12.197:WARN:oejs.HomeBaseWarning:main: This instance of Jetty is not running from a separate {jetty.base} directory, this is not recommended. See documentation at http://www.eclipse.org/jetty/documentation/current/startup.html
|
||||
2017-09-20 15:45:12.243:INFO:oejs.Server:main: {VERSION}
|
||||
2017-09-20 15:45:12.266:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///installs/repository/jetty/webapps/] at interval 1
|
||||
2017-09-20 15:45:12.298:INFO:oejs.AbstractConnector:main: Started ServerConnector@39c0f4a{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
|
||||
2017-09-20 15:45:12.298:INFO:oejs.Server:main: Started @995ms
|
||||
----
|
||||
|
||||
You can point a browser at this server at link:http://localhost:8080[].
|
||||
However, as there are no webapps deployed in the `$JETTY_HOME` directory, you will see a 404 error page served by Jetty.
|
||||
*Note* the HomeBase warning - it is _not_ recommended to run Jetty from the `$JETTY_HOME` directory.
|
||||
*Note* the `HomeBaseWarning` - it is *not* recommended to run Jetty from the `$JETTY_HOME` directory.
|
||||
Instead, see how to link:#creating-jetty-base[create a Jetty Base] below.
|
||||
|
||||
____
|
||||
|
@ -48,50 +50,51 @@ ____
|
|||
[[demo-webapps-base]]
|
||||
==== Demo Base
|
||||
|
||||
Within the standard Jetty distribution there is the `demo-base` directory, which demonstrates the recommended way to run a Jetty base in a directory separate from `$JETTY_HOME`:
|
||||
Within the standard Jetty distribution there is the `demo-base` directory.
|
||||
This is a fully-functioning Jetty Base (more on that later) complete with numerous web applications demonstrating different Jetty functionality.
|
||||
Additionally, the `demo-base` demonstrates the recommended way to run a Jetty base in a directory separate from `$JETTY_HOME`:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> cd $JETTY_HOME/demo-base/
|
||||
> java -jar $JETTY_HOME/start.jar
|
||||
|
||||
2017-08-16 16:55:15.571:INFO::main: Logging initialized @521ms to org.eclipse.jetty.util.log.StdErrLog
|
||||
2017-08-16 16:55:15.907:WARN::main: demo test-realm is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-08-16 16:55:15.910:INFO:oejs.Server:main: jetty-{VERSION}
|
||||
2017-08-16 16:55:15.931:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///tmp/jetty-distribution-{VERSION}/demo-base/webapps/] at interval 1
|
||||
2017-08-16 16:55:16.151:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=50ms
|
||||
2017-08-16 16:55:16.369:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
|
||||
2017-08-16 16:55:16.369:INFO:oejs.session:main: No SessionScavenger set, using defaults
|
||||
2017-08-16 16:55:16.370:INFO:oejs.session:main: Scavenging every 660000ms
|
||||
2017-08-16 16:55:16.416:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@7113b13f{/,file:///tmp/jetty-distribution-{VERSION}/demo-base/webapps/ROOT/,AVAILABLE}{/ROOT}
|
||||
2017-08-16 16:55:16.625:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=82ms
|
||||
2017-08-16 16:55:16.631:WARN::main: test webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-08-16 16:55:16.751:INFO:oejsh.ManagedAttributeListener:main: update PushFilter null->org.eclipse.jetty.servlets.PushCacheFilter@1a677343 on o.e.j.w.WebAppContext@2d7275fc{/test,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test.war-_test-any-7157753932050220016.dir/webapp/,STARTING}{/test.war}
|
||||
2017-08-16 16:55:16.757:INFO:oejsh.ManagedAttributeListener:main: update QoSFilter null->org.eclipse.jetty.servlets.QoSFilter@79079097 on o.e.j.w.WebAppContext@2d7275fc{/test,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test.war-_test-any-7157753932050220016.dir/webapp/,STARTING}{/test.war}
|
||||
2017-08-16 16:55:16.760:WARN:oeju.DeprecationWarning:main: Using @Deprecated Class org.eclipse.jetty.servlets.MultiPartFilter
|
||||
2017-08-16 16:55:16.809:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@2d7275fc{/test,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test.war-_test-any-7157753932050220016.dir/webapp/,AVAILABLE}{/test.war}
|
||||
2017-08-16 16:55:16.816:INFO:oejsh.ContextHandler:main: Started o.e.j.s.h.MovedContextHandler@7c9d8e2{/oldContextPath,null,AVAILABLE}
|
||||
2017-08-16 16:55:16.854:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=23ms
|
||||
2017-08-16 16:55:16.891:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@69453e37{/doc,file:///tmp/jetty-distribution-{VERSION}/demo-base/webapps/doc/,AVAILABLE}{/doc}
|
||||
2017-08-16 16:55:16.942:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=25ms
|
||||
2017-08-16 16:55:16.945:WARN::main: test-jaas webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-08-16 16:55:16.983:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@4e3958e7{/test-jaas,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test-jaas.war-_test-jaas-any-6953571893682159674.dir/webapp/,AVAILABLE}{/test-jaas.war}
|
||||
2017-08-16 16:55:17.106:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=21ms
|
||||
2017-08-16 16:55:17.109:WARN::main: test-jndi webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-08-16 16:55:17.192:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@1d8bd0de{/test-jndi,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test-jndi.war-_test-jndi-any-1246461885510956986.dir/webapp/,AVAILABLE}{/test-jndi.war}
|
||||
2017-08-16 16:55:17.307:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=53ms
|
||||
2017-08-16 16:55:17.310:WARN::main: test-spec webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-08-16 16:55:17.388:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@51dcb805{/test-spec,[file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test-spec.war-_test-spec-any-3750193079644252256.dir/webapp/, jar:file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test-spec.war-_test-spec-any-3750193079644252256.dir/webapp/WEB-INF/lib/test-web-fragment-{VERSION}.jar!/META-INF/resources],AVAILABLE}{/test-spec.war}
|
||||
2017-08-16 16:55:17.490:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=53ms
|
||||
2017-08-16 16:55:17.493:WARN::main: async-rest webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-08-16 16:55:17.516:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@1de76cc7{/async-rest,[file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-async-rest.war-_async-rest-any-8972552397332323832.dir/webapp/, jar:file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-async-rest.war-_async-rest-any-8972552397332323832.dir/webapp/WEB-INF/lib/example-async-rest-jar-{VERSION}.jar!/META-INF/resources],AVAILABLE}{/async-rest.war}
|
||||
2017-08-16 16:55:17.643:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=83ms
|
||||
2017-08-16 16:55:17.921:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@242b836{/proxy,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-javadoc-proxy.war-_javadoc-proxy-any-4521643038409884891.dir/webapp/,AVAILABLE}{/javadoc-proxy.war}
|
||||
2017-08-16 16:55:17.936:INFO:oejs.AbstractConnector:main: Started ServerConnector@6f15d60e{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
|
||||
2017-08-16 16:55:17.944:INFO:oejus.SslContextFactory:main: x509=X509@58e1d9d(jetty,h=[jetty.eclipse.org],w=[]) for SslContextFactory@446a1e84(file:///tmp/jetty-distribution-{VERSION}/demo-base/etc/keystore,file:///tmp/jetty-distribution-{VERSION}/demo-base/etc/keystore)
|
||||
2017-08-16 16:55:17.944:INFO:oejus.SslContextFactory:main: x509=X509@4f0f2942(mykey,h=[],w=[]) for SslContextFactory@446a1e84(file:///tmp/jetty-distribution-{VERSION}/demo-base/etc/keystore,file:///tmp/jetty-distribution-{VERSION}/demo-base/etc/keystore)
|
||||
2017-08-16 16:55:18.071:INFO:oejs.AbstractConnector:main: Started ServerConnector@41488b16{SSL,[ssl, http/1.1]}{0.0.0.0:8443}
|
||||
2017-08-16 16:55:18.072:INFO:oejs.Server:main: Started @3022ms
|
||||
$ cd demo-base/
|
||||
$ java -jar ../start.jar
|
||||
2017-09-20 16:23:03.563:INFO::main: Logging initialized @429ms to org.eclipse.jetty.util.log.StdErrLog
|
||||
2017-09-20 16:23:03.802:WARN::main: demo test-realm is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-09-20 16:23:03.804:INFO:oejs.Server:main: {VERSION}
|
||||
2017-09-20 16:23:03.819:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///installs/repository/jetty/demo-base/webapps/] at interval 1
|
||||
2017-09-20 16:23:04.098:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=102ms
|
||||
2017-09-20 16:23:04.103:WARN::main: async-rest webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-09-20 16:23:04.267:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
|
||||
2017-09-20 16:23:04.267:INFO:oejs.session:main: No SessionScavenger set, using defaults
|
||||
2017-09-20 16:23:04.268:INFO:oejs.session:main: Scavenging every 660000ms
|
||||
2017-09-20 16:23:04.306:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@371a67ec{/async-rest,[file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-async-rest.war-_async-rest-any-5319296087878801290.dir/webapp/, jar:file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-async-rest.war-_async-rest-any-5319296087878801290.dir/webapp/WEB-INF/lib/example-async-rest-jar-{VERSION}.jar!/META-INF/resources],AVAILABLE}{/async-rest.war}
|
||||
2017-09-20 16:23:04.429:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=53ms
|
||||
2017-09-20 16:23:04.432:WARN::main: test webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-09-20 16:23:04.511:INFO:oejsh.ManagedAttributeListener:main: update PushFilter null->org.eclipse.jetty.servlets.PushCacheFilter@2362f559 on o.e.j.w.WebAppContext@35e2d654{/test,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test.war-_test-any-6279588879522983394.dir/webapp/,STARTING}{/test.war}
|
||||
2017-09-20 16:23:04.516:INFO:oejsh.ManagedAttributeListener:main: update QoSFilter null->org.eclipse.jetty.servlets.QoSFilter@7770f470 on o.e.j.w.WebAppContext@35e2d654{/test,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test.war-_test-any-6279588879522983394.dir/webapp/,STARTING}{/test.war}
|
||||
2017-09-20 16:23:04.519:WARN:oeju.DeprecationWarning:main: Using @Deprecated Class org.eclipse.jetty.servlets.MultiPartFilter
|
||||
2017-09-20 16:23:04.549:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@35e2d654{/test,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test.war-_test-any-6279588879522983394.dir/webapp/,AVAILABLE}{/test.war}
|
||||
2017-09-20 16:23:04.646:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=12ms
|
||||
2017-09-20 16:23:04.649:WARN::main: test-jndi webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-09-20 16:23:04.697:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@561b6512{/test-jndi,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test-jndi.war-_test-jndi-any-6023636263414992288.dir/webapp/,AVAILABLE}{/test-jndi.war}
|
||||
2017-09-20 16:23:04.770:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=40ms
|
||||
2017-09-20 16:23:05.036:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@2beee7ff{/proxy,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-javadoc-proxy.war-_javadoc-proxy-any-2758874759195597975.dir/webapp/,AVAILABLE}{/javadoc-proxy.war}
|
||||
2017-09-20 16:23:05.072:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=16ms
|
||||
2017-09-20 16:23:05.074:WARN::main: test-jaas webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-09-20 16:23:05.098:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@506ae4d4{/test-jaas,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test-jaas.war-_test-jaas-any-8067423971450448377.dir/webapp/,AVAILABLE}{/test-jaas.war}
|
||||
2017-09-20 16:23:05.182:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=37ms
|
||||
2017-09-20 16:23:05.184:WARN::main: test-spec webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2017-09-20 16:23:05.243:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@45099dd3{/test-spec,[file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test-spec.war-_test-spec-any-1205866915335004234.dir/webapp/, jar:file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test-spec.war-_test-spec-any-1205866915335004234.dir/webapp/WEB-INF/lib/test-web-fragment-{VERSION}.jar!/META-INF/resources],AVAILABLE}{/test-spec.war}
|
||||
2017-09-20 16:23:05.247:INFO:oejsh.ContextHandler:main: Started o.e.j.s.h.MovedContextHandler@3e08ff24{/oldContextPath,null,AVAILABLE}
|
||||
2017-09-20 16:23:05.274:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=18ms
|
||||
2017-09-20 16:23:05.296:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@5ddeb7cb{/,file:///installs/repository/jetty/demo-base/webapps/ROOT/,AVAILABLE}{/ROOT}
|
||||
2017-09-20 16:23:05.326:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=21ms
|
||||
2017-09-20 16:23:05.352:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@6b695b06{/doc,file:///installs/repository/jetty/demo-base/webapps/doc/,AVAILABLE}{/doc}
|
||||
2017-09-20 16:23:05.370:INFO:oejs.AbstractConnector:main: Started ServerConnector@28cda624{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
|
||||
2017-09-20 16:23:05.380:INFO:oejus.SslContextFactory:main: x509=X509@126253fd(jetty,h=[jetty.eclipse.org],w=[]) for SslContextFactory@57db2b13(file:///installs/repository/jetty/demo-base/etc/keystore,file:///installs/repository/jetty/demo-base/etc/keystore)
|
||||
2017-09-20 16:23:05.381:INFO:oejus.SslContextFactory:main: x509=X509@475c9c31(mykey,h=[],w=[]) for SslContextFactory@57db2b13(file:///installs/repository/jetty/demo-base/etc/keystore,ffile:///installs/repository/jetty/demo-base/etc/keystore)
|
||||
2017-09-20 16:23:05.523:INFO:oejs.AbstractConnector:main: Started ServerConnector@53f3bdbd{SSL,[ssl, http/1.1]}{0.0.0.0:8443}
|
||||
2017-09-20 16:23:05.524:INFO:oejs.Server:main: Started @2390ms
|
||||
----
|
||||
|
||||
You can visit this demo server by pointing a browser at link:http://localhost:8080[], which will now show a welcome page and several demo/test web applications.
|
||||
|
@ -101,7 +104,7 @@ ____
|
|||
The demonstration web applications are not necessarily secure and should *not* be deployed in production web servers.
|
||||
____
|
||||
|
||||
You can see the configuration of the demo-base by using the following commands:
|
||||
You can see the configuration of the `demo-base` by using the following commands:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
|
@ -118,170 +121,3 @@ It will also display the location of the modules, how and in what order they are
|
|||
|
||||
The `--list-config` command displays a trove of information about the server including the Java and Jetty environments, the configuration order, any JVM arguments or System Properties set, general server properties, a full listing of the Jetty server class path, and active Jetty XML files.
|
||||
|
||||
[[creating-jetty-base]]
|
||||
==== Creating a new Jetty Base
|
||||
|
||||
The `demo-base` directory described above is an example of the link:#startup-base-and-home[`jetty.base`] mechanism.
|
||||
A Jetty base directory allows the configuration and web applications of a server instance to be stored separately from the Jetty distribution, so that upgrades can be done with minimal disruption.
|
||||
Jetty's default configuration is based on two properties:
|
||||
|
||||
jetty.home::
|
||||
The property that defines the location of the Jetty distribution, its libs, default modules and default XML files (typically start.jar, lib, etc).
|
||||
jetty.base::
|
||||
The property that defines the location of a specific implementation of a Jetty server, its configuration, logs and web applications (typically start.d/*.ini files, logs and webapps).
|
||||
|
||||
____
|
||||
[IMPORTANT]
|
||||
Your Jetty Home directory should be treated as a standard of truth and remain unmodified or changed.
|
||||
Changes or additions to your configuration should take place in the Jetty Base directory.
|
||||
____
|
||||
|
||||
The `jetty.home` and `jetty.base` properties may be explicitly set on the command line, or they can be inferred from the environment if used with commands like:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> cd $JETTY_BASE
|
||||
> java -jar $JETTY_HOME/start.jar
|
||||
----
|
||||
|
||||
The following commands create a new base directory, enables both the HTTP connector and the web application deployer modules, and copies a demo webapp to be deployed:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> JETTY_BASE=/tmp/mybase
|
||||
> mkdir $JETTY_BASE
|
||||
> cd $JETTY_BASE
|
||||
> java -jar $JETTY_HOME/start.jar
|
||||
|
||||
WARNING: Nothing to start, exiting ...
|
||||
|
||||
Usage: java -jar start.jar [options] [properties] [configs]
|
||||
java -jar start.jar --help # for more information
|
||||
|
||||
> java -jar $JETTY_HOME/start.jar --create-startd
|
||||
INFO : Base directory was modified
|
||||
> java -jar $JETTY_HOME/start.jar --add-to-start=http,deploy
|
||||
|
||||
INFO: server initialised (transitively) in ${jetty.base}/start.d/server.ini
|
||||
INFO: http initialised in ${jetty.base}/start.d/http.ini
|
||||
INFO: security initialised (transitively) in ${jetty.base}/start.d/security.ini
|
||||
INFO: servlet initialised (transitively) in ${jetty.base}/start.d/servlet.ini
|
||||
INFO: webapp initialised (transitively) in ${jetty.base}/start.d/webapp.ini
|
||||
INFO: deploy initialised in ${jetty.base}/start.d/deploy.ini
|
||||
MKDIR: ${jetty.base}/webapps
|
||||
INFO: Base directory was modified
|
||||
|
||||
> cp $JETTY_HOME/demo-base/webapps/async-rest.war webapps/ROOT.war
|
||||
> java -jar $JETTY_HOME/start.jar
|
||||
|
||||
2015-06-04 11:10:16.286:INFO::main: Logging initialized @274ms
|
||||
2015-06-04 11:10:16.440:INFO:oejs.Server:main: jetty-9.3.0.v20150601
|
||||
2015-06-04 11:10:16.460:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///tmp/mybase/webapps/] at interval 1
|
||||
2015-06-04 11:10:16.581:WARN::main: async-rest webapp is deployed. DO NOT USE IN PRODUCTION!
|
||||
2015-06-04 11:10:16.589:INFO:oejw.StandardDescriptorProcessor:main: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
|
||||
2015-06-04 11:10:16.628:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@1a407d53{/,[file:///tmp/jetty-0.0.0.0-8080-ROOT.war-_-any-4510228025526425427.dir/webapp/, jar:file:///tmp/jetty-0.0.0.0-8080-ROOT.war-_-any-4510228025526425427.dir/webapp/WEB-INF/lib/example-async-rest-jar-{VERSION}.jar!/META-INF/resources],AVAILABLE}{/ROOT.war}
|
||||
2015-06-04 11:10:16.645:INFO:oejs.ServerConnector:main: Started ServerConnector@3abbfa04{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
|
||||
2015-06-04 11:10:16.646:INFO:oejs.Server:main: Started @634ms
|
||||
----
|
||||
|
||||
[[quickstart-changing-jetty-port]]
|
||||
==== Changing the Jetty Port
|
||||
|
||||
You can configure Jetty to run on a different port by setting the `jetty.http.port` property on the command line:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> cd $JETTY_BASE
|
||||
> java -jar $JETTY_HOME/start.jar jetty.http.port=8081
|
||||
...
|
||||
----
|
||||
|
||||
When the server starts, it will now run on port 8081.
|
||||
It is important to note that setting properties on the command line will only take affect for that instance of the server.
|
||||
To change the configuration so that the server will always start on the desired port, you will need to edit the `start.d/http.ini`
|
||||
|
||||
____
|
||||
[NOTE]
|
||||
--
|
||||
The configuration by properties works via the following chain:
|
||||
|
||||
* The start.d/http.ini file is part of the effective command line and contains the --module=http argument which activates the http module.
|
||||
* The modules/http.mod file defines the http module which specifies the etc/jetty-http.xml configuration file and the template ini properties it uses.
|
||||
* The jetty.http.port property is used by the Property XML element in etc/jetty.http.xml to inject the ServerConnector instance with the port.
|
||||
|
||||
For more information see the link:#quick-start-configure[Quickstart Configuration Guide] and link:#configuring-connectors[Configuring Connectors].
|
||||
--
|
||||
____
|
||||
|
||||
[[quickstart-starting-https]]
|
||||
==== Adding SSL for HTTPS & HTTP2
|
||||
|
||||
Building on the example above, we can activate additional modules to add support HTTPS and HTTP2 for the server.
|
||||
To add HTTPS and HTTP2 connectors to a Jetty configuration, the modules can be activated by the following command:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> java -jar $JETTY_HOME/start.jar --add-to-start=https,http2
|
||||
|
||||
ALERT: There are enabled module(s) with licenses.
|
||||
The following 1 module(s):
|
||||
+ contains software not provided by the Eclipse Foundation!
|
||||
+ contains software not covered by the Eclipse Public License!
|
||||
+ has not been audited for compliance with its license
|
||||
|
||||
Module: alpn-impl/alpn-8
|
||||
+ ALPN is a hosted at github under the GPL v2 with ClassPath Exception.
|
||||
+ ALPN replaces/modifies OpenJDK classes in the sun.security.ssl package.
|
||||
+ http://github.com/jetty-project/jetty-alpn
|
||||
+ http://openjdk.java.net/legal/gplv2+ce.html
|
||||
|
||||
Proceed (y/N)? y
|
||||
INFO : alpn-impl/alpn-1.8.0_92 dynamic dependency of alpn-impl/alpn-8
|
||||
INFO : alpn transitively enabled, ini template available with --add-to-start=alpn
|
||||
INFO : alpn-impl/alpn-8 dynamic dependency of alpn
|
||||
INFO : http2 initialized in ${jetty.base}/start.d/http2.ini
|
||||
INFO : https initialized in ${jetty.base}/start.d/https.ini
|
||||
INFO : ssl transitively enabled, ini template available with --add-to-start=ssl
|
||||
MKDIR : ${jetty.base}/lib/alpn
|
||||
DOWNLD: http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.8.v20160420/alpn-boot-8.1.8.v20160420.jar to ${jetty.base}/lib/alpn/alpn-boot-8.1.8.v20160420.jar
|
||||
MKDIR : ${jetty.base}/etc
|
||||
COPY : ${jetty.home}/modules/ssl/keystore to ${jetty.base}/etc/keystore
|
||||
INFO : Base directory was modified
|
||||
|
||||
> java -jar $JETTY_HOME/start.jar
|
||||
[...]
|
||||
2017-05-22 12:48:23.271:INFO:oejs.AbstractConnector:main: Started ServerConnector@134d0064{SSL,[ssl, alpn, h2, http/1.1]}{0.0.0.0:8443}
|
||||
[...]
|
||||
----
|
||||
|
||||
The `--add-to-start` command sets up the effective command line in the ini files to run an ssl connection that supports the HTTPS and HTTP2 protocols as follows:
|
||||
|
||||
* transitively enabled the `ssl` module that configures an SSL connector (eg port, keystore etc.) by adding `etc/jetty-ssl.xml` and `etc/jetty-ssl-context.xml` to the effective command line.
|
||||
* transitively enabled the `alpn` module that configures protocol negotiation on the SSL connector by adding `etc/jetty-alpn.xml` to the effective command line.
|
||||
* creates `start.d/https.ini` that configures the HTTPS protocol on the SSL connector by adding `etc/jetty-https.xml` to the effective command line.
|
||||
* creates `start.d/http2.ini` that configures the HTTP/2 protocol on the SSL connector by adding `etc/jetty-http2.xml` to the effective command line.
|
||||
* checks for the existence of a `etc/keystore` file and if not present, downloads a demonstration keystore file.
|
||||
|
||||
[[quickstart-changing-https-port]]
|
||||
===== Changing the Jetty HTTPS Port
|
||||
|
||||
You can configure the SSL connector to run on a different port by setting the `jetty.ssl.port` property on the command line:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> cd $JETTY_BASE
|
||||
> java -jar $JETTY_HOME/start.jar jetty.ssl.port=8444
|
||||
----
|
||||
|
||||
Alternatively, property values can be added to the effective command line built from the `start.ini` file or `start.d/*.ini` files, depending on your set up.
|
||||
Please see the section on link:#start-vs-startd[Start.ini vs. Start.d] for more information.
|
||||
|
||||
==== More start.jar options
|
||||
|
||||
The job of the `start.jar` is to interpret the command line, `start.ini` and `start.d` directory (and associated .ini files) to build a Java classpath and list of properties and configuration files to pass to the main class of the Jetty XML configuration mechanism.
|
||||
The `start.jar` mechanism has many options which are documented in the xref:startup[] administration section and you can see them in summary by using the command:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
----
|
||||
> java -jar $JETTY_HOME/start.jar --help
|
||||
----
|
||||
|
|
Loading…
Reference in New Issue