Author: remy.maucherat(a)jboss.com
Date: 2009-10-15 10:57:00 -0400 (Thu, 15 Oct 2009)
New Revision: 1194
Removed:
trunk/java/org/apache/catalina/servlets/InvokerHttpRequest.java
trunk/java/org/apache/catalina/servlets/InvokerServlet.java
Modified:
trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
trunk/java/org/apache/catalina/core/RestrictedServlets.properties
trunk/java/org/apache/catalina/servlets/LocalStrings.properties
Log:
- Remove invoker servlet.
Modified: trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationDispatcher.java 2009-10-14 11:57:52 UTC
(rev 1193)
+++ trunk/java/org/apache/catalina/core/ApplicationDispatcher.java 2009-10-15 14:57:00 UTC
(rev 1194)
@@ -911,9 +911,6 @@
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)
Modified: trunk/java/org/apache/catalina/core/RestrictedServlets.properties
===================================================================
--- trunk/java/org/apache/catalina/core/RestrictedServlets.properties 2009-10-14 11:57:52
UTC (rev 1193)
+++ trunk/java/org/apache/catalina/core/RestrictedServlets.properties 2009-10-15 14:57:00
UTC (rev 1194)
@@ -1,4 +1,3 @@
org.apache.catalina.ssi.SSIServlet=restricted
org.apache.catalina.servlets.CGIServlet=restricted
-org.apache.catalina.servlets.InvokerServlet=restricted
org.apache.catalina.manager.JMXProxyServlet=restricted
Deleted: trunk/java/org/apache/catalina/servlets/InvokerHttpRequest.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/InvokerHttpRequest.java 2009-10-14 11:57:52
UTC (rev 1193)
+++ trunk/java/org/apache/catalina/servlets/InvokerHttpRequest.java 2009-10-15 14:57:00
UTC (rev 1194)
@@ -1,199 +0,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.
- */
-
-
-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;
-
- }
-
-
-}
Deleted: trunk/java/org/apache/catalina/servlets/InvokerServlet.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/InvokerServlet.java 2009-10-14 11:57:52 UTC
(rev 1193)
+++ trunk/java/org/apache/catalina/servlets/InvokerServlet.java 2009-10-15 14:57:00 UTC
(rev 1194)
@@ -1,423 +0,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.
- */
-
-
-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 (context) {
-
- // 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);
- synchronized (context) {
- 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;
- }
- }
-
- }
-
-
-}
Modified: trunk/java/org/apache/catalina/servlets/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/catalina/servlets/LocalStrings.properties 2009-10-14 11:57:52
UTC (rev 1193)
+++ trunk/java/org/apache/catalina/servlets/LocalStrings.properties 2009-10-15 14:57:00
UTC (rev 1194)
@@ -3,12 +3,6 @@
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
directory.filename=Filename
directory.lastModified=Last Modified