本文共 20681 字,大约阅读时间需要 68 分钟。
2. request对象继承体系结构:
ServletRequest -- 接口
| 继承
HttpServletRequest -- 接口
| 实现
org.apache.catalina.connector.RequestFacade 类(tomcat)
/* * 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.connector;import java.io.BufferedReader;import java.io.IOException;import java.security.AccessController;import java.security.PrivilegedAction;import java.util.Collection;import java.util.Enumeration;import java.util.Locale;import java.util.Map;import javax.servlet.AsyncContext;import javax.servlet.DispatcherType;import javax.servlet.RequestDispatcher;import javax.servlet.ServletContext;import javax.servlet.ServletException;import javax.servlet.ServletInputStream;import javax.servlet.ServletRequest;import javax.servlet.ServletResponse;import javax.servlet.http.Cookie;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession;import javax.servlet.http.HttpUpgradeHandler;import javax.servlet.http.Part;import org.apache.catalina.Globals;import org.apache.catalina.security.SecurityUtil;import org.apache.catalina.servlet4preview.http.HttpServletRequest;import org.apache.catalina.servlet4preview.http.PushBuilder;import org.apache.catalina.servlet4preview.http.ServletMapping;import org.apache.tomcat.util.res.StringManager;/** * Facade class that wraps a Coyote request object. * All methods are delegated to the wrapped request. * * @author Craig R. McClanahan * @author Remy Maucherat */@SuppressWarnings("deprecation")public class RequestFacade implements HttpServletRequest { // ----------------------------------------------------------- DoPrivileged private final class GetAttributePrivilegedAction implements PrivilegedAction > { @Override public Enumeration run() { return request.getAttributeNames(); } } private final class GetParameterMapPrivilegedAction implements PrivilegedAction
转载地址:http://dckzb.baihongyu.com/