You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Laurent SAUVEL <l....@delta-informatique.com> on 2009/04/06 10:46:18 UTC

ServletContext.java version in the Tomcat 6.0.16 or 6.0.18 source code

Hello all,

I'd like to know why the ServletContext.java file found in the Tomcat
6.0.16 or 6.0.18 source code seems to belong to the Servlet 2.4
specifications whereas Tomcat 6.0.x supports the Servlet 2.5
specifications:

In this file, we can read:

    /**
     * Returns the major version of the Java Servlet API that this
     * servlet container supports. All implementations that comply
     * with Version 2.4 must have this method
     * return the integer 2.
     *
     * @return 		2
     *
     */
    
    public int getMajorVersion();
    
    

    /**
     * Returns the minor version of the Servlet API that this
     * servlet container supports. All implementations that comply
     * with Version 2.4 must have this method
     * return the integer 4.
     *
     * @return 		4
     *
     */

    public int getMinorVersion();

In the same way, if we click on the 'Servlet API Javadocs' link (The
Servlet 2.5 API Javadocs) on the following page:
http://tomcat.apache.org/tomcat-6.0-doc/index.html

We can read in the ServletContext javadoc:

int getMajorVersion()
Returns the major version of the Java Servlet API that this servlet
container supports. All implementations that comply with Version 2.4
must have this method return the integer 2. 
Returns:
2

int getMinorVersion()
Returns the minor version of the Servlet API that this servlet container
supports. All implementations that comply with Version 2.4 must have
this method return the integer 4. 
Returns:
4

Above in the same page, we can find the javadoc of the getContextPath()
method which was added in the Servlet 2.5 specifications.

I think there is a mistake in both versions (source and javadoc) because
when I put the following code in a test JSP running on Tomcat 6.0.16:

Servlet Engine: <%= session.getServletContext().getMajorVersion() %>.<%=
session.getServletContext().getMinorVersion() %><br/>
JSP Engine: <%=
JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion()
%><br/>
Application Server: <%= application.getServerInfo()%><br/>

I get:

Servlet Engine: 2.5
JSP Engine: 2.1
Application Server: Apache Tomcat/6.0.16

Thank you in advance for your answers.

Laurent

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: ServletContext.java version in the Tomcat 6.0.16 or 6.0.18 source code

Posted by Mark Thomas <ma...@apache.org>.
Laurent SAUVEL wrote:
> Hello all,
> 
> I'd like to know why the ServletContext.java file found in the Tomcat
> 6.0.16 or 6.0.18 source code seems to belong to the Servlet 2.4
> specifications whereas Tomcat 6.0.x supports the Servlet 2.5
> specifications:
> 
> In this file, we can read:
> 
>     /**
>      * Returns the major version of the Java Servlet API that this
>      * servlet container supports. All implementations that comply
>      * with Version 2.4 must have this method
>      * return the integer 2.
>      *
>      * @return 		2
>      *
>      */
>     
>     public int getMajorVersion();
>     
>     
> 
>     /**
>      * Returns the minor version of the Servlet API that this
>      * servlet container supports. All implementations that comply
>      * with Version 2.4 must have this method
>      * return the integer 4.
>      *
>      * @return 		4
>      *
>      */
> 
>     public int getMinorVersion();

Just a some javadocs that weren't updated between 5.5.x and 6.0.x. I'll
get this fixed now and it will be in 6.0.20 onwards.

Mark

> 
> In the same way, if we click on the 'Servlet API Javadocs' link (The
> Servlet 2.5 API Javadocs) on the following page:
> http://tomcat.apache.org/tomcat-6.0-doc/index.html
> 
> We can read in the ServletContext javadoc:
> 
> int getMajorVersion()
> Returns the major version of the Java Servlet API that this servlet
> container supports. All implementations that comply with Version 2.4
> must have this method return the integer 2. 
> Returns:
> 2
> 
> int getMinorVersion()
> Returns the minor version of the Servlet API that this servlet container
> supports. All implementations that comply with Version 2.4 must have
> this method return the integer 4. 
> Returns:
> 4
> 
> Above in the same page, we can find the javadoc of the getContextPath()
> method which was added in the Servlet 2.5 specifications.
> 
> I think there is a mistake in both versions (source and javadoc) because
> when I put the following code in a test JSP running on Tomcat 6.0.16:
> 
> Servlet Engine: <%= session.getServletContext().getMajorVersion() %>.<%=
> session.getServletContext().getMinorVersion() %><br/>
> JSP Engine: <%=
> JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion()
> %><br/>
> Application Server: <%= application.getServerInfo()%><br/>
> 
> I get:
> 
> Servlet Engine: 2.5
> JSP Engine: 2.1
> Application Server: Apache Tomcat/6.0.16
> 
> Thank you in advance for your answers.
> 
> Laurent
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org