/*
* 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.core;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Stack;
import java.util.TreeMap;
import javax.management.AttributeNotFoundException;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.Notification;
import javax.management.NotificationBroadcasterSupport;
import javax.management.NotificationEmitter;
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
import javax.management.ObjectName;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextAttributeListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletException;
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionListener;
import org.apache.AnnotationProcessor;
import org.apache.catalina.Container;
import org.apache.catalina.ContainerListener;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Globals;
import org.apache.catalina.Host;
import org.apache.catalina.InstanceListener;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Loader;
import org.apache.catalina.Manager;
import org.apache.catalina.Wrapper;
import org.apache.catalina.deploy.ApplicationParameter;
import org.apache.catalina.deploy.ErrorPage;
import org.apache.catalina.deploy.FilterDef;
import org.apache.catalina.deploy.FilterMap;
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.deploy.MessageDestination;
import org.apache.catalina.deploy.MessageDestinationRef;
import org.apache.catalina.deploy.NamingResources;
import org.apache.catalina.deploy.SecurityCollection;
import org.apache.catalina.deploy.SecurityConstraint;
import org.apache.catalina.loader.WebappLoader;
import org.apache.catalina.session.StandardManager;
import org.apache.catalina.startup.ContextConfig;
import org.apache.catalina.startup.TldConfig;
import org.apache.catalina.util.CharsetMapper;
import org.apache.catalina.util.DefaultAnnotationProcessor;
import org.apache.catalina.util.ExtensionValidator;
import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.URLEncoder;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.naming.ContextBindings;
import org.apache.naming.resources.BaseDirContext;
import org.apache.naming.resources.DirContextURLStreamHandler;
import org.apache.naming.resources.FileDirContext;
import org.apache.naming.resources.ProxyDirContext;
import org.apache.naming.resources.WARDirContext;
import org.apache.tomcat.util.modeler.Registry;
/**
* Standard implementation of the <b>Context</b> interface. Each
* child container must be a Wrapper implementation to process the
* requests directed to a particular servlet.
*
* @author Craig R. McClanahan
* @author Remy Maucherat
* @version $Revision: 522580 $ $Date: 2007-03-26 19:52:23 +0200 (lun., 26 mars 2007) $
*/
public class StandardContext
extends ContainerBase
implements Context, Serializable, NotificationEmitter
{
private static transient Log log = LogFactory.getLog(StandardContext.class);
// ----------------------------------------------------------- Constructors
/**
* Create a new StandardContext component with the default basic Valve.
*/
public StandardContext() {
super();
pipeline.setBasic(new StandardContextValve());
broadcaster = new NotificationBroadcasterSupport();
}
// ----------------------------------------------------- Class Variables
/**
* The descriptive information string for this implementation.
*/
private static final String info =
"org.apache.catalina.core.StandardContext/1.0";
/**
* Array containing the safe characters set.
*/
protected static URLEncoder urlEncoder;
/**
* GMT timezone - all HTTP dates are on GMT
*/
static {
urlEncoder = new URLEncoder();
urlEncoder.addSafeCharacter('~');
urlEncoder.addSafeCharacter('-');
urlEncoder.addSafeCharacter('_');
urlEncoder.addSafeCharacter('.');
urlEncoder.addSafeCharacter('*');
urlEncoder.addSafeCharacter('/');
}
// ----------------------------------------------------- Instance Variables
/**
* The alternate deployment descriptor name.
*/
private String altDDName = null;
/**
* Annotation processor.
*/
private AnnotationProcessor annotationProcessor = null;
/**
* Associated host name.
*/
private String hostName;
/**
* The antiJARLocking flag for this Context.
*/
private boolean antiJARLocking = false;
/**
* The antiResourceLocking flag for this Context.
*/
private boolean antiResourceLocking = false;
/**
* The set of application listener class names configured for this
* application, in the order they were encountered in the web.xml file.
*/
private String applicationListeners[] = new String[0];
/**
* The set of instantiated application event listener objects</code>.
*/
private transient Object applicationEventListenersObjects[] =
new Object[0];
/**
* The set of instantiated application lifecycle listener objects</code>.
*/
private transient Object applicationLifecycleListenersObjects[] =
new Object[0];
/**
* The set of application parameters defined for this application.
*/
private ApplicationParameter applicationParameters[] =
new ApplicationParameter[0];
/**
* The application available flag for this Context.
*/
private boolean available = false;
/**
* The broadcaster that sends j2ee notifications.
*/
private NotificationBroadcasterSupport broadcaster = null;
/**
* The Locale to character set mapper for this application.
*/
private transient CharsetMapper charsetMapper = null;
/**
* The Java class name of the Char
apache-tomcat-6.0.13
需积分: 0 127 浏览量
更新于2007-08-10
收藏 4.67MB ZIP 举报
Apache Tomcat 6.0.13 是一个广泛使用的开源软件,它是一个符合Java Servlet和JavaServer Pages(JSP)规范的应用服务器,主要用于部署和运行Java Web应用程序。这个版本是Tomcat 6系列的一个特定发布,它包含了对早期版本的改进和修复。
Apache Tomcat 的核心功能包括:
1. **Servlet容器**:Tomcat作为Servlet容器,能够处理HTTP请求并调用相应的Servlet来生成响应。Servlet是Java编写的小型服务器端程序,可以扩展Web服务器的功能。
2. **JSP支持**:Tomcat 支持JSP规范,允许开发者使用HTML和Java代码混合编写动态网页。JSP页面在第一次请求时会被Tomcat转换为Servlet并编译执行。
3. **JavaServer Pages Standard Tag Library (JSTL)**:Tomcat 6.0.13版本包含了JSTL库,这是一个用于JSP的标签库,简化了页面逻辑,提高了代码可读性和可维护性。
4. **连接器(Connector)**:Tomcat提供了多种连接器,用于与不同的前端代理服务器如Apache HTTP Server或Nginx进行通信,实现负载均衡和缓存等功能。
5. **安全性**:Tomcat提供了多种安全特性,如SSL/TLS支持、用户身份验证和授权管理,以及基于角色的访问控制(RBAC)。
6. **管理工具**:Tomcat提供了一套管理工具,如`manager`应用和`admin`应用,用于部署、监控和管理部署在Tomcat上的Web应用程序。
7. **配置文件**:Tomcat的配置主要通过一系列XML配置文件完成,如`server.xml`、`context.xml`和`web.xml`等,这些文件定义了服务器的行为、部署的应用和它们的配置。
8. **性能优化**:Tomcat 6.0.13可能包含了一些性能优化,比如线程池管理、内存分配策略以及缓存机制等,以提高服务响应速度和处理能力。
9. **可扩展性**:Tomcat设计为模块化,可以通过添加或移除模块来适应不同规模的应用需求。开发者可以编写自定义监听器、过滤器和标签库来扩展其功能。
10. **兼容性**:Tomcat 6.0.13是针对Java EE 5规范的,因此它支持该版本中的各种特性,如EJB轻量级客户端支持。
这个"apache-tomcat-6.0.13-src"文件很可能是Tomcat 6.0.13的源代码包,对于开发者来说,它可以用于深入理解Tomcat的工作原理,进行定制化开发,或者对源码进行调试和优化。通过阅读和研究源代码,可以学习到更多关于Web服务器架构、HTTP协议处理、多线程编程以及Java Web应用部署等方面的知识。