From: markt Date: Tue, 23 Jun 2009 11:44:26 +0000 (+0000) Subject: Remove a couple of unused classes X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3f9c07ad0287297aa00a30b2bfe8e5053c2a39f5;p=tomcat7.0 Remove a couple of unused classes git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@787642 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/tomcat/util/http/BaseRequest.java b/java/org/apache/tomcat/util/http/BaseRequest.java deleted file mode 100644 index f02fc3bcf..000000000 --- a/java/org/apache/tomcat/util/http/BaseRequest.java +++ /dev/null @@ -1,346 +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. - */ - -/*************************************************************************** - * Description: Base http request object. * - * Author: Keving Seguin [seguin@apache.org] * - * Version: $Revision$ * - ***************************************************************************/ - -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 = MessageBytes.newInstance(); - MessageBytes protocol = MessageBytes.newInstance(); - MessageBytes requestURI = MessageBytes.newInstance(); - MessageBytes remoteAddr = MessageBytes.newInstance(); - MessageBytes remoteHost = MessageBytes.newInstance(); - MessageBytes serverName = MessageBytes.newInstance(); - int serverPort = 80; - MessageBytes remoteUser = MessageBytes.newInstance(); - MessageBytes authType = MessageBytes.newInstance(); - MessageBytes queryString = MessageBytes.newInstance(); - MessageBytes authorization = MessageBytes.newInstance(); - String scheme = SCHEME_HTTP; - boolean secure = false; - int contentLength = 0; - MessageBytes contentType = MessageBytes.newInstance(); - MimeHeaders headers = new MimeHeaders(); - Cookies cookies = new Cookies(); - HashMap attributes = new HashMap(); - - MessageBytes tomcatInstanceId = MessageBytes.newInstance(); - - /** - * 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 true if the request is secure. - */ - public boolean getSecure() { - return secure; - } - - /** - * Set whether the request is secure or not. - * @param b true if the request is secure. - */ - public void setSecure(boolean b) { - secure = b; - } - - /** - * Get the content length - * @return the content length - */ - public int getContentLength() { - return contentLength; - } - - /** - * Set the content length - * @param i the content length - */ - public void setContentLength(int i) { - contentLength = i; - } - - /** - * Get the content type - * @return the content type - */ - public MessageBytes contentType() { - return contentType; - } - - /** - * Get this request's headers - * @return request headers - */ - public MimeHeaders headers() { - return headers; - } - - /** - * Get cookies. - * @return request cookies. - */ - public Cookies cookies() { - return cookies; - } - - /** - * Set an attribute on the request - * @param name attribute name - * @param value attribute value - */ - public void setAttribute(String name, Object value) { - if (name == null || value == null) { - return; - } - attributes.put(name, value); - } - - /** - * Get an attribute on the request - * @param name attribute name - * @return attribute value - */ - public Object getAttribute(String name) { - if (name == null) { - return null; - } - - return attributes.get(name); - } - - /** - * Get iterator over attribute names - * @return iterator over attribute names - */ - public Iterator getAttributeNames() { - return attributes.keySet().iterator(); - } - - /** - * Get the host id ( or jvmRoute ) - * @return the jvm route - */ - public MessageBytes instanceId() { - return tomcatInstanceId; - } - - // backward compat - jvmRoute is the id of this tomcat instance, - // used by a load balancer on the server side to implement sticky - // sessions, and on the tomcat side to format the session ids. - public MessageBytes jvmRoute() { - return tomcatInstanceId; - } - - private Object notes[]=new Object[16]; - - public final Object getNote(int id) { - return notes[id]; - } - - public final void setNote(int id, Object cr) { - notes[id]=cr; - } - - /** - * ** SLOW ** for debugging only! - */ - public String toString() { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - pw.println("=== BaseRequest ==="); - pw.println("method = " + method.toString()); - pw.println("protocol = " + protocol.toString()); - pw.println("requestURI = " + requestURI.toString()); - pw.println("remoteAddr = " + remoteAddr.toString()); - pw.println("remoteHost = " + remoteHost.toString()); - pw.println("serverName = " + serverName.toString()); - pw.println("serverPort = " + serverPort); - pw.println("remoteUser = " + remoteUser.toString()); - pw.println("authType = " + authType.toString()); - pw.println("queryString = " + queryString.toString()); - pw.println("scheme = " + scheme.toString()); - pw.println("secure = " + secure); - pw.println("contentLength = " + contentLength); - pw.println("contentType = " + contentType); - pw.println("attributes = " + attributes.toString()); - pw.println("headers = " + headers.toString()); - pw.println("cookies = " + cookies.toString()); - pw.println("jvmRoute = " + tomcatInstanceId.toString()); - return sw.toString(); - } - -} diff --git a/java/org/apache/tomcat/util/http/MimeMap.java b/java/org/apache/tomcat/util/http/MimeMap.java deleted file mode 100644 index 0244259b0..000000000 --- a/java/org/apache/tomcat/util/http/MimeMap.java +++ /dev/null @@ -1,194 +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.tomcat.util.http; - -import java.net.*; -import java.util.*; - - -/** - * A mime type map that implements the java.net.FileNameMap interface. - * - * @author James Duncan Davidson [duncan@eng.sun.com] - * @author Jason Hunter [jch@eng.sun.com] - */ -public class MimeMap implements FileNameMap { - - // Defaults - all of them are "well-known" types, - // you can add using normal web.xml. - - public static Hashtable defaultMap = - new Hashtable(101); - static { - defaultMap.put("txt", "text/plain"); - defaultMap.put("css", "text/css"); - defaultMap.put("html","text/html"); - defaultMap.put("htm", "text/html"); - defaultMap.put("gif", "image/gif"); - defaultMap.put("jpg", "image/jpeg"); - defaultMap.put("jpe", "image/jpeg"); - defaultMap.put("jpeg", "image/jpeg"); - defaultMap.put("png", "image/png"); - defaultMap.put("java", "text/plain"); - defaultMap.put("body", "text/html"); - defaultMap.put("rtx", "text/richtext"); - defaultMap.put("tsv", "text/tab-separated-values"); - defaultMap.put("etx", "text/x-setext"); - defaultMap.put("ps", "application/x-postscript"); - defaultMap.put("class", "application/java"); - defaultMap.put("csh", "application/x-csh"); - defaultMap.put("sh", "application/x-sh"); - defaultMap.put("tcl", "application/x-tcl"); - defaultMap.put("tex", "application/x-tex"); - defaultMap.put("texinfo", "application/x-texinfo"); - defaultMap.put("texi", "application/x-texinfo"); - defaultMap.put("t", "application/x-troff"); - defaultMap.put("tr", "application/x-troff"); - defaultMap.put("roff", "application/x-troff"); - defaultMap.put("man", "application/x-troff-man"); - defaultMap.put("me", "application/x-troff-me"); - defaultMap.put("ms", "application/x-wais-source"); - defaultMap.put("src", "application/x-wais-source"); - defaultMap.put("zip", "application/zip"); - defaultMap.put("bcpio", "application/x-bcpio"); - defaultMap.put("cpio", "application/x-cpio"); - defaultMap.put("gtar", "application/x-gtar"); - defaultMap.put("shar", "application/x-shar"); - defaultMap.put("sv4cpio", "application/x-sv4cpio"); - defaultMap.put("sv4crc", "application/x-sv4crc"); - defaultMap.put("tar", "application/x-tar"); - defaultMap.put("ustar", "application/x-ustar"); - defaultMap.put("dvi", "application/x-dvi"); - defaultMap.put("hdf", "application/x-hdf"); - defaultMap.put("latex", "application/x-latex"); - defaultMap.put("bin", "application/octet-stream"); - defaultMap.put("oda", "application/oda"); - defaultMap.put("pdf", "application/pdf"); - defaultMap.put("ps", "application/postscript"); - defaultMap.put("eps", "application/postscript"); - defaultMap.put("ai", "application/postscript"); - defaultMap.put("rtf", "application/rtf"); - defaultMap.put("nc", "application/x-netcdf"); - defaultMap.put("cdf", "application/x-netcdf"); - defaultMap.put("cer", "application/x-x509-ca-cert"); - defaultMap.put("exe", "application/octet-stream"); - defaultMap.put("gz", "application/x-gzip"); - defaultMap.put("Z", "application/x-compress"); - defaultMap.put("z", "application/x-compress"); - defaultMap.put("hqx", "application/mac-binhex40"); - defaultMap.put("mif", "application/x-mif"); - defaultMap.put("ief", "image/ief"); - defaultMap.put("tiff", "image/tiff"); - defaultMap.put("tif", "image/tiff"); - defaultMap.put("ras", "image/x-cmu-raster"); - defaultMap.put("pnm", "image/x-portable-anymap"); - defaultMap.put("pbm", "image/x-portable-bitmap"); - defaultMap.put("pgm", "image/x-portable-graymap"); - defaultMap.put("ppm", "image/x-portable-pixmap"); - defaultMap.put("rgb", "image/x-rgb"); - defaultMap.put("xbm", "image/x-xbitmap"); - defaultMap.put("xpm", "image/x-xpixmap"); - defaultMap.put("xwd", "image/x-xwindowdump"); - defaultMap.put("au", "audio/basic"); - defaultMap.put("snd", "audio/basic"); - defaultMap.put("aif", "audio/x-aiff"); - defaultMap.put("aiff", "audio/x-aiff"); - defaultMap.put("aifc", "audio/x-aiff"); - defaultMap.put("wav", "audio/x-wav"); - defaultMap.put("mpeg", "video/mpeg"); - defaultMap.put("mpg", "video/mpeg"); - defaultMap.put("mpe", "video/mpeg"); - defaultMap.put("qt", "video/quicktime"); - defaultMap.put("mov", "video/quicktime"); - defaultMap.put("avi", "video/x-msvideo"); - defaultMap.put("movie", "video/x-sgi-movie"); - defaultMap.put("avx", "video/x-rad-screenplay"); - defaultMap.put("wrl", "x-world/x-vrml"); - defaultMap.put("mpv2", "video/mpeg2"); - - /* Add XML related MIMEs */ - - defaultMap.put("xml", "text/xml"); - defaultMap.put("xsl", "text/xml"); - defaultMap.put("svg", "image/svg+xml"); - defaultMap.put("svgz", "image/svg+xml"); - defaultMap.put("wbmp", "image/vnd.wap.wbmp"); - defaultMap.put("wml", "text/vnd.wap.wml"); - defaultMap.put("wmlc", "application/vnd.wap.wmlc"); - defaultMap.put("wmls", "text/vnd.wap.wmlscript"); - defaultMap.put("wmlscriptc", "application/vnd.wap.wmlscriptc"); - } - - - private Hashtable map = new Hashtable(); - - public void addContentType(String extn, String type) { - map.put(extn, type.toLowerCase()); - } - - public Enumeration getExtensions() { - return map.keys(); - } - - public String getMimeType(String ext) { - return getContentTypeFor(ext); - } - - public String getContentType(String extn) { - String type = map.get(extn.toLowerCase()); - if(type == null) type = defaultMap.get(extn); - return type; - } - - public void removeContentType(String extn) { - map.remove(extn.toLowerCase()); - } - - /** Get extension of file, without fragment id - */ - public static String getExtension( String fileName ) { - // play it safe and get rid of any fragment id - // that might be there - int length=fileName.length(); - - int newEnd = fileName.lastIndexOf('#'); - if( newEnd== -1 ) newEnd=length; - // Instead of creating a new string. - // if (i != -1) { - // fileName = fileName.substring(0, i); - // } - int i = fileName.lastIndexOf('.', newEnd ); - if (i != -1) { - return fileName.substring(i + 1, newEnd ); - } else { - // no extension, no content type - return null; - } - } - - public String getContentTypeFor(String fileName) { - String extn=getExtension( fileName ); - if (extn!=null) { - return getContentType(extn); - } else { - // no extension, no content type - return null; - } - } - -}