* Enabling SSI and CGI Support
* Security manager URLs
* Symlinking static resources
-* Enabling invoker servlet
* Viewing the Tomcat Change Log
* When all else fails
the check.
-=========================
-Enabling invoker servlet:
-=========================
-Starting with Tomcat 4.1.12, the invoker servlet is no longer available by
-default in all webapps. Enabling it for all webapps is possible by editing
-$CATALINA_HOME/conf/web.xml to uncomment the "/servlet/*" servlet-mapping
-definition.
-
-Using the invoker servlet in a production environment is not recommended and
-is unsupported. More details are available on the Tomcat FAQ at
-http://tomcat.apache.org/faq/misc.html#invoker.
-
-
==============================
Viewing the Tomcat Change Log:
==============================
</servlet>
- <!-- The "invoker" servlet, which executes anonymous servlet classes -->
- <!-- that have not been defined in a web.xml file. Traditionally, this -->
- <!-- servlet is mapped to the URL pattern "/servlet/*", but you can map -->
- <!-- it to other patterns as well. The extra path info portion of such a -->
- <!-- request must be the fully qualified class name of a Java class that -->
- <!-- implements Servlet (or extends HttpServlet), or the servlet name -->
- <!-- of an existing servlet definition. This servlet supports the -->
- <!-- following initialization parameters (default values are in square -->
- <!-- brackets): -->
- <!-- -->
- <!-- debug Debugging detail level for messages logged -->
- <!-- by this servlet. [0] -->
-
-<!--
- <servlet>
- <servlet-name>invoker</servlet-name>
- <servlet-class>
- org.apache.catalina.servlets.InvokerServlet
- </servlet-class>
- <init-param>
- <param-name>debug</param-name>
- <param-value>0</param-value>
- </init-param>
- <load-on-startup>2</load-on-startup>
- </servlet>
--->
-
-
<!-- The JSP page compiler and execution servlet, which is the mechanism -->
<!-- used by Tomcat to support JSP pages. Traditionally, this servlet -->
<!-- is mapped to the URL pattern "*.jsp". This servlet supports the -->
<url-pattern>/</url-pattern>
</servlet-mapping>
- <!-- The mapping for the invoker servlet -->
-<!--
- <servlet-mapping>
- <servlet-name>invoker</servlet-name>
- <url-pattern>/servlet/*</url-pattern>
- </servlet-mapping>
--->
-
<!-- The mapping for the JSP servlet -->
<servlet-mapping>
<servlet-name>jsp</servlet-name>
/**
- * The request attribute under which the Invoker servlet will store
- * the invoking servlet path, if it was used to execute a servlet
- * indirectly instead of through a servlet mapping.
- */
- public static final String INVOKED_ATTR =
- "org.apache.catalina.INVOKED";
-
-
- /**
* The request attribute under which we expose the value of the
* <code><jsp-file></code> value associated with this servlet,
* if any.
while (current != null) {
if(state.hrequest == null && (current instanceof HttpServletRequest))
state.hrequest = (HttpServletRequest)current;
- if ("org.apache.catalina.servlets.InvokerHttpRequest".
- equals(current.getClass().getName()))
- break; // KLUDGE - Make nested RD.forward() using invoker work
if (!(current instanceof ServletRequestWrapper))
break;
if (current instanceof ApplicationHttpRequest)
org.apache.catalina.ssi.SSIServlet=restricted
org.apache.catalina.servlets.CGIServlet=restricted
-org.apache.catalina.servlets.InvokerServlet=restricted
org.apache.catalina.manager.JMXProxyServlet=restricted
htmlManagerServlet.title=Tomcat Web Application Manager
managerServlet.alreadyContext=FAIL - Application already exists at path {0}
managerServlet.alreadyDocBase=FAIL - Directory {0} is already in use
-managerServlet.cannotInvoke=Cannot invoke manager servlet through invoker
managerServlet.configured=OK - Deployed application from context file {0}
managerServlet.deployed=OK - Deployed application at context path {0}
managerServlet.deployFailed=FAIL - Failed to deploy application at context path {0}
htmlManagerServlet.title=Tomcat Webanwendungs-Manager
managerServlet.alreadyContext=FEHLER - Anwendung existiert bereits für Kontext Pfad {0}
managerServlet.alreadyDocBase=FEHLER - Verzeichnis {0} bereits in Benutzung
-managerServlet.cannotInvoke=Kann Manager-Servlet nicht durch Invoker aufrufen
managerServlet.configured=OK - Anwendung von Kontext-Datei {0} installiert
managerServlet.deployed=OK - Anwendung mit Kontext Pfad {0} installiert
managerServlet.exception=FEHLER - Ausnahme aufgetreten {0}
htmlManagerServlet.title=Gestionnaire d''applications WEB Tomcat
managerServlet.alreadyContext=ECHEC - l''application existe déjà dans le chemin {0}
managerServlet.alreadyDocBase=ECHEC - Le répertoire {0} est déjà utilisé
-managerServlet.cannotInvoke=Impossible d''utiliser le gestionnaire de servlet au travers du délégué (invoker)
managerServlet.configured=OK - Application configurée depuis le fichier contexte {0}
managerServlet.deployed=OK - Application déployée pour le chemin de contexte {0}
managerServlet.exception=ECHEC - L''exception {0} a été rencontrée
* generally be deployed as a separate web application within the virtual host
* to be managed.
* <p>
- * <b>NOTE</b> - For security reasons, this application will not operate
- * when accessed via the invoker servlet. You must explicitly map this servlet
- * with a servlet mapping, and you will always want to protect it with
- * appropriate security constraints as well.
- * <p>
* The following servlet initialization parameters are recognized:
* <ul>
* <li><b>debug</b> - The debugging detail level that controls the amount
HttpServletResponse response)
throws IOException, ServletException {
- // Verify that we were not accessed using the invoker servlet
- if (request.getAttribute(Globals.INVOKED_ATTR) != null)
- throw new UnavailableException
- (sm.getString("managerServlet.cannotInvoke"));
-
// Identify the request parameters that we need
String command = request.getPathInfo();
if (command == null)
HttpServletResponse response)
throws IOException, ServletException {
- // Verify that we were not accessed using the invoker servlet
- if (request.getAttribute(Globals.INVOKED_ATTR) != null)
- throw new UnavailableException
- (sm.getString("managerServlet.cannotInvoke"));
-
// Identify the request parameters that we need
String command = request.getPathInfo();
if (command == null)
throw new UnavailableException
(sm.getString("managerServlet.noWrapper"));
- // Verify that we were not accessed using the invoker servlet
- String servletName = getServletConfig().getServletName();
- if (servletName == null)
- servletName = "";
- if (servletName.startsWith("org.apache.catalina.INVOKER."))
- throw new UnavailableException
- (sm.getString("managerServlet.cannotInvoke"));
-
// Set our properties from the initialization parameters
String value = null;
try {
* this servlet itself will not succeed. Therefore, this servlet should
* generally be deployed in a separate virtual host.
* <p>
- * <b>NOTE</b> - For security reasons, this application will not operate
- * when accessed via the invoker servlet. You must explicitly map this servlet
- * with a servlet mapping, and you will always want to protect it with
- * appropriate security constraints as well.
- * <p>
* The following servlet initialization parameters are recognized:
* <ul>
* <li><b>debug</b> - The debugging detail level that controls the amount
HttpServletResponse response)
throws IOException, ServletException {
- // Verify that we were not accessed using the invoker servlet
- if (request.getAttribute(Globals.INVOKED_ATTR) != null)
- throw new UnavailableException
- (sm.getString("hostManagerServlet.cannotInvoke"));
-
// Identify the request parameters that we need
String command = request.getPathInfo();
if (command == null)
throw new UnavailableException
(sm.getString("hostManagerServlet.noWrapper"));
- // Verify that we were not accessed using the invoker servlet
- String servletName = getServletConfig().getServletName();
- if (servletName == null)
- servletName = "";
- if (servletName.startsWith("org.apache.catalina.INVOKER."))
- throw new UnavailableException
- (sm.getString("hostManagerServlet.cannotInvoke"));
-
// Set our properties from the initialization parameters
String value = null;
try {
# See the License for the specific language governing permissions and
# limitations under the License.
-hostManagerServlet.cannotInvoke=Cannot invoke host manager servlet through invoker
hostManagerServlet.noCommand=FAIL - No command was specified
hostManagerServlet.unknownCommand=FAIL - Unknown command {0}
hostManagerServlet.noWrapper=Container has not called setWrapper() for this servlet
super.init(config);
- // Verify that we were not accessed using the invoker servlet
- String servletName = getServletConfig().getServletName();
- if (servletName == null)
- servletName = "";
- if (servletName.startsWith("org.apache.catalina.INVOKER."))
- throw new UnavailableException
- ("Cannot invoke CGIServlet through the invoker");
-
// Set our properties from the initialization parameters
if (getServletConfig().getInitParameter("debug") != null)
debug = Integer.parseInt(getServletConfig().getInitParameter("debug"));
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
- // Verify that we were not accessed using the invoker servlet
- if (req.getAttribute(Globals.INVOKED_ATTR) != null)
- throw new UnavailableException
- ("Cannot invoke CGIServlet through the invoker");
-
CGIEnvironment cgiEnv = new CGIEnvironment(req, getServletContext());
if (cgiEnv.isValid()) {
+++ /dev/null
-/*
- * 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.servlets;
-
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-
-
-/**
- * Wrapper around a <code>javax.servlet.http.HttpServletRequest</code>
- * utilized when <code>InvokerServlet</code> processes the initial request
- * for an invoked servlet. Subsequent requests will be mapped directly
- * to the servlet, because a new servlet mapping will have been created.
- *
- * @author Craig R. McClanahan
- * @version $Revision$ $Date$
- */
-
-class InvokerHttpRequest extends HttpServletRequestWrapper {
-
-
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new wrapped request around the specified servlet request.
- *
- * @param request The servlet request being wrapped
- */
- public InvokerHttpRequest(HttpServletRequest request) {
-
- super(request);
- this.pathInfo = request.getPathInfo();
- this.pathTranslated = request.getPathTranslated();
- this.requestURI = request.getRequestURI();
- this.servletPath = request.getServletPath();
-
- }
-
-
- // ----------------------------------------------------- Instance Variables
-
-
- /**
- * Descriptive information about this implementation.
- */
- protected static final String info =
- "org.apache.catalina.servlets.InvokerHttpRequest/1.0";
-
-
- /**
- * The path information for this request.
- */
- protected String pathInfo = null;
-
-
- /**
- * The translated path information for this request.
- */
- protected String pathTranslated = null;
-
-
- /**
- * The request URI for this request.
- */
- protected String requestURI = null;
-
-
- /**
- * The servlet path for this request.
- */
- protected String servletPath = null;
-
-
- // --------------------------------------------- HttpServletRequest Methods
-
-
- /**
- * Override the <code>getPathInfo()</code> method of the wrapped request.
- */
- public String getPathInfo() {
-
- return (this.pathInfo);
-
- }
-
-
- /**
- * Override the <code>getPathTranslated()</code> method of the
- * wrapped request.
- */
- public String getPathTranslated() {
-
- return (this.pathTranslated);
-
- }
-
-
- /**
- * Override the <code>getRequestURI()</code> method of the wrapped request.
- */
- public String getRequestURI() {
-
- return (this.requestURI);
-
- }
-
-
- /**
- * Override the <code>getServletPath()</code> method of the wrapped
- * request.
- */
- public String getServletPath() {
-
- return (this.servletPath);
-
- }
-
-
- // -------------------------------------------------------- Package Methods
-
-
-
- /**
- * Return descriptive information about this implementation.
- */
- public String getInfo() {
-
- return (info);
-
- }
-
-
- /**
- * Set the path information for this request.
- *
- * @param pathInfo The new path info
- */
- void setPathInfo(String pathInfo) {
-
- this.pathInfo = pathInfo;
-
- }
-
-
- /**
- * Set the translated path info for this request.
- *
- * @param pathTranslated The new translated path info
- */
- void setPathTranslated(String pathTranslated) {
-
- this.pathTranslated = pathTranslated;
-
- }
-
-
- /**
- * Set the request URI for this request.
- *
- * @param requestURI The new request URI
- */
- void setRequestURI(String requestURI) {
-
- this.requestURI = requestURI;
-
- }
-
-
- /**
- * Set the servlet path for this request.
- *
- * @param servletPath The new servlet path
- */
- void setServletPath(String servletPath) {
-
- this.servletPath = servletPath;
-
- }
-
-
-}
+++ /dev/null
-/*
- * 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.servlets;
-
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.UnavailableException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.catalina.ContainerServlet;
-import org.apache.catalina.Context;
-import org.apache.catalina.Globals;
-import org.apache.catalina.Wrapper;
-import org.apache.catalina.util.StringManager;
-
-
-/**
- * The default servlet-invoking servlet for most web applications,
- * used to serve requests to servlets that have not been registered
- * in the web application deployment descriptor.
- *
- * @author Craig R. McClanahan
- * @version $Revision$ $Date$
- */
-
-public final class InvokerServlet
- extends HttpServlet implements ContainerServlet {
-
-
- // ----------------------------------------------------- Instance Variables
-
-
- /**
- * The Context container associated with our web application.
- */
- private Context context = null;
-
-
- /**
- * The debugging detail level for this servlet.
- */
- private int debug = 0;
-
-
- /**
- * The string manager for this package.
- */
- private static StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
- /**
- * The Wrapper container associated with this servlet.
- */
- private Wrapper wrapper = null;
-
-
- // ----------------------------------------------- ContainerServlet Methods
-
-
- /**
- * Return the Wrapper with which we are associated.
- */
- public Wrapper getWrapper() {
-
- return (this.wrapper);
-
- }
-
-
- /**
- * Set the Wrapper with which we are associated.
- *
- * @param wrapper The new wrapper
- */
- public void setWrapper(Wrapper wrapper) {
-
- this.wrapper = wrapper;
- if (wrapper == null)
- context = null;
- else
- context = (Context) wrapper.getParent();
-
- }
-
-
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * Finalize this servlet.
- */
- public void destroy() {
-
- ; // No actions necessary
-
- }
-
-
- /**
- * Process a GET request for the specified resource.
- *
- * @param request The servlet request we are processing
- * @param response The servlet response we are creating
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if a servlet-specified error occurs
- */
- public void doGet(HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
-
- serveRequest(request, response);
-
- }
-
-
- /**
- * Process a HEAD request for the specified resource.
- *
- * @param request The servlet request we are processing
- * @param response The servlet response we are creating
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if a servlet-specified error occurs
- */
- public void doHead(HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
-
- serveRequest(request, response);
-
- }
-
-
- /**
- * Process a POST request for the specified resource.
- *
- * @param request The servlet request we are processing
- * @param response The servlet response we are creating
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if a servlet-specified error occurs
- */
- public void doPost(HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
-
- serveRequest(request, response);
-
- }
-
-
- /**
- * Initialize this servlet.
- */
- public void init() throws ServletException {
-
- // Ensure that our ContainerServlet properties have been set
- if ((wrapper == null) || (context == null))
- throw new UnavailableException
- (sm.getString("invokerServlet.noWrapper"));
-
- // Set our properties from the initialization parameters
- if (getServletConfig().getInitParameter("debug") != null)
- debug = Integer.parseInt(getServletConfig().getInitParameter("debug"));
-
- if (debug >= 1)
- log("init: Associated with Context '" + context.getPath() + "'");
-
- }
-
-
-
- // -------------------------------------------------------- Private Methods
-
-
- /**
- * Serve the specified request, creating the corresponding response.
- * After the first time a particular servlet class is requested, it will
- * be served directly (like any registered servlet) because it will have
- * been registered and mapped in our associated Context.
- *
- * @param request The servlet request we are processing
- * @param response The servlet response we are creating
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if a servlet-specified error occurs
- */
- public void serveRequest(HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
-
- // Disallow calling this servlet via a named dispatcher
- if (request.getAttribute(Globals.NAMED_DISPATCHER_ATTR) != null)
- throw new ServletException
- (sm.getString("invokerServlet.notNamed"));
-
- // Identify the input parameters and our "included" state
- String inRequestURI = null;
- String inServletPath = null;
- String inPathInfo = null;
- boolean included =
- (request.getAttribute(Globals.INCLUDE_REQUEST_URI_ATTR) != null);
-
- if (included) {
- inRequestURI =
- (String) request.getAttribute(Globals.INCLUDE_REQUEST_URI_ATTR);
- inServletPath =
- (String) request.getAttribute(Globals.INCLUDE_SERVLET_PATH_ATTR);
- inPathInfo =
- (String) request.getAttribute(Globals.INCLUDE_PATH_INFO_ATTR);
- } else {
- inRequestURI = request.getRequestURI();
- inServletPath = request.getServletPath();
- inPathInfo = request.getPathInfo();
- }
- if (debug >= 1) {
- log("included='" + included + "', requestURI='" +
- inRequestURI + "'");
- log(" servletPath='" + inServletPath + "', pathInfo='" +
- inPathInfo + "'");
- }
-
- // Make sure a servlet name or class name was specified
- if (inPathInfo == null) {
- if (debug >= 1)
- log("Invalid pathInfo '" + inPathInfo + "'");
- if (included)
- throw new ServletException
- (sm.getString("invokerServlet.invalidPath", inRequestURI));
- else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
- inRequestURI);
- return;
- }
- }
-
- // Identify the outgoing servlet name or class, and outgoing path info
- String pathInfo = inPathInfo;
- String servletClass = pathInfo.substring(1);
- int slash = servletClass.indexOf('/');
- if (slash >= 0) {
- pathInfo = servletClass.substring(slash);
- servletClass = servletClass.substring(0, slash);
- } else {
- pathInfo = "";
- }
-
- if (servletClass.startsWith("org.apache.catalina")) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
- inRequestURI);
- return;
- }
-
- if (debug >= 1)
- log("Processing servlet '" + servletClass +
- "' with path info '" + pathInfo + "'");
- String name = "org.apache.catalina.INVOKER." + servletClass;
- String pattern = inServletPath + "/" + servletClass + "/*";
- Wrapper wrapper = null;
-
- // Synchronize to avoid race conditions when multiple requests
- // try to initialize the same servlet at the same time
- synchronized (this) {
-
- // Are we referencing an existing servlet class or name?
- wrapper = (Wrapper) context.findChild(servletClass);
- if (wrapper == null)
- wrapper = (Wrapper) context.findChild(name);
- if (wrapper != null) {
- String actualServletClass = wrapper.getServletClass();
- if ((actualServletClass != null)
- && (actualServletClass.startsWith
- ("org.apache.catalina"))) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
- inRequestURI);
- return;
- }
- if (debug >= 1)
- log("Using wrapper for servlet '" +
- wrapper.getName() + "' with mapping '" +
- pattern + "'");
- context.addServletMapping(pattern, wrapper.getName());
- }
-
- // No, create a new wrapper for the specified servlet class
- else {
-
- if (debug >= 1)
- log("Creating wrapper for '" + servletClass +
- "' with mapping '" + pattern + "'");
-
- try {
- wrapper = context.createWrapper();
- wrapper.setName(name);
- wrapper.setLoadOnStartup(1);
- wrapper.setServletClass(servletClass);
- context.addChild(wrapper);
- context.addServletMapping(pattern, name);
- } catch (Exception e) {
- log(sm.getString("invokerServlet.cannotCreate",
- inRequestURI), e);
- context.removeServletMapping(pattern);
- context.removeChild(wrapper);
- if (included)
- throw new ServletException
- (sm.getString("invokerServlet.cannotCreate",
- inRequestURI), e);
- else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
- inRequestURI);
- return;
- }
- }
- }
-
- }
-
- // Create a request wrapper to pass on to the invoked servlet
- InvokerHttpRequest wrequest =
- new InvokerHttpRequest(request);
- wrequest.setRequestURI(inRequestURI);
- StringBuffer sb = new StringBuffer(inServletPath);
- sb.append("/");
- sb.append(servletClass);
- wrequest.setServletPath(sb.toString());
- if ((pathInfo == null) || (pathInfo.length() < 1)) {
- wrequest.setPathInfo(null);
- wrequest.setPathTranslated(null);
- } else {
- wrequest.setPathInfo(pathInfo);
- wrequest.setPathTranslated
- (getServletContext().getRealPath(pathInfo));
- }
-
- // Allocate a servlet instance to perform this request
- Servlet instance = null;
- try {
- instance = wrapper.allocate();
- } catch (ServletException e) {
- log(sm.getString("invokerServlet.allocate", inRequestURI), e);
- context.removeServletMapping(pattern);
- context.removeChild(wrapper);
- Throwable rootCause = e.getRootCause();
- if (rootCause == null)
- rootCause = e;
- if (rootCause instanceof ClassNotFoundException) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
- inRequestURI);
- return;
- } else if (rootCause instanceof IOException) {
- throw (IOException) rootCause;
- } else if (rootCause instanceof RuntimeException) {
- throw (RuntimeException) rootCause;
- } else if (rootCause instanceof ServletException) {
- throw (ServletException) rootCause;
- } else {
- throw new ServletException
- (sm.getString("invokerServlet.allocate", inRequestURI),
- rootCause);
- }
- }
-
- // After loading the wrapper, restore some of the fields when including
- if (included) {
- wrequest.setRequestURI(request.getRequestURI());
- wrequest.setPathInfo(request.getPathInfo());
- wrequest.setServletPath(request.getServletPath());
- }
-
- // Invoke the service() method of the allocated servlet
- try {
- String jspFile = wrapper.getJspFile();
- if (jspFile != null)
- request.setAttribute(Globals.JSP_FILE_ATTR, jspFile);
- else
- request.removeAttribute(Globals.JSP_FILE_ATTR);
- request.setAttribute(Globals.INVOKED_ATTR,
- request.getServletPath());
- instance.service(wrequest, response);
- } catch (UnavailableException e) {
- context.removeServletMapping(pattern);
- throw e;
- } finally {
- request.removeAttribute(Globals.INVOKED_ATTR);
- request.removeAttribute(Globals.JSP_FILE_ATTR);
- // Deallocate the allocated servlet instance
- try {
- wrapper.deallocate(instance);
- } catch (ServletException e) {
- log(sm.getString("invokerServlet.deallocate", inRequestURI), e);
- throw e;
- }
- }
-
- }
-
-
-}
defaultservlet.upto=Up to:
defaultservlet.subdirectories=Subdirectories:
defaultservlet.files=Files:
-invokerServlet.allocate=Cannot allocate servlet instance for path {0}
-invokerServlet.cannotCreate=Cannot create servlet wrapper for path {0}
-invokerServlet.deallocate=Cannot deallocate servlet instance for path {0}
-invokerServlet.invalidPath=No servlet name or class was specified in path {0}
-invokerServlet.notNamed=Cannot call invoker servlet with a named dispatcher
-invokerServlet.noWrapper=Container has not called setWrapper() for this servlet
webdavservlet.jaxpfailed=JAXP initialization failed
webdavservlet.enternalEntityIgnored=The request included a reference to an external entity with PublicID {0} and SystemID {1} which was ignored
directory.filename=Filename
defaultservlet.upto = Atr\u00E1s a\:
defaultservlet.subdirectories = Subdirectorios\:
defaultservlet.files = Archivos\:
-invokerServlet.allocate = No puedo reservar espacio para instancia de servlet para trayectoria {0}
-invokerServlet.cannotCreate = No puedo crear arropador (wrapper) de servlet para trayectoria {0}
-invokerServlet.deallocate = No puedo recuperar instancia de servlet para trayectoria {0}
-invokerServlet.invalidPath = No se ha especificado nombre de servlet o clase en trayectoria {0}
-invokerServlet.notNamed = No puedo llamar a servlet invocador mediante un despachador nombrado (named)
-invokerServlet.noWrapper = El Contenedor no ha llamado a setWrapper() para este servlet
webdavservlet.jaxpfailed = Fall\u00F3 la inicializaci\u00F3n de JAXP
webdavservlet.enternalEntityIgnored = El requerimiento inclu\u00EDa una referencia a una entidad externa con PublicID {0} y SystemID {1} que fue ignorada
directory.filename = Nombre de Archivo
defaultservlet.upto=Jusqu''à:
defaultservlet.subdirectories=Sous-répertoires:
defaultservlet.files=Fichiers:
-invokerServlet.allocate=Impossible d''allouer une instance de servlet pour le chemin {0}
-invokerServlet.cannotCreate=Impossible de créer un enrobeur (wrapper) de servlet pour le chemin {0}
-invokerServlet.deallocate=Impossible de désallouer une instance de servlet pour le chemin {0}
-invokerServlet.invalidPath=Aucun nom de servlet ou de classe n''a été spécifié pour le chemin {0}
-invokerServlet.notNamed=Impossible d''appeler le délégué (invoker) de servlet avec un aiguilleur (dispatcher) nommé
-invokerServlet.noWrapper=Le conteneur n''a pas appelé "setWrapper()" pour cette servlet
webdavservlet.jaxpfailed=Erreur d''initialisation de JAXP
directory.filename=Nom de fichier
directory.lastModified=Dernière modification
defaultservlet.upto=\u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea:
defaultservlet.subdirectories=\u30b5\u30d6\u30c7\u30a3\u30ec\u30af\u30c8\u30ea:
defaultservlet.files=\u30d5\u30a1\u30a4\u30eb:
-invokerServlet.allocate=\u30d1\u30b9 {0} \u306b\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u5272\u308a\u5f53\u3066\u3089\u308c\u307e\u305b\u3093
-invokerServlet.cannotCreate=\u30d1\u30b9 {0} \u306b\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u30e9\u30c3\u30d1\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093
-invokerServlet.deallocate=\u30d1\u30b9 {0} \u306e\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5272\u308a\u5f53\u3066\u3092\u89e3\u9664\u3067\u304d\u307e\u305b\u3093
-invokerServlet.invalidPath=\u30d1\u30b9 {0} \u306b\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u540d\u53c8\u306f\u30af\u30e9\u30b9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093
-invokerServlet.notNamed=\u305d\u306e\u540d\u524d\u306e\u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\u30e3\u3067\u30a4\u30f3\u30dc\u30fc\u30ab\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u3092\u547c\u3073\u51fa\u305b\u307e\u305b\u3093
-invokerServlet.noWrapper=\u30b3\u30f3\u30c6\u30ca\u306f\u3053\u306e\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u306b\u5bfe\u3057\u3066\u547c\u3073\u51fa\u3055\u308c\u305fsetWrapper()\u3092\u6301\u3063\u3066\u3044\u307e\u305b\u3093
webdavservlet.jaxpfailed=JAXP\u306e\u521d\u671f\u5316\u306b\u5931\u6557\u3057\u307e\u3057\u305f
directory.filename=\u30d5\u30a1\u30a4\u30eb\u540d
directory.lastModified=\u6700\u7d42\u66f4\u65b0
<subsection name="Initialization Functionality">
<p>The following processing must be performed when the <code>init()</code>
- method of the invoker servlet is called:</p>
+ method of the default servlet is called:</p>
<ul>
<li>Process and sanity check configuration parameters.</li>
</ul>
<p>In addition the the assertions implied by the functionality requirements
listed above, the following additional assertions shall be tested to
- validate the behavior of the invoker servlet:</p>
+ validate the behavior of the default servlet:</p>
<ul>
<li>Requests for resources that do not exist in the web application must
return HTTP status 404 (not found).</li>
+++ /dev/null
-<?xml version="1.0"?>
-<!--
- 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.
--->
-<!DOCTYPE document [
- <!ENTITY project SYSTEM "project.xml">
-]>
-<document url="fs-invoker.html">
-
- &project;
-
- <properties>
- <author email="craigmcc@apache.org">Craig McClanahan</author>
- <title>Invoker Servlet</title>
- <revision>$Id$</revision>
- </properties>
-
-<body>
-
-
-<section name="Overview">
-
-
- <subsection name="Introduction">
-
- <p>The purpose of the <strong>Invoker Servlet</strong> is to allow a
- web application to dynamically register new <em>servlet definitions</em>
- that correspond with a <code><servlet></code> element in the
- <code>/WEB-INF/web.xml</code> deployment descriptor, and execute
- requests utilizing the new servlet definitions. From the perspective
- of the newly registered servlets, all servlet lifecycle requirements
- of the Servlet Specification (such as calling <code>init()</code> and
- <code>destroy()</code> at the correct times) will be respected.</p>
-
- </subsection>
-
-
- <subsection name="External Specifications">
-
- <p>I do not know of any formal specification of the behavior of an
- invoker servlet that is publicly available. Anyone know of one?</p>
-
- </subsection>
-
-
- <subsection name="Implementation Requirements">
-
- <p>The implementation of this functionality shall conform to the
- following requirements:</p>
- <ul>
- <li>Implemented as a servlet.</li>
- <li>Exist in the <code>org.apache.catalina.servlets</code> package
- so that it can be loaded by the Catalina class loader.</li>
- <li>Implement the <code>org.apache.catalina.ContainerServlet</code>
- interface, so that it gains knowledge of the <code>Wrapper</code>
- that is responsible for itself and, therefore, access to other
- internal Catalina components.</li>
- <li>Support a configurable debugging detail level.</li>
- <li>Log debugging and operational messages (suitably internationalized)
- via the <code>getServletContext().log()</code> method.</li>
- </ul>
-
- </subsection>
-
-
-</section>
-
-
-<section name="Dependencies">
-
-
- <subsection name="Environmental Dependencies">
-
- <p>The following environmental dependencies must be met in order for
- the Invoker servlet to operate correctly:</p>
- <ul>
- <li>The invoker servlet must be registered in the application deployment
- descriptor (or the default deployment descriptor in file
- <code>$CATALINA_BASE/conf/web.xml</code>) using a "path mapped"
- servlet mapping. The historical default mapping is to URL pattern
- "<code>/servlet/*</code>", although the invoker servlet must operate
- correctly with an arbitrary mapping.</li>
- </ul>
-
- </subsection>
-
-
- <subsection name="Container Dependencies">
-
- <p>Correct operation of the invoker servlet depends on the following
- specific features of the surrounding container:</p>
- <ul>
- <li>Correct support for the <code>ContainerServlet</code> interface,
- including calling <code>setWrapper()</code> <strong>before</strong>
- the <code>init()</code> method of the invoker servlet is called.</li>
- <li>The web application class loader must be stored as the context
- class loader of the request processing thread.</li>
- </ul>
-
- </subsection>
-
-
-</section>
-
-
-<section name="Functionality">
-
-
- <subsection name="Initialization Functionality">
-
- <p>The following processing must be performed when the <code>init()</code>
- method of the invoker servlet is called:</p>
- <ul>
- <li>Ensure that the container has called <code>setWrapper()</code>. If
- not, throw a permanent <code>UnavailableException</code>.</li>
- <li>Look up and cache the <code>Context</code> that corresponds to our
- <code>Wrapper</code>. This is the component with which new servlet
- definitions and mappings will be registered.</li>
- </ul>
-
- </subsection>
-
-
- <subsection name="Per-Request Functionality">
-
- <p>On each request, the following processing shall be performed:</p>
- <ol>
- <li>Calculate the <code>{ServletPath}</code> for this request, either from
- request attribute <code>javax.servlet.include.servlet_path</code> or
- by calling <code>request.getServletPath()</code>.</li>
- <li>Calculate the <code>{PathInfo}</code> for this request, either from
- request attribute <code>javax.servlet.include.path_info</code> or
- by calling <code>request.getPathInfo()</code>. If the calculated
- <code>{PathInfo}</code> is null, return HTTP status 400
- (bad request).</li>
- <li>Parse the calculated <code>{PathInfo}</code> value as follows:
- <ol>
- <li>Ignore the leading slash character.</li>
- <li>Accumulate characters up to the next '/' (if any) as the
- <code>{ServletSelector}</code>.</li>
- <li>If a '/' was encountered, accumulate all characters from that
- slash (inclusive) to the end of the string as
- <code>{PathRemainder}</code>. If no slash was encountered,
- set <code>{PathRemainder}</code> to a zero-length string.</li>
- </ol></li>
- <li>Determine whether <code>{ServletSelector}</code> is the name of an
- existing servlet definition, and process it as follows:
- <ol>
- <li>Ask our associated <code>Context</code> to find and return a
- child <code>Wrapper</code> named <code>{ServletSelector}</code>.
- </li>
- <li>If there is no such child, skip to the next major step.</li>
- <li>Register a new servlet mapping for this <code>Wrapper</code>,
- using a URL pattern calculated as follows:
- <code>{ServletPath}</code> + "/" + <code>{ServletSelector}</code>
- + "/*"</li>
- <li>Create a request dispatcher using a path calculated as follows:
- <code>{ServletPath}</code> + "/" + <code>{ServletSelector}</code>
- + <code>{PathRemainder}</code></li>
- <li>Forward this request to the created request dispatcher, and
- exit from this request.</li>
- </ol></li>
- <li>Assume that <code>{ServletSelector}</code> is the fully qualified
- name of a Java class that implements <code>javax.servlet.Servlet</code>
- and process it as follows:
- <ol>
- <li>Synthesize a new <code>{ServletName}</code> for the servlet
- definition that will be created.</li>
- <li>If there is already a child <code>Wrapper</code> associated with
- this name, return HTTP status 500 (internal server error), because
- a mapping should have already been created for this servlet.</li>
- <li>Attempt to load a class named <code>{ServletSelector}</code> from
- the web application class loader (i.e. the context class loader
- for our current thread). If this fails, return HTTP status 404
- (not found).</li>
- <li>Instantiate an instance of this class. If an error occurs,
- return HTTP status 404 (not found).</li>
- <li>If this class does not implement the
- <code>javax.servlet.Servlet</code> interface, return HTTP status
- 404 (not found).</li>
- <li>Create and register a new <code>Wrapper</code> child with our
- <code>Context</code>, under name <code>{ServletName}</code>.</li>
- <li>Register a new servlet mapping for this <code>Wrapper</code>,
- using a URL pattern calculated as follows:
- <code>{ServletPath}</code> + "/" + <code>{ServletSelector}</code>
- + "/*"</li>
- <li>Create a request dispatcher using a path calculated as follows:
- <code>{ServletPath}</code> + "/" + <code>{ServletSelector}</code>
- + <code>{PathRemainder}</code></li>
- <li>Forward this request to the created request dispatcher, and
- exit from this request.</li>
- </ol></li>
- </ol>
-
- </subsection>
-
-
- <subsection name="Finalization Functionality">
-
- <p>No specific processing is required when the <code>destroy()</code>
- method is called:</p>
-
- </subsection>
-
-
-</section>
-
-
-<section name="Testable Assertions">
-
- <p>In addition the the assertions implied by the functionality requirements
- listed above, the following additional assertions shall be tested to
- validate the behavior of the invoker servlet:</p>
- <ul>
- <li>It is possible to access an existing servlet definition by name
- through the invoker. The existing servlet definition can include
- either a <code><servlet-class></code> or
- <code><jsp-file></code> subelement.</li>
- <li>When an existing servlet definition is accessed by name, the request
- will be ultimately processed by the same servlet instance that would
- have processed it had a mapping to that servlet definition been used
- on the request directly.</li>
- <li>It is possible to access an anonymous servlet by class name
- through the invoker.</li>
- <li>When an anonymous servlet is accessed, the servlet instance is processed
- according to the lifecycle requirements of the Servlet Specification.
- </li>
- <li>When an anonymous servlet is accessed, the servlet instance receives
- a <code>ServletConfig</code> instance with no servlet initialization
- parameters.</li>
- <li>It is possible to utilize the invoker servlet via a direct request.</li>
- <li>It is possible to utilize the invoker servlet via a call to
- <code>RequestDispatcher.forward()</code>, or the corresponding
- <code><jsp:forward></code> tag in a JSP page.</li>
- <li>It is possible to utilize the invoker servlet via a call to
- <code>RequestDispatcher.include()</code>, or the corresponding
- <code><jsp:include></code> tag in a JSP page.</li>
- <li>It is possible to use any HTTP method (including GET and POST) that
- is supported by the Servlet class that is ultimately executed.</li>
- <li>The invoker servlet should never be asked to process a second or
- subsequent request for the same <code>{ServletSelector}</code> (because
- it will have registered an appropriate servlet mapping.</li>
- </ul>
-
-</section>
-
-
-</body>
-
-</document>
<menu name="Internal Servlets">
<item name="Default Servlet" href="fs-default.html"/>
- <item name="Invoker Servlet" href="fs-invoker.html"/>
</menu>
<menu name="Realm Implementations">
public String toString() {
if (filterConfig == null)
- return ("InvokerFilter()");
- StringBuffer sb = new StringBuffer("InvokerFilter(");
+ return ("TimingFilter()");
+ StringBuffer sb = new StringBuffer("TimingFilter(");
sb.append(filterConfig);
sb.append(")");
return (sb.toString());
<display-name>Servlet and JSP Examples</display-name>
- <!-- Define servlet-mapped and path-mapped example filters -->
+ <!-- Define example filters -->
<filter>
- <filter-name>Servlet Mapped Filter</filter-name>
+ <filter-name>Timing filter</filter-name>
<filter-class>filters.ExampleFilter</filter-class>
<init-param>
<param-name>attribute</param-name>
- <param-value>filters.ExampleFilter.SERVLET_MAPPED</param-value>
- </init-param>
- </filter>
- <filter>
- <filter-name>Path Mapped Filter</filter-name>
- <filter-class>filters.ExampleFilter</filter-class>
- <init-param>
- <param-name>attribute</param-name>
- <param-value>filters.ExampleFilter.PATH_MAPPED</param-value>
+ <param-value>filters.ExampleFilter</param-value>
</init-param>
</filter>
+
<filter>
<filter-name>Request Dumper Filter</filter-name>
<filter-class>filters.RequestDumperFilter</filter-class>
</init-param>
</filter>
- <!-- Define filter mappings for the defined filters -->
+ <!-- Define filter mappings for the timing filters -->
+ <!--
<filter-mapping>
- <filter-name>Servlet Mapped Filter</filter-name>
- <servlet-name>invoker</servlet-name>
- </filter-mapping>
- <filter-mapping>
- <filter-name>Path Mapped Filter</filter-name>
- <url-pattern>/servlet/*</url-pattern>
+ <filter-name>Timing Filter</filter-name>
+ <url-pattern>/*</url-pattern>
</filter-mapping>
+ -->
<!-- Example filter mapping to apply the "Set Character Encoding" filter
to *all* requests processed by this web application -->