|
What this is
Other links
The source code/* * 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. */ /*************************************************************************** * Description: Base http request object. * * Author: Keving Seguin [seguin@apache.org] * * Version: $Revision: 1.6 $ * ***************************************************************************/ package org.apache.tomcat.util.http; import java.io.PrintWriter; import java.io.StringWriter; import java.util.HashMap; import java.util.Iterator; import org.apache.tomcat.util.buf.MessageBytes; /** * A general-purpose object for representing an HTTP * request. */ public class BaseRequest { // scheme constants public static final String SCHEME_HTTP = "http"; public static final String SCHEME_HTTPS = "https"; // request attributes MessageBytes method = new MessageBytes(); MessageBytes protocol = new MessageBytes(); MessageBytes requestURI = new MessageBytes(); MessageBytes remoteAddr = new MessageBytes(); MessageBytes remoteHost = new MessageBytes(); MessageBytes serverName = new MessageBytes(); int serverPort = 80; MessageBytes remoteUser = new MessageBytes(); MessageBytes authType = new MessageBytes(); MessageBytes queryString = new MessageBytes(); MessageBytes authorization = new MessageBytes(); String scheme = SCHEME_HTTP; boolean secure = false; int contentLength = 0; MessageBytes contentType = new MessageBytes(); MimeHeaders headers = new MimeHeaders(); Cookies cookies = new Cookies(); HashMap attributes = new HashMap(); MessageBytes tomcatInstanceId = new MessageBytes(); /** * Recycles this object and readies it further use. */ public void recycle() { method.recycle(); protocol.recycle(); requestURI.recycle(); remoteAddr.recycle(); remoteHost.recycle(); serverName.recycle(); serverPort = 80; remoteUser.recycle(); authType.recycle(); queryString.recycle(); authorization.recycle(); scheme = SCHEME_HTTP; secure = false; contentLength = 0; contentType.recycle(); headers.recycle(); cookies.recycle(); attributes.clear(); tomcatInstanceId.recycle(); } /** * Get the method. * @return the method */ public MessageBytes method() { return method; } /** * Get the protocol * @return the protocol */ public MessageBytes protocol() { return protocol; } /** * Get the request uri * @return the request uri */ public MessageBytes requestURI() { return requestURI; } /** * Get the remote address * @return the remote address */ public MessageBytes remoteAddr() { return remoteAddr; } /** * Get the remote host * @return the remote host */ public MessageBytes remoteHost() { return remoteHost; } /** * Get the server name * @return the server name */ public MessageBytes serverName() { return serverName; } /** * Get the server port * @return the server port */ public int getServerPort() { return serverPort; } /** * Set the server port * @param i the server port */ public void setServerPort(int i) { serverPort = i; } /** * Get the remote user * @return the remote user */ public MessageBytes remoteUser() { return remoteUser; } /** * Get the auth type * @return the auth type */ public MessageBytes authType() { return authType; } /** * Get the query string * @return the query string */ public MessageBytes queryString() { return queryString; } /** * Get the authorization credentials * @return the authorization credentials */ public MessageBytes authorization() { return authorization; } /** * Get the scheme * @return the scheme */ public String getScheme() { return scheme; } /** * Set the scheme. * @param s the scheme */ public void setScheme(String s) { scheme = s; } /** * Get whether the request is secure or not. * @return |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
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.