ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/jasper/compiler/ELInterpreterFactory.java

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

      
    
Rootfs path

      
    
Size
3624 (3.5 KB)
MD5
aca6911570570fdd640757e7d34708da
SHA1
eeff5cd4c3228f760cf71adc20ffa3864194fef9
SHA256
b423f50904df1e868285e70b206ddf3850d4102f079d037af135270542f13694
SHA512

      
    
SHA1_git
beead14a8e3c72b042d2bd9d505f74b64378facb
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
ELInterpreterFactory.java | 3.5 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.compiler; import jakarta.servlet.ServletContext; import org.apache.jasper.JspCompilationContext; /** * Provides {@link ELInterpreter} instances for JSP compilation. The search order is as follows: * <ol> * <li>ELInterpreter instance or implementation class name provided as a ServletContext attribute</li> * <li>Implementation class named in a ServletContext initialisation parameter</li> * <li>Default implementation</li> * </ol> */ public class ELInterpreterFactory { public static final String EL_INTERPRETER_CLASS_NAME = ELInterpreter.class.getName(); private static final ELInterpreter DEFAULT_INSTANCE = new DefaultELInterpreter(); /** * Obtain the correct EL Interpreter for the given web application. * * @param context The Servlet context * * @return the EL interpreter * * @throws Exception If an error occurs creating the interpreter */ public static ELInterpreter getELInterpreter(ServletContext context) throws Exception { ELInterpreter result = null; // Search for an implementation // 1. ServletContext attribute (set by application or cached by a previous call to this method). Object attribute = context.getAttribute(EL_INTERPRETER_CLASS_NAME); if (attribute instanceof ELInterpreter) { return (ELInterpreter) attribute; } else if (attribute instanceof String) { result = createInstance(context, (String) attribute); } // 2. ServletContext init parameter if (result == null) { String className = context.getInitParameter(EL_INTERPRETER_CLASS_NAME); if (className != null) { result = createInstance(context, className); } } // 3. Default if (result == null) { result = DEFAULT_INSTANCE; } // Cache the result for next time context.setAttribute(EL_INTERPRETER_CLASS_NAME, result); return result; } private static ELInterpreter createInstance(ServletContext context, String className) throws Exception { return (ELInterpreter) context.getClassLoader().loadClass(className).getConstructor().newInstance(); } private ELInterpreterFactory() { // Utility class. Hide default constructor. } public static class DefaultELInterpreter implements ELInterpreter { @Override public String interpreterCall(JspCompilationContext context, boolean isTagFile, String expression, Class<?> expectedType, String fnmapvar) { return JspUtil.interpreterCall(isTagFile, expression, expectedType, fnmapvar); } } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
33.52
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