mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-03 20:39:18 +00:00
* Issue #5264 Jetty Home warning Warn when using jetty home as a jetty base * Issue #5304 HTTP2 HostHeader + updated more options doco and handling Signed-off-by: Greg Wilkins <gregw@webtide.com> * Issue #5264 Jetty Home warning updates from review
This commit is contained in:
parent
12943822f5
commit
592dfb85fc
@ -101,9 +101,7 @@
|
||||
<!-- handler by context path and virtual host, and the -->
|
||||
<!-- DefaultHandler, which handles any requests not handled by -->
|
||||
<!-- the context handlers. -->
|
||||
<!-- Other handlers may be added to the "Handlers" collection, -->
|
||||
<!-- for example the jetty-requestlog.xml file adds the -->
|
||||
<!-- RequestLogHandler after the default handler -->
|
||||
<!-- Other handlers may be added to the "Handlers" collection. -->
|
||||
<!-- =========================================================== -->
|
||||
<Set name="handler">
|
||||
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerList">
|
||||
|
@ -311,7 +311,7 @@
|
||||
<argument>jetty.home=${home-directory}</argument>
|
||||
<argument>jetty.base=${base-directory}</argument>
|
||||
<argument>--create-startd</argument>
|
||||
<argument>--add-to-start=server,requestlog,deploy,websocket,ext,resources,client,annotations,jndi,servlets,jsp,jstl,http,https,demo</argument>
|
||||
<argument>--add-module=server,requestlog,deploy,websocket,ext,resources,client,annotations,jndi,servlets,jsp,jstl,http,https,demo</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
<goals>
|
||||
|
@ -18,8 +18,10 @@
|
||||
|
||||
package org.eclipse.jetty.start;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
@ -28,6 +30,7 @@ import java.nio.file.PathMatcher;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@ -176,7 +179,9 @@ public class BaseBuilder
|
||||
{
|
||||
if (!Files.exists(startini))
|
||||
{
|
||||
StartLog.info("create " + baseHome.toShortForm(startini));
|
||||
if (Files.exists(getBaseHome().getBasePath("start.jar")))
|
||||
StartLog.warn("creating start.ini in ${jetty.home} is not recommended!");
|
||||
StartLog.info("create %s", baseHome.toShortForm(startini));
|
||||
Files.createFile(startini);
|
||||
modified.set(true);
|
||||
}
|
||||
@ -222,72 +227,98 @@ public class BaseBuilder
|
||||
}
|
||||
}
|
||||
|
||||
if (!newlyAdded.isEmpty())
|
||||
if ((startArgs.isCreateStartD() && (!Files.exists(startd) || Files.exists(startini))) ||
|
||||
(!newlyAdded.isEmpty() && !Files.exists(startini) && !Files.exists(startd)))
|
||||
{
|
||||
if (!Files.exists(startini) && !Files.exists(startd) && FS.ensureDirectoryExists(startd))
|
||||
if (Files.exists(getBaseHome().getBasePath("start.jar")) && !startArgs.isCreateStartD())
|
||||
{
|
||||
StartLog.warn("creating start.d in ${jetty.home} is not recommended!");
|
||||
if (!startArgs.isCreateStartD())
|
||||
{
|
||||
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
|
||||
System.err.printf("%nProceed (y/N)? ");
|
||||
String response = input.readLine();
|
||||
|
||||
if (Utils.isBlank(response) || !response.toLowerCase(Locale.ENGLISH).startsWith("y"))
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (FS.ensureDirectoryExists(startd))
|
||||
{
|
||||
StartLog.info("mkdir " + baseHome.toShortForm(startd));
|
||||
modified.set(true);
|
||||
}
|
||||
|
||||
if (Files.exists(startini) && Files.exists(startd))
|
||||
StartLog.warn("Use both %s and %s is deprecated", getBaseHome().toShortForm(startd), getBaseHome().toShortForm(startini));
|
||||
|
||||
boolean useStartD = Files.exists(startd);
|
||||
builder.set(useStartD ? new StartDirBuilder(this) : new StartIniBuilder(this));
|
||||
newlyAdded.stream().map(modules::get).forEach(module ->
|
||||
if (Files.exists(startini) && startArgs.isCreateStartD())
|
||||
{
|
||||
String ini = null;
|
||||
try
|
||||
int ini = 0;
|
||||
Path startdStartini = startd.resolve("start.ini");
|
||||
while (Files.exists(startdStartini))
|
||||
{
|
||||
if (module.isSkipFilesValidation())
|
||||
{
|
||||
StartLog.debug("Skipping [files] validation on %s", module.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (explicitly added and ini file modified)
|
||||
if (startArgs.getStartModules().contains(module.getName()))
|
||||
{
|
||||
ini = builder.get().addModule(module, startArgs.getProperties());
|
||||
if (ini != null)
|
||||
modified.set(true);
|
||||
}
|
||||
for (String file : module.getFiles())
|
||||
{
|
||||
files.add(new FileArg(module, startArgs.getProperties().expand(file)));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
ini++;
|
||||
startdStartini = startd.resolve("start" + ini + ".ini");
|
||||
}
|
||||
Files.move(startini, startdStartini);
|
||||
modified.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (module.isDynamic())
|
||||
boolean useStartD = Files.exists(startd);
|
||||
if (useStartD && Files.exists(startini))
|
||||
StartLog.warn("Use of both %s and %s is deprecated", getBaseHome().toShortForm(startd), getBaseHome().toShortForm(startini));
|
||||
|
||||
builder.set(useStartD ? new StartDirBuilder(this) : new StartIniBuilder(this));
|
||||
newlyAdded.stream().map(modules::get).forEach(module ->
|
||||
{
|
||||
String ini = null;
|
||||
try
|
||||
{
|
||||
if (module.isSkipFilesValidation())
|
||||
{
|
||||
for (String s : module.getEnableSources())
|
||||
{
|
||||
StartLog.info("%-15s %s", module.getName(), s);
|
||||
}
|
||||
}
|
||||
else if (module.isTransitive())
|
||||
{
|
||||
if (module.hasIniTemplate())
|
||||
StartLog.info("%-15s transitively enabled, ini template available with --add-module=%s",
|
||||
module.getName(),
|
||||
module.getName());
|
||||
else
|
||||
StartLog.info("%-15s transitively enabled", module.getName());
|
||||
StartLog.debug("Skipping [files] validation on %s", module.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
StartLog.info("%-15s initialized in %s",
|
||||
module.getName(),
|
||||
ini);
|
||||
// if (explicitly added and ini file modified)
|
||||
if (startArgs.getStartModules().contains(module.getName()))
|
||||
{
|
||||
ini = builder.get().addModule(module, startArgs.getProperties());
|
||||
if (ini != null)
|
||||
modified.set(true);
|
||||
}
|
||||
for (String file : module.getFiles())
|
||||
{
|
||||
files.add(new FileArg(module, startArgs.getProperties().expand(file)));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (module.isDynamic())
|
||||
{
|
||||
for (String s : module.getEnableSources())
|
||||
{
|
||||
StartLog.info("%-15s %s", module.getName(), s);
|
||||
}
|
||||
}
|
||||
else if (module.isTransitive())
|
||||
{
|
||||
if (module.hasIniTemplate())
|
||||
StartLog.info("%-15s transitively enabled, ini template available with --add-module=%s",
|
||||
module.getName(),
|
||||
module.getName());
|
||||
else
|
||||
StartLog.info("%-15s transitively enabled", module.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
StartLog.info("%-15s initialized in %s", module.getName(), ini);
|
||||
}
|
||||
});
|
||||
|
||||
files.addAll(startArgs.getFiles());
|
||||
if (!files.isEmpty() && processFileResources(files))
|
||||
|
@ -230,6 +230,7 @@ public class StartArgs
|
||||
private boolean dryRun = false;
|
||||
private final Set<String> dryRunParts = new HashSet<>();
|
||||
private boolean jpms = false;
|
||||
private boolean createStartD = false;
|
||||
private boolean createStartIni = false;
|
||||
private boolean updateIni = false;
|
||||
private String mavenBaseUri;
|
||||
@ -716,7 +717,6 @@ public class StartArgs
|
||||
|
||||
Prop p = processSystemProperty(key, value, null);
|
||||
cmd.addRawArg("-D" + p.key + "=" + getProperties().expand(p.value));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1024,6 +1024,11 @@ public class StartArgs
|
||||
return version;
|
||||
}
|
||||
|
||||
public boolean isCreateStartD()
|
||||
{
|
||||
return createStartD;
|
||||
}
|
||||
|
||||
public boolean isCreateStartIni()
|
||||
{
|
||||
return createStartIni;
|
||||
@ -1289,9 +1294,9 @@ public class StartArgs
|
||||
licenseCheckRequired = true;
|
||||
return;
|
||||
}
|
||||
if ("--create-startd".equals(arg))
|
||||
if ("--create-startd".equals(arg) || "--create-start-d".equals(arg))
|
||||
{
|
||||
StartLog.warn("--create-startd option is deprecated! By default start.d is used");
|
||||
createStartD = true;
|
||||
run = false;
|
||||
createFiles = true;
|
||||
licenseCheckRequired = true;
|
||||
|
@ -73,6 +73,7 @@ public class DirConfigSource implements ConfigSource
|
||||
BANNED_ARGS.add("--create-files");
|
||||
BANNED_ARGS.add("--create-startd");
|
||||
BANNED_ARGS.add("--create-start-ini");
|
||||
BANNED_ARGS.add("--create-start-d");
|
||||
BANNED_ARGS.add("--add-to-startd");
|
||||
BANNED_ARGS.add("--add-to-start");
|
||||
BANNED_ARGS.add("--add-module");
|
||||
|
@ -120,19 +120,25 @@ Jetty Module Management:
|
||||
amended in the generated file by specifying those
|
||||
properties on the command line.
|
||||
|
||||
If a module is transitively enabled, it's ini file will not
|
||||
If a module is transitively enabled, its ini file will not
|
||||
be generated. An explicit --add-module is required to generate
|
||||
an ini file.
|
||||
|
||||
This option replaces the depecated --add-to-start and --add-to-startd.
|
||||
This option replaces the deprecated --add-to-start and --add-to-startd.
|
||||
|
||||
--update-ini Scan all start.ini and start.d/*.ini files and update
|
||||
any properties with values specified on the command
|
||||
line. e.g. --update-ini jetty.http.port=8888
|
||||
|
||||
--create-start-d
|
||||
Create a ${jetty.base}/start.d directory. If a ${jetty.base}/start.ini
|
||||
files exists, then it is moved into start.d. Using a start.d directory
|
||||
is the default and this option is only needed to either force the creation of a
|
||||
${jetty.home}/start.d or to move a start.ini file to start.d
|
||||
|
||||
--create-start-ini
|
||||
Create a ${jetty.base}/start.ini file. If a ${jetty.base}/start.d
|
||||
directory exists, then all it's contained ini files are concatinated into
|
||||
directory exists, then all its contained ini files are concatenated into
|
||||
the start.ini file.
|
||||
|
||||
--write-module-graph=<filename>
|
||||
@ -216,7 +222,7 @@ Properties:
|
||||
If any of the previous formats is preceded by -D, then a system property is set
|
||||
as well as a start property.
|
||||
|
||||
Each module may define it's own properties. Start properties defined include:
|
||||
Each module may define its own properties. Start properties defined include:
|
||||
|
||||
jetty.home=[directory]
|
||||
Set the home directory of the jetty distribution.
|
||||
|
Loading…
x
Reference in New Issue
Block a user