Java Reference
In-Depth Information
To access the name parameter, we execute the instruction:
out.println("<h1>Welcome Mr " + request.getParameter("name")+
"</h1>"); in the WelcomeServlet Servlet.
Latest improvements of Servlet 3.1 in action
Following Servlet 3.0, which was focused on ease of development, pluggability,
asynchronous processing, and security enhancements, Servlet 3.1 has brought a
number of clarifications to features of the previous version and some changes; the
main ones are: non blocking I/O API and protocol upgrade processing.
Non blocking I/O API
The non blocking I/O API piggybacks on the asynchronous request processing and
the upgrade processing to improve the scalability of the Web Container. Indeed, the
introduction of asynchronous processing in Servlet 3.0 has made it possible to re-
duce waiting time between requests by enabling the thread responsible for process-
ing the client's requests and delegating to other threads the execution of heavy pro-
cesses in order to be ready to accept a new request. But, because of the traditional
way to collect data input/output with a while loop (see the following code), the main
thread responsible for request processing can be blocked due to pending data. For
example, when you send a large amount of data to a very powerful server across a
network, the time taken for data collection will be inversely proportional to the band-
width of the network. The smaller the bandwidth, the more time the server will take
to do the job.
public class TraditionnalIOProcessing extends
HttpServlet {
Logger logger =
protected void doGet(HttpServletRequest
request, HttpServletResponse response) {
try (ServletInputStream input =
FileOutputStream outputStream =
Search WWH ::

Custom Search