ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/naming/TesterInjectionServlet.java

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

      
    
Rootfs path

      
    
Size
2561 (2.5 KB)
MD5
32f92222be445945cb09bfef0614408f
SHA1
625be71a0f5a27256ef421368b79d503d763e516
SHA256
f7c9f8bea943331b7964896c086f2c4d69faa394732eab09a6ceff79c618cc2a
SHA512

      
    
SHA1_git
f7bcf103e1e9e13458df3133b15de46abbf87b5c
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TesterInjectionServlet.java | 2.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.naming; import java.io.IOException; import java.io.PrintWriter; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.apache.tomcat.util.IntrospectionUtils; public class TesterInjectionServlet extends HttpServlet { private static final long serialVersionUID = 1L; private String property1 = null; public String getProperty1() { return property1; } // Not used directly. // Here to ensure properties are injected in preference to fields private String property2 = null; public void setProperty2a(String property2) { this.property2 = property2; } public String getProperty2a() { return property2; } private String property2a = null; public void setProperty2(String property2) { this.property2a = property2; } public String getProperty2() { return property2a; } private String property3 = null; public String getProperty3() { return property3; } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/plain"); resp.setCharacterEncoding("UTF-8"); String injectionName = req.getParameter("injectionName"); PrintWriter pw = resp.getWriter(); pw.print(IntrospectionUtils.getProperty(this, injectionName)); // The property should take precedence over the field and this should // be null if (getProperty2a() != null) { pw.println(); pw.print(getProperty2a()); } } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
41.61
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