|
Tomcat example source code file (VirtualDirContext.java)
The Tomcat VirtualDirContext.java source code
/*
* 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.resources;
import java.io.File;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import org.apache.naming.NamingEntry;
/**
* Extended FileDirContext implementation that will allow loading of tld files
* from the META-INF directory (or subdirectories) in classpath. This will fully
* mimic the behavior of compressed jars also when using unjarred resources. Tld
* files can be loaded indifferently from WEB-INF webapp dir (or subdirs) or
* from META-INF dir from jars available in the classpath: using this DirContext
* implementation you will be able to use unexpanded jars during development and
* to make any tld in them virtually available to the webapp.
*
* Sample context xml configuration:
*
* <code>
* <Context docBase="\webapps\mydocbase">
* <Resources className="org.apache.naming.resources.VirtualDirContext"
* virtualClasspath="\dir\classes;\somedir\somejar.jar"/>
* </Resources>
* </code>
*
*
* <strong>This is not meant to be used for production.
* Its meant to ease development with IDE's without the
* need for fully republishing jars in WEB-INF/lib</strong>
*
*
* @author Fabrizio Giustina
* @version $Id: $
*/
public class VirtualDirContext extends FileDirContext {
/**
* Map containing generated virtual names for tld files under WEB-INF and
* the actual file reference.
*/
private Map<String, File> virtualMappings;
/**
* Map containing a mapping for tag files that should be loaded from the
* META-INF dir of referenced jar files.
*/
private Map<String, File> tagfileMappings;
/**
* <code>; separated list of virtual path elements.
*/
private String virtualClasspath;
/**
* <code>virtualClasspath attribute that will be automatically set
* from the <code>Context
Other Tomcat examples (source code examples)Here is a short list of links related to this Tomcat VirtualDirContext.java source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.