Merge branch 'jetty-9.1' into jetty-9.1-altstart
Conflicts: jetty-start/src/main/java/org/eclipse/jetty/start/Config.java jetty-start/src/main/java/org/eclipse/jetty/start/HomeBase.java jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
This commit is contained in:
commit
344eab0bbf
|
@ -0,0 +1,26 @@
|
|||
|
||||
This start.d directory contains modular ini files that are appended to the effective command line
|
||||
used to start jetty by the command:
|
||||
|
||||
java -jar start.jar
|
||||
|
||||
|
||||
The modules are executed in alphabetic order and the 'NNN-' prefixes are a convention to make that ordering
|
||||
explicit regardless of module name.
|
||||
|
||||
All modules ending with '.ini' will be executed and it is a convention that disabled modules are renamed to
|
||||
end with '.ini.disabled'. The start.jar mechanism can be used to enable/disable modules with commands like:
|
||||
|
||||
java -jar start.jar --enable=ssl --enable=spdy
|
||||
|
||||
Note that the numeric prefix can be skipped in such commands.
|
||||
|
||||
|
||||
The ini modules have a simple dependency mechanism so a module can declare if it depends on or conflicts with
|
||||
other modules. For example the spdy module includes the entries:
|
||||
|
||||
EXCLUDE=https
|
||||
DEPEND=npn,ssl
|
||||
|
||||
This says that spdy cannot be used with the https module (both use the same port and spdy provides https) and
|
||||
that the npn and ssl modules must also be enabled.
|
|
@ -3,5 +3,10 @@ This directory is scanned by the demo WebAppDeployer provider
|
|||
created in the etc/jetty-demo.xml file and enabled by the
|
||||
start.d/900-demo.ini file.
|
||||
|
||||
For normal deployment, use the webapps directory.
|
||||
To disable the demo, either remove the start.d/900-demo.ini or issue the following command:
|
||||
|
||||
java -jar start.jar --disable=demo
|
||||
|
||||
|
||||
For normal webapp deployment, use the webapps directory.
|
||||
|
||||
|
|
|
@ -23,3 +23,11 @@ only the XML is deployed (which may use the war in its configuration).
|
|||
This directory is scanned for additions, removals and updates
|
||||
for hot deployment.
|
||||
|
||||
To configure the deployment mechanism, edit the files:
|
||||
start.d/500-deploy.ini
|
||||
etc/jetty-deploy.ini
|
||||
|
||||
To disable the auto deploy mechanism use the command:
|
||||
|
||||
java -jar start.jar --disable=deploy
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ public class HttpOutput extends ServletOutputStream implements Runnable
|
|||
private long _written;
|
||||
private ByteBuffer _aggregate;
|
||||
private int _bufferSize;
|
||||
private int _commitSize;
|
||||
private WriteListener _writeListener;
|
||||
private volatile Throwable _onError;
|
||||
|
||||
|
@ -79,6 +80,7 @@ write completed - - - ASYNC READY->owp
|
|||
{
|
||||
_channel = channel;
|
||||
_bufferSize = _channel.getHttpConfiguration().getOutputBufferSize();
|
||||
_commitSize=_bufferSize/4;
|
||||
}
|
||||
|
||||
public boolean isWritten()
|
||||
|
@ -231,7 +233,7 @@ write completed - - - ASYNC READY->owp
|
|||
|
||||
// Should we aggregate?
|
||||
int capacity = getBufferSize();
|
||||
if (!complete && len<=capacity/4)
|
||||
if (!complete && len<=_commitSize)
|
||||
{
|
||||
if (_aggregate == null)
|
||||
_aggregate = _channel.getByteBufferPool().acquire(capacity, false);
|
||||
|
@ -271,7 +273,7 @@ write completed - - - ASYNC READY->owp
|
|||
|
||||
// Should we aggregate?
|
||||
int capacity = getBufferSize();
|
||||
if (!complete && len<=capacity/4)
|
||||
if (!complete && len<=_commitSize)
|
||||
{
|
||||
if (_aggregate == null)
|
||||
_aggregate = _channel.getByteBufferPool().acquire(capacity, false);
|
||||
|
@ -294,7 +296,7 @@ write completed - - - ASYNC READY->owp
|
|||
_channel.write(_aggregate, complete && len==0);
|
||||
|
||||
// should we fill aggregate again from the buffer?
|
||||
if (len>0 && !complete && len<=_aggregate.capacity()/4)
|
||||
if (len>0 && !complete && len<=_commitSize)
|
||||
{
|
||||
BufferUtil.append(_aggregate, b, off, len);
|
||||
return;
|
||||
|
@ -596,7 +598,8 @@ write completed - - - ASYNC READY->owp
|
|||
|
||||
public void setBufferSize(int size)
|
||||
{
|
||||
this._bufferSize = size;
|
||||
_bufferSize = size;
|
||||
_commitSize = size;
|
||||
}
|
||||
|
||||
public void resetBuffer()
|
||||
|
@ -704,12 +707,10 @@ write completed - - - ASYNC READY->owp
|
|||
return false;
|
||||
}
|
||||
|
||||
// TODO write comments
|
||||
if (!_complete && _len<BufferUtil.space(_aggregate) && _len<_aggregate.capacity()/4)
|
||||
if (!_complete && _len<BufferUtil.space(_aggregate) && _len<_commitSize)
|
||||
{
|
||||
BufferUtil.put(_buffer,_aggregate);
|
||||
}
|
||||
// TODO write comments
|
||||
else if (_len>0 && !_flushed)
|
||||
{
|
||||
_flushed=true;
|
||||
|
|
|
@ -162,7 +162,7 @@ public class Config
|
|||
{
|
||||
ver = "Unknown";
|
||||
}
|
||||
_version = ver;
|
||||
__version = ver;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,8 +170,10 @@ public class Config
|
|||
*/
|
||||
private final Comparator<String> keySorter = new NaturalSort.Strings();
|
||||
|
||||
private static final String _version;
|
||||
private static final String __version;
|
||||
private static boolean DEBUG = false;
|
||||
private static Config __instance;
|
||||
|
||||
private final HomeBase _homebase;
|
||||
private final Map<String, String> _properties = new HashMap<String, String>();
|
||||
private final Map<String, Classpath> _classpaths = new HashMap<String, Classpath>();
|
||||
|
@ -199,6 +201,7 @@ public class Config
|
|||
|
||||
public Config()
|
||||
{
|
||||
__instance=this;
|
||||
_homebase = new HomeBase();
|
||||
setProperty("jetty.home",_homebase.getHome());
|
||||
setProperty("jetty.base",_homebase.getBase());
|
||||
|
@ -408,7 +411,8 @@ public class Config
|
|||
_properties.clear();
|
||||
}
|
||||
|
||||
public Properties getProperties()
|
||||
/* This method is static so it can be accessed by XmlConfiguration */
|
||||
public static Properties getProperties()
|
||||
{
|
||||
Properties properties = new Properties();
|
||||
// Add System Properties First
|
||||
|
@ -418,8 +422,8 @@ public class Config
|
|||
properties.put(name, System.getProperty(name));
|
||||
}
|
||||
// Add Config Properties Next (overwriting any System Properties that exist)
|
||||
for (String key : _properties.keySet()) {
|
||||
properties.put(key,_properties.get(key));
|
||||
for (String key : __instance._properties.keySet()) {
|
||||
properties.put(key,__instance._properties.get(key));
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
@ -427,7 +431,7 @@ public class Config
|
|||
public String getProperty(String name)
|
||||
{
|
||||
if ("version".equalsIgnoreCase(name)) {
|
||||
return _version;
|
||||
return __version;
|
||||
}
|
||||
// Search Config Properties First
|
||||
if (_properties.containsKey(name)) {
|
||||
|
|
|
@ -51,7 +51,7 @@ public class HomeBase
|
|||
public HomeBase(File homeDir, File baseDir)
|
||||
{
|
||||
this.homeDir = homeDir;
|
||||
this.baseDir = baseDir;
|
||||
this.baseDir = baseDir==null?homeDir:baseDir;
|
||||
}
|
||||
|
||||
public boolean isBaseDifferent()
|
||||
|
|
|
@ -47,6 +47,8 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.jetty.start.StartIni.IncludeListener;
|
||||
|
||||
|
@ -65,6 +67,7 @@ public class Main implements IncludeListener
|
|||
{
|
||||
private static final String START_LOG_FILENAME = "start.log";
|
||||
private static final SimpleDateFormat START_LOG_ROLLOVER_DATEFORMAT = new SimpleDateFormat("yyyy_MM_dd-HHmmSSSSS.'" + START_LOG_FILENAME + "'");
|
||||
private static final Pattern NNN_MODULE_INI = Pattern.compile("^(\\d\\d\\d-)(.*?\\.ini)(\\.disabled)?$");
|
||||
|
||||
private static final int EXIT_USAGE = 1;
|
||||
private static final int ERR_LOGGING = -1;
|
||||
|
@ -130,7 +133,7 @@ public class Main implements IncludeListener
|
|||
}
|
||||
if (!ini)
|
||||
{
|
||||
arguments.add("--ini=start.ini");
|
||||
arguments.add(0,"--ini=start.ini");
|
||||
}
|
||||
|
||||
// The XML Configuration Files to initialize with
|
||||
|
@ -1183,7 +1186,7 @@ public class Main implements IncludeListener
|
|||
final String mini = module + ".ini";
|
||||
final String disable = module + ".ini.disabled";
|
||||
|
||||
FileFilter disabledModuleFilter = new FS.FileNamesFilter(mini, disable);
|
||||
FileFilter disabledModuleFilter = new FS.FilenameRegexFilter("(\\d\\d\\d-)?"+Pattern.quote(module)+"\\.ini(\\.disabled)?");
|
||||
|
||||
HomeBase hb = _config.getHomeBase();
|
||||
|
||||
|
@ -1206,6 +1209,25 @@ public class Main implements IncludeListener
|
|||
file.renameTo(new File(file.getParentFile(),mini));
|
||||
found = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Matcher matcher = NNN_MODULE_INI.matcher(n);
|
||||
if (matcher.matches())
|
||||
{
|
||||
if (matcher.group(3)==null)
|
||||
{
|
||||
System.err.printf("Module %s already enabled in %s as %s%n",module,hb.toShortForm(file.getParent()),n);
|
||||
found = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
String enabled=matcher.group(1)+mini;
|
||||
System.err.printf("Enabling Module %s in %s as %s%n",module,hb.toShortForm(file.getParent()),enabled);
|
||||
file.renameTo(new File(file.getParentFile(),enabled));
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1223,7 +1245,7 @@ public class Main implements IncludeListener
|
|||
final String mini = module + ".ini";
|
||||
final String disable = module + ".ini.disabled";
|
||||
|
||||
FileFilter disabledModuleFilter = new FS.FileNamesFilter(mini, disable);
|
||||
FileFilter disabledModuleFilter = new FS.FilenameRegexFilter("(\\d\\d\\d-)?"+Pattern.quote(module)+"\\.ini(\\.disabled)?");
|
||||
|
||||
HomeBase hb = _config.getHomeBase();
|
||||
|
||||
|
@ -1246,6 +1268,25 @@ public class Main implements IncludeListener
|
|||
file.renameTo(new File(file.getParentFile(),disable));
|
||||
found = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Matcher matcher = NNN_MODULE_INI.matcher(n);
|
||||
if (matcher.matches())
|
||||
{
|
||||
if (matcher.group(3)!=null)
|
||||
{
|
||||
System.err.printf("Module %s already disabled in %s as %s%n",module,hb.toShortForm(file.getParent()),n);
|
||||
found = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
String disabled=matcher.group(1)+disable;
|
||||
System.err.printf("Disabling Module %s in %s as %s%n",module,hb.toShortForm(file.getParent()),disabled);
|
||||
file.renameTo(new File(file.getParentFile(),disabled));
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public class MainTest
|
|||
assertThat("CommandLineBuilder shouldn't be null",cmd,notNullValue());
|
||||
|
||||
List<String> commandArgs = cmd.getArgs();
|
||||
assertThat("commandArgs should contain 11 elements",commandArgs.size(),equalTo(11));
|
||||
assertThat("commandArgs elements",commandArgs.size(),equalTo(12));
|
||||
assertThat("args does not contain -cp",commandArgs,hasItems("-cp"));
|
||||
assertThat("Classpath should be correctly quoted and match expected value",commandArgs,
|
||||
hasItems("/jetty/home with spaces/somejar.jar:/jetty/home with spaces/someotherjar.jar"));
|
||||
|
|
Loading…
Reference in New Issue