ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/jakarta/servlet/jsp/el/ScopedAttributeELResolver.java

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

      
    
Rootfs path

      
    
Size
3452 (3.4 KB)
MD5
abd2a95bc7fa976c4e4579d8fd2f39e0
SHA1
87a999e5454fe8b0061b0d72528868aab521c90e
SHA256
8f64dc398f1b7884aaf62b148643c5224468e5f0917fddda75cee9e173669486
SHA512

      
    
SHA1_git
1815fd3ecc9f1a981e4213b16dbc4d9b69ff7be6
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
ScopedAttributeELResolver.java | 3.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 jakarta.servlet.jsp.el; import java.util.Objects; import jakarta.el.ELContext; import jakarta.el.ELResolver; import jakarta.servlet.jsp.JspContext; import jakarta.servlet.jsp.PageContext; /** * An ELResolver for working with JSP scoped attributes which may have page, request, session or application scope. * * @since JSP 2.1 */ public class ScopedAttributeELResolver extends ELResolver { /** * Default constructor. */ public ScopedAttributeELResolver() { super(); } @Override public Object getValue(ELContext context, Object base, Object property) { Objects.requireNonNull(context); Object result = null; if (base == null) { if (property != null) { String key = property.toString(); PageContext page = (PageContext) context.getContext(JspContext.class); result = page.findAttribute(key); if (result != null) { context.setPropertyResolved(null, property); } } } return result; } @Override public Class<Object> getType(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null) { context.setPropertyResolved(null, property); return Object.class; } return null; } @Override public void setValue(ELContext context, Object base, Object property, Object value) { Objects.requireNonNull(context); if (base == null) { context.setPropertyResolved(null, property); if (property != null) { String key = property.toString(); PageContext page = (PageContext) context.getContext(JspContext.class); int scope = page.getAttributesScope(key); if (scope != 0) { page.setAttribute(key, value, scope); } else { page.setAttribute(key, value); } } } } @Override public boolean isReadOnly(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null) { context.setPropertyResolved(null, property); } return false; } @Override public Class<String> getCommonPropertyType(ELContext context, Object base) { if (base == null) { return String.class; } return null; } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
35.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