ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/jasper/servlet/JasperInitializer.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/jasper/servlet/JasperInitializer.java
Status
scanned
Type
file
Name
JasperInitializer.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
4506 (4.4 KB)
MD5
29736db9dc05b66d529ea364d5f4fb15
SHA1
92d50f3ee2b51b0b6c2dcb693042c98f2ae1d33a
SHA256
1fa3e14c106b1f1881e4b5cebd38c70f207cf4b221178a44c66f659e1b034415
SHA512

      
    
SHA1_git
d82293ec5bcd8ee3709b6cc74c6689645c3920cd
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
JasperInitializer.java | 4.4 KB |

/* * 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.servlet; import java.io.IOException; import java.util.Set; import jakarta.servlet.ServletContainerInitializer; import jakarta.servlet.ServletContext; import jakarta.servlet.ServletException; import jakarta.servlet.jsp.JspFactory; import org.apache.jasper.Constants; import org.apache.jasper.compiler.Localizer; import org.apache.jasper.compiler.TldCache; import org.apache.jasper.runtime.JspFactoryImpl; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.InstanceManager; import org.apache.tomcat.SimpleInstanceManager; import org.xml.sax.SAXException; /** * Initializer for the Jasper JSP Engine. */ public class JasperInitializer implements ServletContainerInitializer { private static final String MSG = "org.apache.jasper.servlet.JasperInitializer"; private final Log log = LogFactory.getLog(JasperInitializer.class); // must not be static /* * Preload classes required at runtime by a JSP servlet so that we don't get a defineClassInPackage security * exception. */ static { JspFactoryImpl factory = new JspFactoryImpl(); if (JspFactory.getDefaultFactory() == null) { JspFactory.setDefaultFactory(factory); } } @Override public void onStartup(Set<Class<?>> types, ServletContext context) throws ServletException { if (log.isDebugEnabled()) { log.debug(Localizer.getMessage(MSG + ".onStartup", context.getServletContextName())); } // Set up a simple default Instance Manager if (context.getAttribute(InstanceManager.class.getName()) == null) { context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager()); } boolean validate = Boolean.parseBoolean(context.getInitParameter(Constants.XML_VALIDATION_TLD_INIT_PARAM)); String blockExternalString = context.getInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM); boolean blockExternal; if (blockExternalString == null) { blockExternal = true; } else { blockExternal = Boolean.parseBoolean(blockExternalString); } // scan the application for TLDs TldScanner scanner = newTldScanner(context, true, validate, blockExternal); try { scanner.scan(); } catch (IOException | SAXException e) { throw new ServletException(e); } // add any listeners defined in TLDs for (String listener : scanner.getListeners()) { context.addListener(listener); } context.setAttribute(TldCache.SERVLET_CONTEXT_ATTRIBUTE_NAME, new TldCache(context, scanner.getUriTldResourcePathMap(), scanner.getTldResourcePathTaglibXmlMap())); String poolSizeValue = context.getInitParameter(Constants.JSP_FACTORY_POOL_SIZE_INIT_PARAM); int poolSize = 8; if (poolSizeValue != null) { try { poolSize = Integer.parseInt(poolSizeValue); } catch (NumberFormatException e) { throw new ServletException(e); } } JspFactory factory = JspFactory.getDefaultFactory(); if (factory instanceof JspFactoryImpl) { ((JspFactoryImpl) factory).setPoolSize(poolSize); } } protected TldScanner newTldScanner(ServletContext context, boolean namespaceAware, boolean validate, boolean blockExternal) { return new TldScanner(context, namespaceAware, validate, blockExternal); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
26.92
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9