Everything new with Servlet 4.0 (JSR 369)

No Comments
Java EE Servlet

In this post, I’m going to highlight everything new we have in Servlet 4.0, so get ready!

HTTP/2 Support with PushBuilder

You can find a great example on this at this link.

Servlet Mapping Detection

You can find an article on this subject here.

GenericFilter and HttpFilter

You can find an article on this subject here.

Trailer Fields

(Extracted from the Specification Doc) If trailer headers are ready for reading, isTrailerFieldsReady() will return true. Then a servlet can read trailer headers of the HTTP request via the getTrailerFields() method of the HttpServletRequest interface. A servlet can write trailer headers to the response by providing a Supplier to the setTrailerFields method of the HttpServletResponse interface. The Supplier of the trailer headers can be obtained by accessing the getTrailerFields() method of the HttpServletResponse interface.

ServletContext Additional Methods

  • Add a JSP Page programmatically addJspFile(java.lang.String, java.lang.String)
  • Get Session Timeout int getSessionTimeout()
  • Set Session Timeout void setSessionTimeout(int)
  • Get Request Character Encoding java.lang.String getRequestCharacterEncoding()
  • Set Request Character Encoding  void setRequestCharacterEncoding(java.lang.String)
  • Get Response Character Encoding java.lang.String getResponseCharacterEncoding()
  • Set Response Character Encoding void setResponseCharacterEncoding(java.lang.String)

In case I’ve missed anything, please let me know in the comments :)

Categories: Java, Java EE Tags: Tags: , ,

Leave a Reply