Commit b7a94523 authored by Tony Mancill's avatar Tony Mancill

Imported Upstream version 7.0.33

parent d5e71a00
......@@ -15,7 +15,7 @@
limitations under the License.
================================================================================
$Id: BUILDING.txt 1348360 2012-06-09 11:17:55Z kkolinko $
$Id: BUILDING.txt 1371983 2012-08-11 17:23:27Z kkolinko $
====================================================
Building The Apache Tomcat @VERSION_MAJOR_MINOR@ Servlet/JSP Container
......@@ -37,10 +37,32 @@ source distribution, do the following:
1. If the JDK is already installed, skip to (2).
2. Download a Java Development Kit (JDK) release (version 1.6.x or later)
from:
2. Download a version 6 of Java Development Kit (JDK) release (use the
latest update available for your chosen version) from
http://www.oracle.com/technetwork/java/javase/downloads/index.html
or from another JDK vendor.
Note regarding later versions of Java:
As documented elsewhere, one of components in Apache Tomcat includes
a private copy of the Apache Commons DBCP library. The source code
for this library is downloaded, processed by the build script
(renaming the packages) and compiled.
Due to changes in JDBC interfaces implemented by the library between
versions of Java SE specification, the library has to target specific
version of Java and can be compiled only with the JDK version
implementing this version of specification.
See Apache Commons DBCP project web site for more details on
available versions of the library and its requirements,
http://commons.apache.org/dbcp/
If you really want to use a later version of JDK to build Tomcat,
several workarounds are possible. One of them is to skip building
the component (tomcat-dbcp.jar).
3. Install the JDK according to the instructions included with the release.
......@@ -325,16 +347,17 @@ To enable Checkstyle, add the following property to build.properties file:
Once Checkstyle is enabled, the check will be performed automatically
during the build. The check is run before compilation of the source code.
It is possible to run the check separately. The command is:
cd ${tomcat.source}
ant validate
To speed-up repeated runs of this check, a cache is configured. The cache
is located in the following directory:
output/res/checkstyle
It is possible to run the check separately by invoking the "validate"
target. The command is:
cd ${tomcat.source}
ant -Dexecute.validate=true validate
(8.2) End-of-line conventions check
......
......@@ -25,7 +25,7 @@
<!-- set catalina.home if it's not already set -->
<dirname property="catalina.home.bin.dir" file="${ant.file.catalina-tasks}"/>
<property name="catalina.home" value="${catalina.home.bin.dir}/.."/>
<taskdef resource="org/apache/catalina/ant/catalina.tasks">
<typedef resource="org/apache/catalina/ant/catalina.tasks">
<classpath>
<fileset file="${catalina.home}/bin/tomcat-juli.jar"/>
<fileset file="${catalina.home}/lib/tomcat-api.jar"/>
......@@ -38,22 +38,8 @@
<fileset file="${catalina.home}/lib/catalina-ant.jar"/>
<fileset file="${catalina.home}/lib/tomcat-coyote.jar"/>
</classpath>
</taskdef>
<taskdef resource="org/apache/catalina/ant/jmx/jmxaccessor.tasks">
<classpath>
<fileset file="${catalina.home}/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<typedef
name="jmxEquals"
classname="org.apache.catalina.ant.jmx.JMXAccessorEqualsCondition">
<classpath>
<fileset file="${catalina.home}/lib/catalina-ant.jar"/>
</classpath>
</typedef>
<typedef
name="jmxCondition"
classname="org.apache.catalina.ant.jmx.JMXAccessorCondition">
<typedef resource="org/apache/catalina/ant/jmx/jmxaccessor.tasks">
<classpath>
<fileset file="${catalina.home}/lib/catalina-ant.jar"/>
</classpath>
......
......@@ -228,7 +228,7 @@ case "$1" in
exit $?
;;
* )
echo "Unkown command: \`$1'"
echo "Unknown command: \`$1'"
echo "Usage: $PROGRAM ( commands ... )"
echo "commands:"
echo " run Start Tomcat without detaching from console"
......
......@@ -21,13 +21,13 @@
# modules that Tomcat depends on. Copy this file to "build.properties"
# in the top-level source directory, and customize it as needed.
#
# $Id: build.properties.default 1350468 2012-06-15 06:11:47Z markt $
# $Id: build.properties.default 1410718 2012-11-17 10:16:22Z markt $
# -----------------------------------------------------------------------------
# ----- Version Control Flags -----
version.major=7
version.minor=0
version.build=28
version.build=33
version.patch=0
version.suffix=
......@@ -182,7 +182,7 @@ junit.jar=${junit.lib}/junit-4.8.2.jar
junit.loc=http://cloud.github.com/downloads/KentBeck/junit/junit4.8.2.zip
# ----- Checkstyle, version 5.1 or later -----
checkstyle.version=5.5
checkstyle.version=5.6
checkstyle.home=${base.path}/checkstyle-${checkstyle.version}
checkstyle.loc=${base-sf.loc}/checkstyle/checkstyle-${checkstyle.version}-bin.zip
checkstyle.jar=${checkstyle.home}/checkstyle-${checkstyle.version}-all.jar
......
......@@ -226,6 +226,7 @@
<include name="**/*.license"/>
<include name="**/*.manifest"/>
<include name="**/*.mdl"/>
<include name="**/*.MF"/>
<include name="**/*.notice"/>
<include name="**/*.nsi"/>
<include name="**/*.pl"/>
......@@ -461,7 +462,6 @@
<!-- Exclude auto-generated files -->
<exclude name="java/org/apache/el/parser/ELParser*.java" />
<exclude name="java/org/apache/el/parser/Node.java" />
<exclude name="java/org/apache/tomcat/util/http/parser/HttpParser*.java" />
<exclude name="java/org/apache/**/parser/JJT*ParserState.java" />
<exclude name="java/org/apache/**/parser/ParseException.java" />
<exclude name="java/org/apache/**/parser/SimpleCharStream.java" />
......@@ -470,11 +470,12 @@
<exclude name="**/org/apache/tomcat/dbcp/**"/>
<exclude name="**/tomcat-deps/**"/>
<!-- Exclude simple test files -->
<exclude name="test/webapp-3.0/bug53257/*.txt"/>
<exclude name="test/webapp-3.0/bug53257/**/*.txt"/>
<exclude name="test/webapp-3.0-fragments/WEB-INF/classes/*.txt"/>
</fileset>
<fileset dir="modules/jdbc-pool" >
<exclude name=".*/**"/>
<exclude name="**/MANIFEST.MF"/>
<patternset refid="text.files" />
</fileset>
</checkstyle>
......@@ -1692,7 +1693,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
</target>
<target name="dist-source">
<target name="dist-source" depends="compile-prepare">
<mkdir dir="${tomcat.dist}/src"/>
......@@ -1703,6 +1704,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
<or>
<filename name="**/.settings/**" />
<filename name="**/.classpath"/>
<filename name="**/.checkstyle"/>
<filename name="**/.project"/>
<filename name="**/output/**"/>
<!-- Commented out, because
......@@ -1715,12 +1717,15 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
<filename name="**/*.iml" />
<filename name="**/*.asc" />
<filename name="**/*.tmp" />
<filename name="**/*.jj" />
<filename name="**/maven-ant-tasks-*.jar" />
<filename name="**/thumbs.db" />
<filename name="**/Thumbs.db" />
<filename name="*.launch"/>
<filename name="bin/setenv.*" />
<filename name="java/org/apache/catalina/startup/catalina.properties" />
<filename name="logs/**" />
<filename name="webapps/docs/jdbc-pool.xml" />
<filename name="work/**" />
<filename name="modules/jdbc-pool/bin/**" />
<filename name="modules/jdbc-pool/includes/**" />
......
......@@ -73,8 +73,12 @@ server.loader=
# starting with file:.
shared.loader=
# List of JAR files that should not be scanned for configuration information
# such as web fragments, TLD files etc. It must be a comma separated list of
# List of JAR files that should not be scanned using the JarScanner
# functionality. This is typically used to scan JARs for configuration
# information. JARs that do not contain such information may be excluded from
# the scan to speed up the scanning process. This is the default list. JARs on
# this list are excluded from all scans. Scan specific lists (to exclude JARs
# from individual scans) follow this. The list must be a comma separated list of
# JAR file names.
# The JARs listed below include:
# - Tomcat Bootstrap JARs
......@@ -84,6 +88,7 @@ shared.loader=
# - Tomcat JARs
# - Common non-Tomcat JARs
# - Sun JDK JARs
# - OpenJDK JARs
# - Apple JDK JARs
tomcat.util.scan.DefaultJarScanner.jarsToSkip=\
bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\
......@@ -104,14 +109,25 @@ geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,\
ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,\
jmx-tools.jar,jta*.jar,log4j*.jar,mail*.jar,slf4j*.jar,\
xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,\
dnsns.jar,ldapsec.jar,localedata.jar,sunjce_provider.jar,sunmscapi.jar,\
sunpkcs11.jar,jhall.jar,tools.jar,\
access-bridge.jar,access-bridge-64.jar,dnsns.jar,jaccess.jar,ldapsec.jar,localedata.jar,\
sunjce_provider.jar,sunmscapi.jar,sunpkcs11.jar,jhall.jar,tools.jar,\
sunec.jar,zipfs.jar,\
gnome-java-bridge.jar,pulse-java.jar,\
apple_provider.jar,AppleScriptEngine.jar,CoreAudio.jar,dns_sd.jar,\
j3daudio.jar,j3dcore.jar,j3dutils.jar,jai_core.jar,jai_codec.jar,\
mlibwrapper_jai.jar,MRJToolkit.jar,vecmath.jar,\
junit.jar,junit-*.jar,ant-launcher.jar
# Additional JARs (over and above the default JARs listed above) to skip when
# scanning for Servlet 3.0 pluggability features. These features include web
# fragments, annotations, SCIs and classes that match @HandlesTypes. The list
# must be a comma separated list of JAR file names.
org.apache.catalina.startup.ContextConfig.jarsToSkip=
# Additional JARs (over and above the default JARs listed above) to skip when
# scanning for TLDs. The list must be a comma separated list of JAR file names.
org.apache.catalina.startup.TldConfig.jarsToSkip=
#
# String cache configuration.
tomcat.util.buf.StringCache.byte.enabled=true
......
This diff is collapsed.
......@@ -292,7 +292,7 @@ public class BeanELResolver extends ELResolver {
if (this.write == null) {
throw new PropertyNotFoundException(message(ctx,
"propertyNotWritable", new Object[] {
type.getName(), descriptor.getName() }));
owner.getName(), descriptor.getName() }));
}
}
return this.write;
......@@ -304,7 +304,7 @@ public class BeanELResolver extends ELResolver {
if (this.read == null) {
throw new PropertyNotFoundException(message(ctx,
"propertyNotReadable", new Object[] {
type.getName(), descriptor.getName() }));
owner.getName(), descriptor.getName() }));
}
}
return this.read;
......
......@@ -39,21 +39,179 @@ import java.io.IOException;
*/
public interface RequestDispatcher {
/**
* The name of the request attribute that should be set by the container
* when custom error-handling servlet or JSP page is invoked. The value of
* the attribute is of type {@code java.lang.Throwable}. See the chapter
* "Error Handling" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String ERROR_EXCEPTION = "javax.servlet.error.exception";
/**
* The name of the request attribute that should be set by the container
* when custom error-handling servlet or JSP page is invoked. The value of
* the attribute is of type {@code java.lang.Class}. See the chapter
* "Error Handling" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String ERROR_EXCEPTION_TYPE = "javax.servlet.error.exception_type";
/**
* The name of the request attribute that should be set by the container
* when custom error-handling servlet or JSP page is invoked. The value of
* the attribute is of type {@code java.lang.String}. See the chapter
* "Error Handling" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String ERROR_MESSAGE = "javax.servlet.error.message";
/**
* The name of the request attribute that should be set by the container
* when custom error-handling servlet or JSP page is invoked. The value of
* the attribute is of type {@code java.lang.String}. See the chapter
* "Error Handling" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String ERROR_REQUEST_URI = "javax.servlet.error.request_uri";
/**
* The name of the request attribute that should be set by the container
* when custom error-handling servlet or JSP page is invoked. The value of
* the attribute is of type {@code java.lang.String}. See the chapter
* "Error Handling" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String ERROR_SERVLET_NAME = "javax.servlet.error.servlet_name";
/**
* The name of the request attribute that should be set by the container
* when custom error-handling servlet or JSP page is invoked. The value of
* the attribute is of type {@code java.lang.Integer}. See the chapter
* "Error Handling" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String ERROR_STATUS_CODE = "javax.servlet.error.status_code";
/**
* The name of the request attribute that should be set by the container
* when the {@link #forward(ServletRequest, ServletResponse)} method is
* called. It provides the original value of a path-related property of the
* request. See the chapter "Forwarded Request Parameters" in the Servlet
* Specification for details.
*
* @since Servlet 3.0
*/
public static final String FORWARD_CONTEXT_PATH = "javax.servlet.forward.context_path";
/**
* The name of the request attribute that should be set by the container
* when the {@link #forward(ServletRequest, ServletResponse)} method is
* called. It provides the original value of a path-related property of the
* request. See the chapter "Forwarded Request Parameters" in the Servlet
* Specification for details.
*
* @since Servlet 3.0
*/
public static final String FORWARD_PATH_INFO = "javax.servlet.forward.path_info";
/**
* The name of the request attribute that should be set by the container
* when the {@link #forward(ServletRequest, ServletResponse)} method is
* called. It provides the original value of a path-related property of the
* request. See the chapter "Forwarded Request Parameters" in the Servlet
* Specification for details.
*
* @since Servlet 3.0
*/
public static final String FORWARD_QUERY_STRING = "javax.servlet.forward.query_string";
/**
* The name of the request attribute that should be set by the container
* when the {@link #forward(ServletRequest, ServletResponse)} method is
* called. It provides the original value of a path-related property of the
* request. See the chapter "Forwarded Request Parameters" in the Servlet
* Specification for details.
*
* @since Servlet 3.0
*/
public static final String FORWARD_REQUEST_URI = "javax.servlet.forward.request_uri";
/**
* The name of the request attribute that should be set by the container
* when the {@link #forward(ServletRequest, ServletResponse)} method is
* called. It provides the original value of a path-related property of the
* request. See the chapter "Forwarded Request Parameters" in the Servlet
* Specification for details.
*
* @since Servlet 3.0
*/
public static final String FORWARD_SERVLET_PATH = "javax.servlet.forward.servlet_path";
/**
* The name of the request attribute that should be set by the container
* when the {@link #include(ServletRequest, ServletResponse)} method is
* called on the {@code RequestDispatcher} obtained by a path and not by a
* name. It provides information on the path that was used to obtain the
* {@code RequestDispatcher} instance for this include call. See the chapter
* "Included Request Parameters" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String INCLUDE_CONTEXT_PATH = "javax.servlet.include.context_path";
/**
* The name of the request attribute that should be set by the container
* when the {@link #include(ServletRequest, ServletResponse)} method is
* called on the {@code RequestDispatcher} obtained by a path and not by a
* name. It provides information on the path that was used to obtain the
* {@code RequestDispatcher} instance for this include call. See the chapter
* "Included Request Parameters" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String INCLUDE_PATH_INFO = "javax.servlet.include.path_info";
/**
* The name of the request attribute that should be set by the container
* when the {@link #include(ServletRequest, ServletResponse)} method is
* called on the {@code RequestDispatcher} obtained by a path and not by a
* name. It provides information on the path that was used to obtain the
* {@code RequestDispatcher} instance for this include call. See the chapter
* "Included Request Parameters" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String INCLUDE_QUERY_STRING = "javax.servlet.include.query_string";
/**
* The name of the request attribute that should be set by the container
* when the {@link #include(ServletRequest, ServletResponse)} method is
* called on the {@code RequestDispatcher} obtained by a path and not by a
* name. It provides information on the path that was used to obtain the
* {@code RequestDispatcher} instance for this include call. See the chapter
* "Included Request Parameters" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String INCLUDE_REQUEST_URI = "javax.servlet.include.request_uri";
/**
* The name of the request attribute that should be set by the container
* when the {@link #include(ServletRequest, ServletResponse)} method is
* called on the {@code RequestDispatcher} obtained by a path and not by a
* name. It provides information on the path that was used to obtain the
* {@code RequestDispatcher} instance for this include call. See the chapter
* "Included Request Parameters" in the Servlet Specification for details.
*
* @since Servlet 3.0
*/
public static final String INCLUDE_SERVLET_PATH = "javax.servlet.include.servlet_path";
/**
......
......@@ -50,9 +50,6 @@ import java.util.ResourceBundle;
* This class supports both the Version 0 (by Netscape) and Version 1 (by RFC
* 2109) cookie specifications. By default, cookies are created using Version 0
* to ensure the best interoperability.
*
* @author Various
* @version $Version$
*/
public class Cookie implements Cloneable, Serializable {
......@@ -394,11 +391,13 @@ public class Cookie implements Cloneable, Serializable {
"org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
"false")).booleanValue();
String fwdSlashIsSeparator = System.getProperty("org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR");
String fwdSlashIsSeparator = System.getProperty(
"org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR");
if (fwdSlashIsSeparator == null) {
FWD_SLASH_IS_SEPARATOR = STRICT_SERVLET_COMPLIANCE;
} else {
FWD_SLASH_IS_SEPARATOR = Boolean.valueOf(fwdSlashIsSeparator).booleanValue();
FWD_SLASH_IS_SEPARATOR =
Boolean.valueOf(fwdSlashIsSeparator).booleanValue();
}
if (FWD_SLASH_IS_SEPARATOR) {
......@@ -407,7 +406,8 @@ public class Cookie implements Cloneable, Serializable {
tspecials2 = tspecials2NoSlash;
}
String strictNaming = System.getProperty("org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING");
String strictNaming = System.getProperty(
"org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING");
if (strictNaming == null) {
STRICT_NAMING = STRICT_SERVLET_COMPLIANCE;
} else {
......@@ -451,18 +451,26 @@ public class Cookie implements Cloneable, Serializable {
}
/**
* @return TODO
* @since Servlet 3.0 TODO SERVLET3 - Add comments
* Sets the flag that controls if this cookie will be hidden from scripts on
* the client side.
*
* @param httpOnly The new value of the flag
*
* @since Servlet 3.0
*/
public boolean isHttpOnly() {
return httpOnly;
public void setHttpOnly(boolean httpOnly) {
this.httpOnly = httpOnly;
}
/**
* @param httpOnly
* @since Servlet 3.0 TODO SERVLET3 - Add comments
* Gets the flag that controls if this cookie will be hidden from scripts on
* the client side.
*
* @return <code>true</code> if the cookie is hidden from scripts, else
* <code>false</code>
* @since Servlet 3.0
*/
public void setHttpOnly(boolean httpOnly) {
this.httpOnly = httpOnly;
public boolean isHttpOnly() {
return httpOnly;
}
}
......@@ -52,7 +52,7 @@ import javax.servlet.ServletResponse;
* <p>There's almost no reason to override the <code>service</code>
* method. <code>service</code> handles standard HTTP
* requests by dispatching them to the handler methods
* for each HTTP request type (the <code>do</code><i>XXX</i>
* for each HTTP request type (the <code>do</code><i>Method</i>
* methods listed above).
*
* <p>Likewise, there's almost no reason to override the
......@@ -586,7 +586,7 @@ public abstract class HttpServlet extends GenericServlet {
/**
* Receives standard HTTP requests from the public
* <code>service</code> method and dispatches
* them to the <code>do</code><i>XXX</i> methods defined in
* them to the <code>do</code><i>Method</i> methods defined in
* this class. This method is an HTTP-specific version of the
* {@link javax.servlet.Servlet#service} method. There's no
* need to override this method.
......@@ -620,7 +620,13 @@ public abstract class HttpServlet extends GenericServlet {
// to go through further expensive logic
doGet(req, resp);
} else {
long ifModifiedSince = req.getDateHeader(HEADER_IFMODSINCE);
long ifModifiedSince;
try {
ifModifiedSince = req.getDateHeader(HEADER_IFMODSINCE);
} catch (IllegalArgumentException iae) {
// Invalid date header - proceed as if none was set
ifModifiedSince = -1;
}
if (ifModifiedSince < (lastModified / 1000 * 1000)) {
// If the servlet mod time is later, call doGet()
// Round down to the nearest second for a proper compare
......@@ -757,6 +763,36 @@ class NoBodyResponse extends HttpServletResponseWrapper {
didSetContentLength = true;
}
@Override
public void setHeader(String name, String value) {
super.setHeader(name, value);
checkHeader(name);
}
@Override
public void addHeader(String name, String value) {
super.addHeader(name, value);
checkHeader(name);
}
@Override
public void setIntHeader(String name, int value) {
super.setIntHeader(name, value);
checkHeader(name);
}
@Override
public void addIntHeader(String name, int value) {
super.addIntHeader(name, value);
checkHeader(name);
}
private void checkHeader(String name) {
if ("content-length".equalsIgnoreCase(name)) {
didSetContentLength = true;
}
}
@Override
public ServletOutputStream getOutputStream() throws IOException {