ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/catalina/webresources/TestAbstractArchiveResource.java

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

      
    
Rootfs path

      
    
Size
2934 (2.9 KB)
MD5
58b7d7ce6174e6577b03287fd619cd6f
SHA1
3ed636d59687149edac67e742744b8548075e54a
SHA256
53a5a1c65fc04c132706c2118d273eafdbd1ecd7cb600e2404c3d5fb077375ba
SHA512

      
    
SHA1_git
ad1813fd30f6f7eaa0fb73a268d5737928b1e3f5
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestAbstractArchiveResource.java | 2.9 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.catalina.webresources; import java.io.File; import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; import org.apache.catalina.WebResource; import org.apache.catalina.core.StandardHost; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; public class TestAbstractArchiveResource extends TomcatBaseTest { @Test public void testNestedJarGetURL() throws Exception { Tomcat tomcat = getTomcatInstance(); File docBase = new File("test/webresources/war-url-connection.war"); Context ctx = tomcat.addWebapp("/test", docBase.getAbsolutePath()); skipTldsForResourceJars(ctx); ((StandardHost) tomcat.getHost()).setUnpackWARs(false); tomcat.start(); WebResource webResource = ctx.getResources().getClassLoaderResource("/META-INF/resources/index.html"); StringBuilder expectedURL = new StringBuilder("jar:war:"); expectedURL.append(docBase.getCanonicalFile().toURI().toURL().toString()); expectedURL.append("*/WEB-INF/lib/test.jar!/META-INF/resources/index.html"); Assert.assertEquals(expectedURL.toString(), webResource.getURL().toString()); } @Test public void testJarGetURL() throws Exception { Tomcat tomcat = getTomcatInstance(); File docBase = new File("test/webapp"); Context ctx = tomcat.addWebapp("/test", docBase.getAbsolutePath()); skipTldsForResourceJars(ctx); ((StandardHost) tomcat.getHost()).setUnpackWARs(false); tomcat.start(); WebResource webResource = ctx.getResources().getClassLoaderResource("/META-INF/tags/echo.tag"); StringBuilder expectedURL = new StringBuilder("jar:"); expectedURL.append(docBase.getCanonicalFile().toURI().toURL().toString()); expectedURL.append("WEB-INF/lib/test-lib.jar!/META-INF/tags/echo.tag"); Assert.assertEquals(expectedURL.toString(), webResource.getURL().toString()); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
37.66
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