Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are the Java Servlet APIs backwards compatible?

Tags:

java

servlets

I want to write a JAR file that makes use of the javax servlet API. If I write against version 2.2, does that mean it will work on versions 2.3, 2.4 and 2.5?

Thanks

like image 724
Peter Sankauskas Avatar asked May 13 '09 23:05

Peter Sankauskas


2 Answers

In most cases, there shouldn't be any compatibility issues. There may be a couple of gotchas, depending on what you are doing. If you are writing some framework that decorates container classes, the interfaces have occasionally been modified. For example, the method ServletRequest.getRemotePort() was not present in the J2EE 1.3 version (before Servlet 2.4). These difficulties can be overcome, but be aware that you're going to have to factor them into your development and testing.

like image 78
McDowell Avatar answered Oct 01 '22 09:10

McDowell


It will work, though sometimes some methods will be deprecated and might throw up warnings regarding their implementation.

like image 45
gnlogic Avatar answered Oct 01 '22 08:10

gnlogic