alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/servlet/ServletEngine.java,v 1.4 2004/02/23 06:30:55 billbarker Exp $
 * $Revision: 1.4 $
 * $Date: 2004/02/23 06:30:55 $
 *
 *
 *  Copyright 1999-2004 The Apache Software Foundation
 *
 *  Licensed 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.servlet;

import javax.servlet.ServletContext;

/**
 * Simple class to factor out servlet runner dependencies from the JSP
 * engine. There's a few motivations here: 
 *
 *	(a) ability for the JSP engine to be able to run on multiple
 *          servlet engines - 2.1 and 2.2
 *	(b) ability for the JSP engine to take advantage of specific
 *          servlet engines; this is crucial from a J2EE point of
 *          view. 
 *
 * @author Anil K. Vijendran
 * @author Harish Prabandham
 */
public class ServletEngine {
    static ServletEngine tomcat;
    static ServletEngine deflt;
    
    /**
     * Get a specific ServletEngine instance for the particular servlet runner
     * we are running on.
     */
    static ServletEngine getServletEngine(String serverInfo) {
        if (serverInfo.startsWith("Tomcat Web Server")) {
            if (tomcat == null) {
                try {
                    tomcat = (ServletEngine)
                        Class.forName("org.apache.jasper.runtime.TomcatServletEngine").newInstance();
                } catch (Exception ex) {
                    return null;
                }
            }
            return tomcat;
        } else {
            if (deflt == null) 
                deflt = new ServletEngine();
            return deflt;
        }
    }
    
    /**
     * Get the class loader for this ServletContext object. 
     */
    public ClassLoader getClassLoader(ServletContext ctx) {
        return null;
    }
}






... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.