ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/jasper/TestJspCompilationContext.java

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

      
    
Rootfs path

      
    
Size
4489 (4.4 KB)
MD5
00bccde5912c1f087bf1338fcd724436
SHA1
687582968350134bbce58d438025692245f72506
SHA256
01fe2b8bef42b823404b03b9811d2ac74275a1c06a0317c958ac740fdf52fd67
SHA512

      
    
SHA1_git
d6e847a913732948426b18ccaca89552899fb70b
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestJspCompilationContext.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; import java.io.File; import jakarta.servlet.http.HttpServletResponse; import org.junit.Assert; import org.junit.Test; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; public class TestJspCompilationContext extends TomcatBaseTest { @Test public void testTagFileInJar() throws Exception { getTomcatInstanceTestWebapp(false, true); ByteChunk body = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + "/test/jsp/tagFileInJar.jsp", body, null); Assert.assertEquals(HttpServletResponse.SC_OK, rc); Assert.assertTrue(body.toString().contains("00 - OK")); } /* * Test case for https://bz.apache.org/bugzilla/show_bug.cgi?id=57626 */ @Test public void testModifiedTagFileInJar() throws Exception { getTomcatInstanceTestWebapp(false, true); ByteChunk body = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + "/test/jsp/tagFileInJar.jsp", body, null); Assert.assertEquals(HttpServletResponse.SC_OK, rc); Assert.assertTrue(body.toString().contains("00 - OK")); File jsp = new File("test/webapp/jsp/tagFileInJar.jsp"); Assert.assertTrue("Failed to set last modified for [" + jsp + "]", jsp.setLastModified(jsp.lastModified() + 10000)); // This test requires that modificationTestInterval is set to zero in // web.xml. If not, a sleep longer that modificationTestInterval is // required here. rc = getUrl("http://localhost:" + getPort() + "/test/jsp/tagFileInJar.jsp", body, null); Assert.assertEquals(HttpServletResponse.SC_OK, rc); Assert.assertTrue(body.toString().contains("00 - OK")); } /* * Test case for https://bz.apache.org/bugzilla/show_bug.cgi?id=69135 */ @Test public void testTagFileInJarIncludesValid() throws Exception { getTomcatInstanceTestWebapp(false, true); ByteChunk body = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + "/test/bug6nnnn/bug69135.jsp", body, null); Assert.assertEquals(HttpServletResponse.SC_OK, rc); // Context relative include (starts with "/") Assert.assertTrue(body.toString(), body.toString().contains("00 - OK")); // Resource relative include (does not start with "/") Assert.assertTrue(body.toString(), body.toString().contains("01 - OK")); } /* * Test case for https://bz.apache.org/bugzilla/show_bug.cgi?id=69135 */ @Test public void testTagFileInJarIncludesInvalidJar() throws Exception { getTomcatInstanceTestWebapp(false, true); ByteChunk body = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + "/test/bug6nnnn/bug69135-invalid-jar.jsp", body, null); Assert.assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, rc); } /* * Test case for https://bz.apache.org/bugzilla/show_bug.cgi?id=69135 */ @Test public void testTagFileInJarIncludesInvalidJarEscape() throws Exception { getTomcatInstanceTestWebapp(false, true); ByteChunk body = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + "/test/bug6nnnn/bug69135-invalid-jar-escape.jsp", body, null); Assert.assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, rc); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
25.48
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
https://bz.apache.org/bugzilla/show_bug.cgi?id=57626 46 46
https://bz.apache.org/bugzilla/show_bug.cgi?id=69135 77 77