Fields Summary |
---|
private static com.sun.org.apache.commons.logging.Log | log |
private Properties | settings |
private boolean | developmentIs Jasper being used in development mode? |
public boolean | forkShould Ant fork its java compiles of JSP pages. |
private boolean | keepGeneratedDo you want to keep the generated Java files around? |
private boolean | saveBytecodeIf class files are generated as byte arrays, should they be saved to
disk at the end of compilations? |
private boolean | trimSpacesShould white spaces between directives or actions be trimmed? |
private boolean | isPoolingEnabledDetermines whether tag handler pooling is enabled. |
private boolean | mappedFileDo you want support for "mapped" files? This will generate
servlet that has a print statement per line of the JSP file.
This seems like a really nice feature to have for debugging. |
private boolean | sendErrorToClientDo you want stack traces and such displayed in the client's
browser? If this is false, such messages go to the standard
error or a log file if the standard error is redirected. |
private boolean | classDebugInfoDo we want to include debugging information in the class file? |
private int | checkIntervalBackground compile thread check interval in seconds. |
private boolean | isSmapSuppressedIs the generation of SMAP info for JSR45 debuggin suppressed? |
private boolean | isSmapDumpedShould SMAP info for JSR45 debugging be dumped to a file? |
private boolean | genStringAsCharArrayAre Text strings to be generated as char arrays? |
private boolean | genStringAsByteArray |
private boolean | defaultBufferNone |
private boolean | errorOnUseBeanInvalidClassAttribute |
private File | scratchDirI want to see my generated servlets. Which directory are they
in? |
private String | ieClassIdNeed to have this as is for versions 4 and 5 of IE. Can be set from
the initParams so if it changes in the future all that is needed is
to have a jsp initParam of type ieClassId="" |
private String | classpathWhat classpath should I use while compiling generated servlets? |
private String | sysClassPath |
private String | compilerCompiler to use. |
private String | compilerTargetVMCompiler target VM. |
private String | compilerSourceVMThe compiler source VM. |
private org.apache.jasper.compiler.TldLocationsCache | tldLocationsCacheCache for the TLD locations |
private org.apache.jasper.compiler.JspConfig | jspConfigJsp config information |
private org.apache.jasper.compiler.TagPluginManager | tagPluginManagerTagPluginManager |
private String | javaEncodingJava platform encoding to generate the JSP
page servlet. |
private int | modificationTestIntervalModification test interval. |
private boolean | xpoweredByIs generation of X-Powered-By response header enabled/disabled? |
private boolean | usePrecompiled |
private boolean | isValidationEnabled |
private int | initialCapacity |
Constructors Summary |
---|
public EmbeddedServletOptions(ServletConfig config, ServletContext context)Create an EmbeddedServletOptions object using data available from
ServletConfig and ServletContext.
// JVM version numbers
try {
if (Float.parseFloat(System.getProperty("java.specification.version")) > 1.4) {
compilerSourceVM = compilerTargetVM = "1.5";
} else {
compilerSourceVM = compilerTargetVM = "1.4";
}
} catch (NumberFormatException e) {
// Ignore
}
Enumeration enumeration=config.getInitParameterNames();
while( enumeration.hasMoreElements() ) {
String k=(String)enumeration.nextElement();
String v=config.getInitParameter( k );
setProperty( k, v);
}
/* SJSAS 6384538
// quick hack
String validating=config.getInitParameter( "validating");
if( "false".equals( validating )) ParserUtils.validating=false;
*/
// START SJSAS 6384538
String validating=config.getInitParameter("validating");
if ("true".equals(validating)) {
isValidationEnabled = true;
}
validating = config.getInitParameter("enableTldValidation");
if ("true".equals(validating)) {
isValidationEnabled = true;
}
// END SJSAS 6384538
// keepgenerated default is false for JDK6 for later, true otherwise
keepGenerated = getBoolean(config, ! isJDK6(), "keepgenerated");
saveBytecode = getBoolean(config, saveBytecode, "saveBytecode");
trimSpaces = getBoolean(config, trimSpaces, "trimSpaces");
isPoolingEnabled = getBoolean(config, isPoolingEnabled, "enablePooling");
mappedFile = getBoolean(config, mappedFile, "mappedfile");
sendErrorToClient = getBoolean(config, sendErrorToClient, "sendErrToClient");
classDebugInfo = getBoolean(config, classDebugInfo, "classdebuginfo");
development = getBoolean(config, development, "development");
isSmapSuppressed = getBoolean(config, isSmapSuppressed, "suppressSmap");
isSmapDumped = getBoolean(config, isSmapDumped, "dumpSmap");
genStringAsCharArray = getBoolean(config, genStringAsCharArray, "genStrAsCharArray");
genStringAsByteArray = getBoolean(config, genStringAsByteArray, "genStrAsByteArray");
defaultBufferNone = getBoolean(config, defaultBufferNone, "defaultBufferNone");
errorOnUseBeanInvalidClassAttribute = getBoolean(config, errorOnUseBeanInvalidClassAttribute, "errorOnUseBeanInvalidClassAttribute");
fork = getBoolean(config, fork, "fork");
xpoweredBy = getBoolean(config, xpoweredBy, "xpoweredBy");
String checkIntervalStr = config.getInitParameter("checkInterval");
if (checkIntervalStr != null) {
parseCheckInterval(checkIntervalStr);
}
String modificationTestIntervalStr =
config.getInitParameter("modificationTestInterval");
if (modificationTestIntervalStr != null) {
parseModificationTestInterval(modificationTestIntervalStr);
}
String ieClassId = config.getInitParameter("ieClassId");
if (ieClassId != null)
this.ieClassId = ieClassId;
String classpath = config.getInitParameter("classpath");
if (classpath != null)
this.classpath = classpath;
// START PWC 1.2 6311155
String sysClassPath = config.getInitParameter(
"com.sun.appserv.jsp.classpath");
if (sysClassPath != null)
this.sysClassPath = sysClassPath;
// END PWC 1.2 6311155
/*
* scratchdir
*/
String dir = config.getInitParameter("scratchdir");
if (dir != null) {
scratchDir = new File(dir);
} else {
// First try the Servlet 2.2 javax.servlet.context.tempdir property
scratchDir = (File) context.getAttribute(Constants.TMP_DIR);
if (scratchDir == null) {
// Not running in a Servlet 2.2 container.
// Try to get the JDK 1.2 java.io.tmpdir property
dir = System.getProperty("java.io.tmpdir");
if (dir != null)
scratchDir = new File(dir);
}
}
if (this.scratchDir == null) {
log.fatal(Localizer.getMessage("jsp.error.no.scratch.dir"));
return;
}
if (!(scratchDir.exists() && scratchDir.canRead() &&
scratchDir.canWrite() && scratchDir.isDirectory()))
log.fatal(Localizer.getMessage("jsp.error.bad.scratch.dir",
scratchDir.getAbsolutePath()));
this.compiler = config.getInitParameter("compiler");
String compilerTargetVM = config.getInitParameter("compilerTargetVM");
if(compilerTargetVM != null) {
this.compilerTargetVM = compilerTargetVM;
}
String compilerSourceVM = config.getInitParameter("compilerSourceVM");
if(compilerSourceVM != null) {
this.compilerSourceVM = compilerSourceVM;
}
String javaEncoding = config.getInitParameter("javaEncoding");
if (javaEncoding != null) {
this.javaEncoding = javaEncoding;
}
String reloadIntervalString =
config.getInitParameter("reload-interval");
if (reloadIntervalString != null) {
int reloadInterval = 0;
try {
reloadInterval = Integer.parseInt(reloadIntervalString);
} catch (NumberFormatException e) {
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage("jsp.warning.reloadInterval"));
}
}
if (reloadInterval == -1) {
// Never check JSPs for modifications, and disable
// recompilation
this.development = false;
this.checkInterval = 0;
} else {
// Check JSPs for modifications at specified interval in
// both (development and non-development) modes
parseCheckInterval(reloadIntervalString);
parseModificationTestInterval(reloadIntervalString);
}
}
// BEGIN S1AS 6181923
String usePrecompiled = config.getInitParameter("usePrecompiled");
if (usePrecompiled == null) {
usePrecompiled = config.getInitParameter("use-precompiled");
}
if (usePrecompiled != null) {
if (usePrecompiled.equalsIgnoreCase("true")) {
this.usePrecompiled = true;
} else if (usePrecompiled.equalsIgnoreCase("false")) {
this.usePrecompiled = false;
} else {
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage("jsp.warning.usePrecompiled"));
}
}
}
// END S1AS 6181923
// START SJSWS
String capacity = config.getInitParameter("initialCapacity");
if (capacity == null) {
capacity = config.getInitParameter("initial-capacity");
}
if (capacity != null) {
try {
initialCapacity = Integer.parseInt(capacity);
// Find a value that is power of 2 and >= the specified
// initial capacity, in order to make Hashtable indexing
// more efficient.
int value = Constants.DEFAULT_INITIAL_CAPACITY;
while (value < initialCapacity) {
value *= 2;
}
initialCapacity = value;
} catch (NumberFormatException nfe) {
if (log.isWarnEnabled()) {
String msg = Localizer.getMessage(
"jsp.warning.initialcapacity");
msg = MessageFormat.format(
msg,
new Object[] {
capacity,
Integer.valueOf(Constants.DEFAULT_INITIAL_CAPACITY)});
log.warn(msg);
}
}
}
String jspCompilerPlugin = config.getInitParameter("javaCompilerPlugin");
if (jspCompilerPlugin != null) {
if ("org.apache.jasper.compiler.JikesJavaCompiler".equals(
jspCompilerPlugin)) {
this.compiler = "jikes";
} else if ("org.apache.jasper.compiler.SunJava14Compiler".equals(
jspCompilerPlugin)) {
// use default, do nothing
} else {
// use default, issue warning
if (log.isWarnEnabled()) {
String msg = Localizer.getMessage(
"jsp.warning.unsupportedJavaCompiler");
msg = MessageFormat.format(msg,
new Object[]
{ jspCompilerPlugin });
log.warn(msg);
}
}
}
// END SJSWS
// Setup the global Tag Libraries location cache for this
// web-application.
/* SJSAS 6384538
tldLocationsCache = new TldLocationsCache(context);
*/
// START SJSAS 6384538
tldLocationsCache = new TldLocationsCache(context, this);
// END SJSAS 6384538
// Setup the jsp config info for this web app.
/* SJSAS 6384538
jspConfig = new JspConfig(context);
*/
// START SJSAS 6384538
jspConfig = new JspConfig(context, this);
// END SJSAS 6384538
// Create a Tag plugin instance
tagPluginManager = new TagPluginManager(context);
|
Methods Summary |
---|
public boolean | genStringAsByteArray()
return this.genStringAsByteArray;
|
public boolean | genStringAsCharArray()Are Text strings to be generated as char arrays?
return this.genStringAsCharArray;
|
private boolean | getBoolean(javax.servlet.ServletConfig config, boolean init, java.lang.String param)
String sParam = config.getInitParameter(param);
if (sParam != null) {
if (sParam.equalsIgnoreCase("true")) {
return true;
}
if (sParam.equalsIgnoreCase("false")) {
return false;
}
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage("jsp.warning.boolean", param,
(init? "true": "false")));
}
}
return init;
|
public int | getCheckInterval()Background JSP compile thread check intervall
return checkInterval;
|
public boolean | getClassDebugInfo()Should class files be compiled with debug information?
return classDebugInfo;
|
public java.lang.String | getClassPath()What classpath should I use while compiling the servlets
generated from JSP files?
return classpath;
|
public java.lang.String | getCompiler()Compiler to use.
return compiler;
|
public java.lang.String | getCompilerSourceVM()
return compilerSourceVM;
|
public java.lang.String | getCompilerTargetVM()
return compilerTargetVM;
|
public boolean | getDevelopment()Is Jasper being used in development mode?
return development;
|
public boolean | getErrorOnUseBeanInvalidClassAttribute()
return errorOnUseBeanInvalidClassAttribute;
|
public boolean | getFork()
return fork;
|
public java.lang.String | getIeClassId()Class ID for use in the plugin tag when the browser is IE.
return ieClassId;
|
public int | getInitialCapacity()Gets initial capacity of HashMap which maps JSPs to their corresponding
servlets.
return initialCapacity;
|
public java.lang.String | getJavaEncoding()
return javaEncoding;
|
public org.apache.jasper.compiler.JspConfig | getJspConfig()
return jspConfig;
|
public boolean | getKeepGenerated()Are we keeping generated code around?
return keepGenerated;
|
public boolean | getMappedFile()Are we supporting HTML mapped servlets?
return mappedFile;
|
public int | getModificationTestInterval()Modification test interval.
return modificationTestInterval;
|
public java.lang.String | getProperty(java.lang.String name)
// END SJSWS
return settings.getProperty( name );
|
public boolean | getSaveBytecode()
return this.saveBytecode;
|
public java.io.File | getScratchDir()What is my scratch dir?
return scratchDir;
|
public boolean | getSendErrorToClient()Should errors be sent to client or thrown into stderr?
return sendErrorToClient;
|
public java.lang.String | getSystemClassPath()Gets the system class path.
return sysClassPath;
|
public org.apache.jasper.compiler.TagPluginManager | getTagPluginManager()
return tagPluginManager;
|
public org.apache.jasper.compiler.TldLocationsCache | getTldLocationsCache()
return tldLocationsCache;
|
public boolean | getTrimSpaces()Should white spaces between directives or actions be trimmed?
return trimSpaces;
|
public boolean | getUsePrecompiled()Returns the value of the usePrecompiled (or use-precompiled) init
param.
return usePrecompiled;
|
public boolean | isDefaultBufferNone()
return defaultBufferNone;
|
private boolean | isJDK6()
try {
Class.forName("javax.tools.ToolProvider");
return true;
} catch (ClassNotFoundException ex) {
}
return false;
|
public boolean | isPoolingEnabled()
return isPoolingEnabled;
|
public boolean | isSmapDumped()Should SMAP info for JSR45 debugging be dumped to a file?
return isSmapDumped;
|
public boolean | isSmapSuppressed()Is the generation of SMAP info for JSR45 debuggin suppressed?
return isSmapSuppressed;
|
public boolean | isValidationEnabled()
return isValidationEnabled;
|
public boolean | isXpoweredBy()Is generation of X-Powered-By response header enabled/disabled?
return xpoweredBy;
|
private void | parseCheckInterval(java.lang.String param)
try {
this.checkInterval = Integer.parseInt(param);
} catch(NumberFormatException ex) {
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage("jsp.warning.checkInterval"));
}
}
|
private void | parseModificationTestInterval(java.lang.String param)
try {
this.modificationTestInterval = Integer.parseInt(param);
} catch(NumberFormatException ex) {
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage("jsp.warning.modificationTestInterval"));
}
}
|
public void | setErrorOnUseBeanInvalidClassAttribute(boolean b)
errorOnUseBeanInvalidClassAttribute = b;
|
public void | setProperty(java.lang.String name, java.lang.String value)
if (name != null && value != null){
settings.setProperty( name, value );
}
|
public void | setTldLocationsCache(org.apache.jasper.compiler.TldLocationsCache tldC)
tldLocationsCache = tldC;
|