Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one or more
   * contributor license agreements.  See the NOTICE file distributed with
   * this work for additional information regarding copyright ownership.
   * The ASF licenses this file to You under the Apache License, Version 2.0
   * (the "License"); you may not use this file except in compliance with
   * the License.  You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.apache.jasper;
 
 import java.io.File;
 import java.util.Map;
 
 
A class to hold all init parameters specific to the JSP engine.

Author(s):
Anil K. Vijendran
Hans Bergsten
Pierre Delisle
 
 public final class EmbeddedServletOptions implements Options {
     
     private Properties settings = new Properties();
    
    
Is Jasper being used in development mode?
 
     private boolean development = true;
    
    
Should Ant fork its java compiles of JSP pages.
 
     public boolean fork = true;
    
    
Do you want to keep the generated Java files around?
 
     private boolean keepGenerated = true;
    
    
Should white spaces between directives or actions be trimmed?
 
     private boolean trimSpaces = false;
    
    
Determines whether tag handler pooling is enabled.
 
     private boolean isPoolingEnabled = true;
    
    
Do 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 mappedFile = true;
    
    
Do 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 sendErrorToClient = false;
    
    
Do we want to include debugging information in the class file?
 
     private boolean classDebugInfo = true;
    
    
Background compile thread check interval in seconds.
 
     private int checkInterval = 0;
    
    
Is the generation of SMAP info for JSR45 debuggin suppressed?
 
     private boolean isSmapSuppressed = false;
    
    
Should SMAP info for JSR45 debugging be dumped to a file?
 
    private boolean isSmapDumped = false;
    
    
Are Text strings to be generated as char arrays?
    private boolean genStringAsCharArray = false;
    
    private boolean errorOnUseBeanInvalidClassAttribute = true;
    
    
I want to see my generated servlets. Which directory are they in?
    private File scratchDir;
    
    
Need 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="<value>"
    private String ieClassId = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93";
    
    
What classpath should I use while compiling generated servlets?
    private String classpath = null;
    
    
Compiler to use.
    private String compiler = null;
    
    
Compiler target VM.
    private String compilerTargetVM = "1.5";
    
    
The compiler source VM.
    private String compilerSourceVM = "1.5";
    
    
The compiler class name.
    private String compilerClassName = null;
    
    
Jsp config information
    private JspConfig jspConfig = null;
    
    
TagPluginManager
    private TagPluginManager tagPluginManager = null;
    
    
Java platform encoding to generate the JSP page servlet.
    private String javaEncoding = "UTF8";
    
    
Modification test interval.
    private int modificationTestInterval = 4;
    
    
Is re-compilation attempted immediately after a failure?
    private boolean recompileOnFail = false;

    
Is generation of X-Powered-By response header enabled/disabled?
    private boolean xpoweredBy;
    
    
Should we include a source fragment in exception messages, which could be displayed to the developer ?
    private boolean displaySourceFragment = true;
    
    public String getProperty(String name ) {
        return .getPropertyname );
    }
    
    public void setProperty(String nameString value ) {
        if (name != null && value != null){ 
            .setPropertynamevalue );
        }
    }
    
    
Are we keeping generated code around?
    public boolean getKeepGenerated() {
        return ;
    }
    
    
Should white spaces between directives or actions be trimmed?
    public boolean getTrimSpaces() {
        return ;
    }
    
    public boolean isPoolingEnabled() {
        return ;
    }
    
    
Are we supporting HTML mapped servlets?
    public boolean getMappedFile() {
        return ;
    }
    
    
Should errors be sent to client or thrown into stderr?
    public boolean getSendErrorToClient() {
        return ;
    }
    
    
Should class files be compiled with debug information?
    public boolean getClassDebugInfo() {
        return ;
    }
    
    
Background JSP compile thread check intervall
    public int getCheckInterval() {
        return ;
    }
    
    
Modification test interval.
    public int getModificationTestInterval() {
        return ;
    }
    
    
Re-compile on failure.
    public boolean getRecompileOnFail() {
        return ;
    }

    
Is Jasper being used in development mode?
    public boolean getDevelopment() {
        return ;
    }
    
    
Is the generation of SMAP info for JSR45 debuggin suppressed?
    public boolean isSmapSuppressed() {
        return ;
    }
    
    
Should SMAP info for JSR45 debugging be dumped to a file?
    public boolean isSmapDumped() {
        return ;
    }
    
    
Are Text strings to be generated as char arrays?
    public boolean genStringAsCharArray() {
        return this.;
    }
    
    
Class ID for use in the plugin tag when the browser is IE.
    public String getIeClassId() {
        return ;
    }
    
    
What is my scratch dir?
    public File getScratchDir() {
        return ;
    }
    
    
What classpath should I use while compiling the servlets generated from JSP files?
    public String getClassPath() {
        return ;
    }
    
    
Is generation of X-Powered-By response header enabled/disabled?
    public boolean isXpoweredBy() {
        return ;
    }
    
    
Compiler to use.
    public String getCompiler() {
        return ;
    }
    
    
    public String getCompilerTargetVM() {
        return ;
    }
    
    
    public String getCompilerSourceVM() {
        return ;
    }
    
    
Java compiler class to use.
    public String getCompilerClassName() {
        return ;
    }
    public boolean getErrorOnUseBeanInvalidClassAttribute() {
    }
    
    public void setErrorOnUseBeanInvalidClassAttribute(boolean b) {
    }
    
    public String getJavaEncoding() {
        return ;
    }
    
    public boolean getFork() {
        return ;
    }
    
    public JspConfig getJspConfig() {
        return ;
    }
    
        return ;
    }
    
    public boolean isCaching() {
        return false;
    }
    
    public Map getCache() {
        return null;
    }

    
Should we include a source fragment in exception messages, which could be displayed to the developer ?
    public boolean getDisplaySourceFragment() {
        return ;
    }

    
Create an EmbeddedServletOptions object using data available from ServletConfig and ServletContext.
    public EmbeddedServletOptions(ServletConfig config,
            ServletContext context) {
        
        // JVM version numbers
        try {
            if (Float.parseFloat(System.getProperty("java.specification.version")) > 1.4) {
                 =  = "1.5";
            } else {
                 =  = "1.4";
            }
        } catch (NumberFormatException e) {
            // Ignore
        }
        
        Enumeration enumeration=config.getInitParameterNames();
        whileenumeration.hasMoreElements() ) {
            String k=(String)enumeration.nextElement();
            String v=config.getInitParameterk );
            setPropertykv);
        }
        
        String keepgen = config.getInitParameter("keepgenerated");
        if (keepgen != null) {
            if (keepgen.equalsIgnoreCase("true")) {
                this. = true;
            } else if (keepgen.equalsIgnoreCase("false")) {
                this. = false;
            } else {
                ..invalidKeepGeneratedValue(keepgen);
            }
        }
        
        
        String trimsp = config.getInitParameter("trimSpaces"); 
        if (trimsp != null) {
            if (trimsp.equalsIgnoreCase("true")) {
                 = true;
            } else if (trimsp.equalsIgnoreCase("false")) {
                 = false;
            } else {
                ..invalidTrimSpacesValue(trimsp);
            }
        }
        
        this. = true;
        String poolingEnabledParam
        = config.getInitParameter("enablePooling"); 
        if (poolingEnabledParam != null
                && !poolingEnabledParam.equalsIgnoreCase("true")) {
            if (poolingEnabledParam.equalsIgnoreCase("false")) {
                this. = false;
            } else {
                ..invalidEnablePoolingValue(poolingEnabledParam);
            }
        }
        
        String mapFile = config.getInitParameter("mappedfile"); 
        if (mapFile != null) {
            if (mapFile.equalsIgnoreCase("true")) {
                this. = true;
            } else if (mapFile.equalsIgnoreCase("false")) {
                this. = false;
            } else {
                ..invalidMappedFileValue(mapFile);
            }
        }
        
        String senderr = config.getInitParameter("sendErrToClient");
        if (senderr != null) {
            if (senderr.equalsIgnoreCase("true")) {
                this. = true;
            } else if (senderr.equalsIgnoreCase("false")) {
                this. = false;
            } else {
                ..invalidSendErrToClientValue(senderr);
            }
        }
        
        String debugInfo = config.getInitParameter("classdebuginfo");
        if (debugInfo != null) {
            if (debugInfo.equalsIgnoreCase("true")) {
                this.  = true;
            } else if (debugInfo.equalsIgnoreCase("false")) {
                this.  = false;
            } else {
                ..invalidClassDebugInfoValue(debugInfo);
            }
        }
        
        String checkInterval = config.getInitParameter("checkInterval");
        if (checkInterval != null) {
            try {
                this. = Integer.parseInt(checkInterval);
            } catch(NumberFormatException ex) {
                ..invalidCheckIntervalValue(checkInterval);
            }
        }
        
        String modificationTestInterval = config.getInitParameter("modificationTestInterval");
        if (modificationTestInterval != null) {
            try {
                this. = Integer.parseInt(modificationTestInterval);
            } catch(NumberFormatException ex) {
                ..invalidModificationTestIntervalValue(modificationTestInterval);
            }
        }
        
        String recompileOnFail = config.getInitParameter("recompileOnFail"); 
        if (recompileOnFail != null) {
            if (recompileOnFail.equalsIgnoreCase("true")) {
                this. = true;
            } else if (recompileOnFail.equalsIgnoreCase("false")) {
                this. = false;
            } else {
                ..invalidRecompileOnFailValue(recompileOnFail);
            }
        }
        String development = config.getInitParameter("development");
        if (development != null) {
            if (development.equalsIgnoreCase("true")) {
                this. = true;
            } else if (development.equalsIgnoreCase("false")) {
                this. = false;
            } else {
                ..invalidDevelopmentValue(development);
            }
        }
        
        String suppressSmap = config.getInitParameter("suppressSmap");
        if (suppressSmap != null) {
            if (suppressSmap.equalsIgnoreCase("true")) {
                 = true;
            } else if (suppressSmap.equalsIgnoreCase("false")) {
                 = false;
            } else {
                ..invalidSuppressSmapValue(suppressSmap);
            }
        }
        
        String dumpSmap = config.getInitParameter("dumpSmap");
        if (dumpSmap != null) {
            if (dumpSmap.equalsIgnoreCase("true")) {
                 = true;
            } else if (dumpSmap.equalsIgnoreCase("false")) {
                 = false;
            } else {
                ..invalidDumpSmapValue(dumpSmap);
            }
        }
        
        String genCharArray = config.getInitParameter("genStringAsCharArray");
        if (genCharArray != null) {
            if (genCharArray.equalsIgnoreCase("true")) {
                 = true;
            } else if (genCharArray.equalsIgnoreCase("false")) {
                 = false;
            } else {
                ..invalidGenStrAsCharArrayValue(genCharArray);
            }
        }
        
        String errBeanClass =
            config.getInitParameter("errorOnUseBeanInvalidClassAttribute");
        if (errBeanClass != null) {
            if (errBeanClass.equalsIgnoreCase("true")) {
                 = true;
            } else if (errBeanClass.equalsIgnoreCase("false")) {
                 = false;
            } else {
                ..invalidErrorOnUseBeanInvalidClassAttributeValue(errBeanClass);
            }
        }
        
        String ieClassId = config.getInitParameter("ieClassId");
        if (ieClassId != null)
            this. = ieClassId;
        
        String classpath = config.getInitParameter("classpath");
        if (classpath != null)
            this. = classpath;
        
        /*
         * scratchdir
         */
        String dir = config.getInitParameter("scratchdir"); 
        if (dir != null) {
             = new File(dir);
        } else {
            // First try the Servlet 2.2 javax.servlet.context.tempdir property
             = (Filecontext.getAttribute(.);
            if ( == 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)
                     = new File(dir);
            }
        }      
        if (this. == null) {
            return;
        }
        
        if (!(.exists() && .canRead() &&
                .canWrite() && .isDirectory()))
        
        this. = config.getInitParameter("compiler");
        
        String compilerTargetVM = config.getInitParameter("compilerTargetVM");
        if(compilerTargetVM != null) {
            this. = compilerTargetVM;
        }
        
        String compilerSourceVM = config.getInitParameter("compilerSourceVM");
        if(compilerSourceVM != null) {
            this. = compilerSourceVM;
        }
        
        String javaEncoding = config.getInitParameter("javaEncoding");
        if (javaEncoding != null) {
            this. = javaEncoding;
        }
        
        String compilerClassName = config.getInitParameter("compilerClassName");
        if (compilerClassName != null) {
            this. = compilerClassName;
        }
        
        String fork = config.getInitParameter("fork");
        if (fork != null) {
            if (fork.equalsIgnoreCase("true")) {
                this. = true;
            } else if (fork.equalsIgnoreCase("false")) {
                this. = false;
            } else {
                ..invalidForkValue(fork);
            }
        }
        
        String xpoweredBy = config.getInitParameter("xpoweredBy"); 
        if (xpoweredBy != null) {
            if (xpoweredBy.equalsIgnoreCase("true")) {
                this. = true;
            } else if (xpoweredBy.equalsIgnoreCase("false")) {
                this. = false;
            } else {
                ..invalidXpoweredByValue(xpoweredBy);
            }
        }
        
        String displaySourceFragment = config.getInitParameter("displaySourceFragment"); 
        if (displaySourceFragment != null) {
            if (displaySourceFragment.equalsIgnoreCase("true")) {
                this. = true;
            } else if (displaySourceFragment.equalsIgnoreCase("false")) {
                this. = false;
            } else {
                ..invalidDisplaySourceFragmentValue(displaySourceFragment);
            }
        }
        
        // Setup the jsp config info for this web app.
         = new JspConfig(context);
        
        // Create a Tag plugin instance
         = new TagPluginManager(context);
    }
    
New to GrepCode? Check out our FAQ X