[277403] remove system properties

* Removing many of the jetty specific System.getProperty() usages to
  make embedding more useful, replacing with fields in objects that can
  be set using standard Java mechanisms.

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@625 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Joakim Erdfelt 2009-08-03 20:58:25 +00:00
parent 1ed9f2507c
commit 6deb6a6446
8 changed files with 60 additions and 63 deletions

View File

@ -1,3 +1,6 @@
jetty-7.0.0.RC3-SNAPSHOT
+ 277403 remove system properties
jetty-7.0.0.RC2 29 June 2009
+ 283844 Webapp / TLD errors are not clear
+ 283375 improved extensibility of SSL connectors

View File

@ -43,9 +43,9 @@ import org.eclipse.jetty.util.URIUtil;
* <LI>default.
* </NL>
* Multiple path specifications can be mapped by providing a list of
* specifications. The list is separated by the characters specified
* in the "org.eclipse.http.PathMap.separators" System property, which
* defaults to :
* specifications. By default this class uses characters ":," as path
* separators, unless configured differently by calling the static
* method @see PathMap#setPathSpecSeparators(String)
* <P>
* Special characters within paths such as '?<EFBFBD> and ';' are not treated specially
* as it is assumed they would have been either encoded in the original URL or
@ -59,15 +59,13 @@ import org.eclipse.jetty.util.URIUtil;
public class PathMap extends HashMap implements Externalizable
{
/* ------------------------------------------------------------ */
private static String __pathSpecSeparators =
System.getProperty("org.eclipse.http.PathMap.separators",":,");
private static String __pathSpecSeparators = ":,";
/* ------------------------------------------------------------ */
/** Set the path spec separator.
* Multiple path specification may be included in a single string
* if they are separated by the characters set in this string.
* The default value is ":," or whatever has been set by the
* system property org.eclipse.http.PathMap.separators
* By default this class uses ":," characters as path separators.
* @param s separators
*/
public static void setPathSpecSeparators(String s)

View File

@ -127,8 +127,7 @@ public class CGI extends HttpServlet
String os = System.getProperty("os.name");
if (os!=null && os.toLowerCase().indexOf("windows")!=-1)
{
String windir = System.getProperty("windir");
_env.set("SystemRoot", windir!=null ? windir : "C:\\WINDOWS");
_env.set("SystemRoot", "C:\\WINDOWS");
}
}

View File

@ -18,6 +18,9 @@ public class RedirectedStreamLogger extends FilterOutputStream
private static Timer __rollover;
final static String YYYY_MM_DD = "yyyy_mm_dd";
final static String ROLLOVER_FILE_DATE_FORMAT = "yyyy_MM_dd";
final static String ROLLOVER_FILE_BACKUP_FORMAT = "HHmmssSSS";
final static int ROLLOVER_FILE_RETAIN_DAYS = 31;
private RollTask _rollTask;
private SimpleDateFormat _fileBackupFormat;
@ -37,7 +40,7 @@ public class RedirectedStreamLogger extends FilterOutputStream
*/
public RedirectedStreamLogger(String filename) throws IOException
{
this(filename,true,Integer.getInteger("ROLLOVERFILE_RETAIN_DAYS",31).intValue());
this(filename,true,ROLLOVER_FILE_RETAIN_DAYS);
}
/* ------------------------------------------------------------ */
@ -51,7 +54,7 @@ public class RedirectedStreamLogger extends FilterOutputStream
*/
public RedirectedStreamLogger(String filename, boolean append) throws IOException
{
this(filename,append,Integer.getInteger("ROLLOVERFILE_RETAIN_DAYS",31).intValue());
this(filename,append,ROLLOVER_FILE_RETAIN_DAYS);
}
/* ------------------------------------------------------------ */
@ -96,11 +99,9 @@ public class RedirectedStreamLogger extends FilterOutputStream
* @param retainDays
* The number of days to retain files before deleting them. 0 to retain forever.
* @param dateFormat
* The format for the date file substitution. If null the system property ROLLOVERFILE_DATE_FORMAT is
* used and if that is null, then default is "yyyy_MM_dd".
* The format for the date file substitution. The default is "yyyy_MM_dd".
* @param backupFormat
* The format for the file extension of backup files. If null the system property
* ROLLOVERFILE_BACKUP_FORMAT is used and if that is null, then default is "HHmmssSSS".
* The format for the file extension of backup files. The default is "HHmmssSSS".
* @throws IOException
*/
public RedirectedStreamLogger(String filename, boolean append, int retainDays, TimeZone zone, String dateFormat, String backupFormat) throws IOException
@ -108,11 +109,11 @@ public class RedirectedStreamLogger extends FilterOutputStream
super(null);
if (dateFormat == null)
dateFormat = System.getProperty("ROLLOVERFILE_DATE_FORMAT","yyyy_MM_dd");
dateFormat = ROLLOVER_FILE_DATE_FORMAT;
_fileDateFormat = new SimpleDateFormat(dateFormat);
if (backupFormat == null)
backupFormat = System.getProperty("ROLLOVERFILE_BACKUP_FORMAT","HHmmssSSS");
backupFormat = ROLLOVER_FILE_BACKUP_FORMAT;
_fileBackupFormat = new SimpleDateFormat(backupFormat);
_fileBackupFormat.setTimeZone(zone);

View File

@ -42,6 +42,9 @@ public class RolloverFileOutputStream extends FilterOutputStream
private static Timer __rollover;
final static String YYYY_MM_DD="yyyy_mm_dd";
final static String ROLLOVER_FILE_DATE_FORMAT = "yyyy_MM_dd";
final static String ROLLOVER_FILE_BACKUP_FORMAT = "HHmmssSSS";
final static int ROLLOVER_FILE_RETAIN_DAYS = 31;
private RollTask _rollTask;
private SimpleDateFormat _fileBackupFormat;
@ -61,7 +64,7 @@ public class RolloverFileOutputStream extends FilterOutputStream
public RolloverFileOutputStream(String filename)
throws IOException
{
this(filename,true,Integer.getInteger("ROLLOVERFILE_RETAIN_DAYS",31).intValue());
this(filename,true,ROLLOVER_FILE_RETAIN_DAYS);
}
/* ------------------------------------------------------------ */
@ -74,7 +77,7 @@ public class RolloverFileOutputStream extends FilterOutputStream
public RolloverFileOutputStream(String filename, boolean append)
throws IOException
{
this(filename,append,Integer.getInteger("ROLLOVERFILE_RETAIN_DAYS",31).intValue());
this(filename,append,ROLLOVER_FILE_RETAIN_DAYS);
}
/* ------------------------------------------------------------ */
@ -117,10 +120,8 @@ public class RolloverFileOutputStream extends FilterOutputStream
* which is replaced with the actual date when creating and rolling over the file.
* @param append If true, existing files will be appended to.
* @param retainDays The number of days to retain files before deleting them. 0 to retain forever.
* @param dateFormat The format for the date file substitution. If null the system property ROLLOVERFILE_DATE_FORMAT is
* used and if that is null, then default is "yyyy_MM_dd".
* @param backupFormat The format for the file extension of backup files. If null the system property
* ROLLOVERFILE_BACKUP_FORMAT is used and if that is null, then default is "HHmmssSSS".
* @param dateFormat The format for the date file substitution. The default is "yyyy_MM_dd".
* @param backupFormat The format for the file extension of backup files. The default is "HHmmssSSS".
* @throws IOException
*/
public RolloverFileOutputStream(String filename,
@ -134,11 +135,11 @@ public class RolloverFileOutputStream extends FilterOutputStream
super(null);
if (dateFormat==null)
dateFormat=System.getProperty("ROLLOVERFILE_DATE_FORMAT","yyyy_MM_dd");
dateFormat=ROLLOVER_FILE_DATE_FORMAT;
_fileDateFormat = new SimpleDateFormat(dateFormat);
if (backupFormat==null)
backupFormat=System.getProperty("ROLLOVERFILE_BACKUP_FORMAT","HHmmssSSS");
backupFormat=ROLLOVER_FILE_BACKUP_FORMAT;
_fileBackupFormat = new SimpleDateFormat(backupFormat);
_fileBackupFormat.setTimeZone(zone);

View File

@ -34,25 +34,7 @@ public class StringUtil
public static final String __LINE_SEPARATOR=
System.getProperty("line.separator","\n");
public static final String __ISO_8859_1;
static
{
String iso=System.getProperty("ISO_8859_1");
if (iso==null)
{
try{
new String(new byte[]{(byte)20},"ISO-8859-1");
iso="ISO-8859-1";
}
catch(java.io.UnsupportedEncodingException e)
{
iso="ISO8859_1";
}
}
__ISO_8859_1=iso;
}
public static final String __ISO_8859_1="ISO-8859-1";
public final static String __UTF8="UTF-8";
public final static String __UTF8Alt="UTF8";
public final static String __UTF16="UTF-16";

View File

@ -160,16 +160,40 @@ public class TypeUtil
private static Class[] stringArg = { java.lang.String.class };
/* ------------------------------------------------------------ */
private static int intCacheSize=
Integer.getInteger("org.eclipse.jetty.util.TypeUtil.IntegerCacheSize",600).intValue();
private static int intCacheSize = 600;
private static Integer[] integerCache = new Integer[intCacheSize];
private static String[] integerStrCache = new String[intCacheSize];
private static Integer minusOne = new Integer(-1);
private static int longCacheSize=
Integer.getInteger("org.eclipse.jetty.util.TypeUtil.LongCacheSize",64).intValue();
private static int longCacheSize = 64;
private static Long[] longCache = new Long[longCacheSize];
private static Long minusOneL = new Long(-1);
public static void setIntCacheSize(int size)
{
if (size > intCacheSize) {
Integer[] intCache = new Integer[size];
System.arraycopy(integerCache,0,intCache,0,intCacheSize);
String [] strCache = new String[size];
System.arraycopy(integerStrCache,0,strCache,0,intCacheSize);
intCacheSize = size;
integerCache = intCache;
integerStrCache = strCache;
}
}
public static void setLongCacheSize(int size)
{
if (size > longCacheSize) {
Long[] lnCache = new Long[size];
System.arraycopy(longCache,0,lnCache,0,longCacheSize);
longCacheSize = size;
longCache = lnCache;
}
}
/* ------------------------------------------------------------ */
/** Class from a canonical name for a type.
* @param name A class or type name.

View File

@ -34,26 +34,15 @@ import org.eclipse.jetty.util.log.Log;
*
* Handle resources of implied or explicit file type.
* This class can check for aliasing in the filesystem (eg case
* insensitivity). By default this is turned on, or it can be controlled with the
* "org.eclipse.jetty.util.FileResource.checkAliases" system parameter.
* insensitivity). By default this is turned on, or it can be controlled
* by calling the static method @see FileResource#setCheckAliases(boolean)
*
*
*/
public class FileResource extends URLResource
{
private static boolean __checkAliases;
static
{
__checkAliases=
"true".equalsIgnoreCase
(System.getProperty("org.eclipse.jetty.util.FileResource.checkAliases","true"));
if (__checkAliases)
Log.debug("Checking Resource aliases");
else
Log.warn("Resource alias checking is disabled");
}
private static boolean __checkAliases = true;
/* ------------------------------------------------------------ */
private File _file;
private transient URL _alias=null;