⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coyoterequest.java

📁 Tomcat 4.1与WebServer集成组件的源代码包.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
/* * $Header: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v 1.14 2003/01/05 11:24:22 remm Exp $ * $Revision: 1.14 $ * $Date: 2003/01/05 11:24:22 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation.  All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in *    the documentation and/or other materials provided with the *    distribution. * * 3. The end-user documentation included with the redistribution, if *    any, must include the following acknowlegement: *       "This product includes software developed by the *        Apache Software Foundation (http://www.apache.org/)." *    Alternately, this acknowlegement may appear in the software itself, *    if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software *    Foundation" must not be used to endorse or promote products derived *    from this software without prior written permission. For written *    permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" *    nor may "Apache" appear in their names without prior written *    permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation.  For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * [Additional notices, if required by prior licensing conditions] * */package org.apache.coyote.tomcat5;import java.io.InputStream;import java.io.InputStreamReader;import java.io.IOException;import java.io.BufferedReader;import java.io.UnsupportedEncodingException;import java.net.InetAddress;import java.net.Socket;import java.security.Principal;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.Date;import java.util.Enumeration;import java.util.HashMap;import java.util.Iterator;import java.util.Locale;import java.util.Map;import java.util.TimeZone;import java.util.TreeMap;import javax.servlet.FilterChain;import javax.servlet.RequestDispatcher;import javax.servlet.ServletContext;import javax.servlet.ServletException;import javax.servlet.ServletInputStream;import javax.servlet.ServletRequest;import javax.servlet.ServletRequestEvent;import javax.servlet.ServletRequestListener;import javax.servlet.ServletRequestAttributeEvent;import javax.servlet.ServletRequestAttributeListener;import javax.servlet.http.Cookie;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession;import org.apache.tomcat.util.http.FastHttpDateFormat;import org.apache.tomcat.util.http.Parameters;import org.apache.coyote.ActionCode;import org.apache.coyote.Request;import org.apache.catalina.Connector;import org.apache.catalina.Context;import org.apache.catalina.Globals;import org.apache.catalina.HttpRequest;import org.apache.catalina.Logger;import org.apache.catalina.Manager;import org.apache.catalina.Realm;import org.apache.catalina.Session;import org.apache.catalina.ValveContext;import org.apache.catalina.Wrapper;import org.apache.catalina.util.Enumerator;import org.apache.catalina.util.ParameterMap;import org.apache.catalina.util.RequestUtil;import org.apache.catalina.util.StringManager;import org.apache.catalina.util.StringParser;import org.apache.tomcat.util.net.SSLSupport;/** * Wrapper object for the Coyote request. * * @author Remy Maucherat * @author Craig R. McClanahan * @version $Revision: 1.14 $ $Date: 2003/01/05 11:24:22 $ */public class CoyoteRequest    implements HttpRequest, HttpServletRequest {    // ----------------------------------------------------------- Constructors    public CoyoteRequest() {        formats[0].setTimeZone(TimeZone.getTimeZone("GMT"));        formats[1].setTimeZone(TimeZone.getTimeZone("GMT"));        formats[2].setTimeZone(TimeZone.getTimeZone("GMT"));    }    // ------------------------------------------------------------- Properties    /**     * Coyote request.     */    protected Request coyoteRequest;    /**     * Set the Coyote request.     *      * @param coyoteRequest The Coyote request     */    public void setCoyoteRequest(Request coyoteRequest) {        this.coyoteRequest = coyoteRequest;        inputBuffer.setRequest(coyoteRequest);    }    /**     * Get the Coyote request.     */    public Request getCoyoteRequest() {        return (this.coyoteRequest);    }    // ----------------------------------------------------- Instance Variables    /**     * The string manager for this package.     */    protected static StringManager sm =        StringManager.getManager(Constants.Package);    /**     * The set of cookies associated with this Request.     */    protected Cookie[] cookies = null;    /**     * The set of SimpleDateFormat formats to use in getDateHeader().     */    protected SimpleDateFormat formats[] = {        new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),        new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),        new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)    };    /**     * The default Locale if none are specified.     */    protected static Locale defaultLocale = Locale.getDefault();    /**     * The attributes associated with this Request, keyed by attribute name.     */    protected HashMap attributes = new HashMap();    /**     * List of read only attributes for this Request.     */    private HashMap readOnlyAttributes = new HashMap();    /**     * The preferred Locales assocaited with this Request.     */    protected ArrayList locales = new ArrayList();    /**     * Internal notes associated with this request by Catalina components     * and event listeners.     */    private transient HashMap notes = new HashMap();    /**     * Authentication type.     */    protected String authType = null;    /**     * The associated input buffer.     */    protected InputBuffer inputBuffer = new InputBuffer();    /**     * ServletInputStream.     */    protected CoyoteInputStream inputStream =         new CoyoteInputStream(inputBuffer);    /**     * Reader.     */    protected BufferedReader reader = new CoyoteReader(inputBuffer);    /**     * Using stream flag.     */    protected boolean usingInputStream = false;    /**     * Using writer flag.     */    protected boolean usingReader = false;    /**     * Context path.     */    protected String contextPath = "";    /**     * Path info.     */    protected String pathInfo = null;    /**     * Servlet path.     */    protected String servletPath = null;    /**     * User principal.     */    protected Principal userPrincipal = null;    /**     * Session parsed flag.     */    protected boolean sessionParsed = false;    /**     * Request parameters parsed flag.     */    protected boolean requestParametersParsed = false;    /**     * Secure flag.     */    protected boolean secure = false;    /**     * Post data buffer.     */    protected static int CACHED_POST_LEN = 8192;    protected byte[] postData = null;    /**     * Hash map used in the getParametersMap method.     */    protected ParameterMap parameterMap = new ParameterMap();    /**     * The currently active session for this request.     */    protected Session session = null;    /**     * Was the requested session ID received in a cookie?     */    protected boolean requestedSessionCookie = false;    /**     * The requested session ID (if any) for this request.     */    protected String requestedSessionId = null;    /**     * Was the requested session ID received in a URL?     */    protected boolean requestedSessionURL = false;    /**     * The socket through which this Request was received.     */    protected Socket socket = null;    /**     * Parse locales.     */    protected boolean localesParsed = false;    /**     * The string parser we will use for parsing request lines.     */    private StringParser parser = new StringParser();    /**     * Remote address.     */    protected String remoteAddr = null;    /**     * Remote host.     */    protected String remoteHost = null;    // --------------------------------------------------------- Public Methods    /**     * Release all object references, and initialize instance variables, in     * preparation for reuse of this object.     */    public void recycle() {        context = null;        wrapper = null;        authType = null;        inputBuffer.recycle();        usingInputStream = false;        usingReader = false;        contextPath = "";        pathInfo = null;        servletPath = null;        userPrincipal = null;        sessionParsed = false;        requestParametersParsed = false;        locales.clear();        localesParsed = false;        secure = false;        remoteAddr = null;        remoteHost = null;        attributes.clear();        notes.clear();        cookies = null;        session = null;        requestedSessionCookie = false;        requestedSessionId = null;        requestedSessionURL = false;        parameterMap.setLocked(false);        parameterMap.clear();        if ((Constants.SECURITY) && (facade != null)) {            facade.clear();            facade = null;        }    }    // -------------------------------------------------------- Request Methods    /**     * Return the authorization credentials sent with this request.     */    public String getAuthorization() {        return (coyoteRequest.getHeader(Constants.AUTHORIZATION_HEADER));    }    /**     * Set the authorization credentials sent with this request.     *     * @param authorization The new authorization credentials     */    public void setAuthorization(String authorization) {        // Not used    }    /**     * Associated Catalina connector.     */    protected Connector connector;    /**     * Return the Connector through which this Request was received.     */    public Connector getConnector() {        return (this.connector);    }    /**     * Set the Connector through which this Request was received.     *     * @param connector The new connector     */    public void setConnector(Connector connector) {        this.connector = connector;    }    /**     * The Context within which this Request is being processed.     */    protected Context context = null;    /**     * Return the Context within which this Request is being processed.     */    public Context getContext() {        return (this.context);    }    /**     * Set the Context within which this Request is being processed.  This     * must be called as soon as the appropriate Context is identified, because     * it identifies the value to be returned by <code>getContextPath()</code>,     * and thus enables parsing of the request URI.     *     * @param context The newly associated Context     */    public void setContext(Context context) {        this.context = context;    }    /**     * Filter chain associated with the request.     */    protected FilterChain filterChain = null;    /**     * Get filter chain associated with the request.     */    public FilterChain getFilterChain() {        return (this.filterChain);    }    /**     * Set filter chain associated with the request.     *      * @param filterChain new filter chain     */    public void setFilterChain(FilterChain filterChain) {        this.filterChain = filterChain;    }    /**     * Descriptive information about this Request implementation.     */    protected static final String info =        "org.apache.coyote.catalina.CoyoteRequest/1.0";    /**     * Return descriptive information about this Request implementation and     * the corresponding version number, in the format     * <code>&lt;description&gt;/&lt;version&gt;</code>.     */    public String getInfo() {        return (info);    }    /**     * The facade associated with this request.     */    protected CoyoteRequestFacade facade = null;    /**     * Return the <code>ServletRequest</code> for which this object     * is the facade.  This method must be implemented by a subclass.     */    public ServletRequest getRequest() {        if (facade == null) {            facade = new CoyoteRequestFacade(this);        }        return (facade);    }    /**     * The response with which this request is associated.     */    protected org.apache.catalina.Response response = null;    /**     * Return the Response with which this Request is associated.     */    public org.apache.catalina.Response getResponse() {        return (this.response);    }    /**     * Set the Response with which this Request is associated.     *     * @param response The new associated response

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -