Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java Servlets
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

Difference between Servlet 2.5 and Servlet 2.4

                         

Features of Servlet 2.4

  1. Upgraded supports for Http, J2SE, and J2EE: Servlet 2.4 depends on Http1.1 and J2SE 1.3.
  2. Additional ServletRequest methods : In Servlet 2.4 four new methods are added in the ServletRequest
    • getRemotePort(): It returns the IP source port of the client.
    • getLocalName(): It returns the host name on which the request was recieved.
    • getLocalAddr(): It returns the IP address on which the request was recieved. 
    • getLocalPort(): It returns the IP port number.
  3. New Support for internationalization and charset choice: For  the support of internationization Servlet 2.4 has added to new methods in the ServletReponse interface.
    • setCharacterEncoding(String encoding): The purpose of this method is to set the response's character encoding.  This  method helps us to pass a charset parameter to setContentType(String) or passing a Locale to setLocale(Locale). We can now avoid setting the charset in the setContentType("text/html;charset=UTF-8") as setCharacterEncoding() methods pairs with the preexisting getCharacterEncoding() method to manipulate and view the response's character encoding.
       
    • getContentType(): It is responsible for returning the response's content type. The content type can be dynamically set with a combination of setContentType(), setLocale(), and setCharacterEncoding() calls, and the method getContentType() provides a way to view the generated type string. 
  4. New features has been added in RequestDispatcher: In Servlet 2.4 five new request attributes has been added to provide the extra information during a RequestDispatcher forward() call. This features has been added is Servlet 2.4 to know the true original request URI. The following request attributes are:
    • javax.servlet.forward.request_uri
    • javax.servlet.forward.context_path
    • javax.servlet.forward.servlet_path
    • javax.servlet.forward.path_info
    • javax.servlet.forward.query_string

  5. SingleThreadModel interface has been deprecated: In Servlet 2.4 the SingleThreadModel interface has been deprecated. 
  6. HttpSession details and interaction with logins has been clarified: The new method HttpSession.logout() has been added in the Servlet 2.4. Now session allows zero or negative values in the <session-timeout> element to indicate sessions should never time out. 
    If the object in the session can't be serialized in a distributed environment then it must throw an IllegalArgumentException. 
  7. Welcome file behavior and Classloading has been clarified: In servlet 2.4 welcome file can be servlets. 
  8. The web.xml file now uses XML Schema: Version 2.4 servers must still accept the 2.2 and 2.3 deployment descriptor formats, but all new elements are solely specified in Schema.

 

 

Features of Servlet 2.5

This version has been released on September 26, 2005 by the Sun MicroSystems. It is not necessary that all web servers and application servers support the features of Servlet 2.5. Still most of the popular containers like Tomcat 5.5 and JBoss 4.0 still support Servlet 2.4

The list of the added features is given below:

  1. Dependency on J2SE 5.0: The minimum platform requirement for Servlet2.5 is JDK 1.5. Servet2.5 can't be used in versions below that JDK1.5. All the available features of Jdk1.5 like generics, autoboxing, an improved for loop etc, etc are guaranteed available to Servlet2.5 programmers. 
  2. Support For annotations: Annotations provide a mechanism for decorating java code constructs (classes, methods, fields, etc.) with metadata information. Annotations are mark code in such a way that code processors may alter their behavior based on the metadata information. 
  3. Several web.xml convenience: Servlet 2.5 introduces several small changes to the web.xml file to make it more convenient to use.  For example while writing a <filter-mapping>, we can now use a asterisk in a <servlet-name> which will represent all servlets as well as Jsp. 

    Previously we used to do

    <filter-mapping>
    <filter-name>FilterName</filter-name>
    <servlet-name>FilterName</servlet-name>
    </filter-mapping> 

    Now,

    <filter-mapping>
    <filter-name>FilterName</filter-name>
    <servlet-name>*</servlet-name>
    </filter-mapping> 
     

    Previously in <servlet-mapping> or <filter-mapping> there used to be only one <url-pattern>, but now we can have multiple <url-pattern>, like

    <servlet-mapping>
        <servlet-name>abc</servlet-name>
        <url-pattern>/abc/*</url-pattern>
        <url-pattern>/abc/*</url-pattern>
    </servlet-mapping>

    Apart from these changes, many more facilities added in web.xml.
  4. A Handful of removed restrictions: Servlet 2.5 removed a few restrictions around error handling and session tracking. Now it has removed the restriction that the <error-page> could not call the setStatus() method to alter the error code that triggered them. In session tracking, Servlet 2.5 eased a rule that a servlet called by RequestDispatcher include() couldn't set response headers.
  5. Some edge case clarifications: : The servlet2.4 specification says that before calling request.getReader() we  must call request.setCharacterEncoding().  However there is no such clarification given why it is so. It has been described properly in Servlet 2.5.

 

 

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (
post your own) View All Comments Latest 10 Comments:

10 differences b/w servlet and filters

Posted by abhijit saran on Friday, 12.7.07 @ 14:20pm | #41521

Latest Searches:
Take user input using
core java Applets
hibernate2 Tomcat5.5 s
ajax with jsp chat
hibernate basics
Servlet Example To Dis
Button
Fetching Data From Dat
Ajax with JSP
covertir string to bin
create tree in swt usi
JSF tree collapse
example of JFileChoos
javapdfs
Internationalization u
covertir texte to bina
Sample program fetch d
connection sql throug
how to traverse throug
Action elements in jsp
diff b/w function and
login session servlet
page refresh
Flex Java Tutorial
h:inputtext tag in jsf
read and compare conte
ospf
polemophsm
mail merge in word
pthread.h in c
Convert Integer to Flo
struts application fro
JSP scriptlets
how to retrieve databa
jsf selectitems
jsp laglib
J2ee Tutorials
array java
converting a floating
java how to get hostna
struts2 enum
Photoshop Animation Gr
Photoshop Digital Art
Jini and JavaSpaces: t
crud application using
program in java to dis
Write a Java program t
java bean
Write a java program t
header footer menu bod
edit xml
database operations wi
remove rectangle
java ChecksumCRC32 ja
redirect
max chars 500 chars i
Open Source E-mail
goto statment
myfaces tomahawk
Dâ??аâ?¬â?£?â??аâ?¬â
string variable
read hexadecimal numbe
appointment
infix to posfix
difference between Byt
joining points
Photoshop Effects Ener
jQuery to Image Scroll
j2se faq
json lib/componen...]=
Create XML file from f
jsp:usebean
how to insert data int
convert linked list to
XML document java
draw triangle
json lib/componen...]=
jdk1.6.0_07
Convert a String into
jsp bean get property
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.