Skip to main content

swchan2's Blog

Server-Sent Events with Async Servlet By Example

Posted by swchan2 on May 21, 2014 at 3:57 PM PDT

Server-Sent Events (SSE) is part of HTML5. SSE is a simple, undirectional communication from server to browser. It allows server to push data to client once a connection is established. The entire point of SSE is to make it easy for the server to push messages to the browser, once the browser has first established a connection to the server.

JavaOne 2013 - What's New in JSR 340, Servlet 3.1?

Posted by swchan2 on September 27, 2013 at 1:33 PM PDT

Servlet 3.1 (JSR 340) is final and is part of Java EE 7. I and Rajiv had presented the session CON 4854, "What's New in JSR 340, Servlet 3.1?", on September 23 at JavaOne 2013, San Francisco. It was at 3:00pm. Most of the audiences are quite familiar with Servlet technology and we had a good Q&A during the talk.

When is HttpSession invalidated?

Posted by swchan2 on August 29, 2013 at 5:22 PM PDT

javax.servlet.http.HttpSession provides a way to identify an user across multiple HTTP requests and to store user specified information. In other words, it provides a support of stateful communications with the stateless HTTP protocol.

Broadcasting in WebSocket

Posted by swchan2 on August 13, 2013 at 12:09 PM PDT

Java API for WebSocket is a new JSR to Java EE 7. It provides a stardard Java API for creating WebSocket applications. This gives web applications the ability to push data.

WebSocket: Single Thread Model?

Posted by swchan2 on August 7, 2013 at 11:35 AM PDT

WebSocket is a bi-directional, full-duplex, TCP based messaging protocol. It is originally proposed as part of HTML5 and is a IETF-defined Protocol (RFC 6455). And W3C has defined JavaScript API for WebSocket which is in candidate recommendation since 2012-09-20.

Standard Deviation: An Illustration of Expression Language 3.0 in Servlet Environment

Posted by swchan2 on July 1, 2013 at 3:51 PM PDT

Expression Language (EL) was first introduced as part of JSTL 1.0, was then moved JSP 2.0 and was unified with JSF 1.2 in JSP 2.1. In Java EE 7, EL is a new separate JSR, JSR 341. Many new features are introduced in EL 3.0.

This blog shows how to use new following new features of EL 3.0:

  • Standalone environment

Asynchronous Servlet and Java EE Concurrency Utilities

Posted by swchan2 on June 6, 2013 at 1:42 PM PDT

Asynchronous operation was introduced in Servlet 3.0. ServletRequest#startAsync is used to put the request into asynchronous mode.

When is async-complete complete?

Posted by swchan2 on May 14, 2013 at 11:39 AM PDT

Update: In Servlet 3.0, the behavior of using response is undefined after invoking #complete or #dispatch. In Servlet 3.1, it is clarified that AsyncContext#getResponse will throw IllegalStateException. The blog has been updated for this.

Protocol Upgrade in Servlet 3.1 By Example

Posted by swchan2 on May 7, 2013 at 1:15 PM PDT

Update: Invoke WebConnection#close when there is an error.

Servlet 3.1 Specification (JSR 340) is almost ready for the release. One of the new features is the support for protocol upgrade.

HTTP protocol upgrade was introduced in HTTP 1.1 (RFC 2616):

Role "**" in Servlet 3.1 security-constraint

Posted by swchan2 on April 19, 2013 at 11:11 AM PDT

Servlet 3.1 Specification (JSR 340) and Java Authorization Contract for Containers (JSR 115) MR3 are almost ready for release. Besides "*", the role-name "**" is introduced in the above two specifications.