Submit Search
Upload
JavaOne San Francisco 2013 - Servlet 3.1 (JSR 340)
Report
Share
S
Shing Wai Chan
Follow
•
2 likes
•
3,095 views
1
of
51
JavaOne San Francisco 2013 - Servlet 3.1 (JSR 340)
•
2 likes
•
3,095 views
Report
Share
Download Now
Download to read offline
Technology
JavaOne San Francisco 2013 presentation CON4854 What's New in JSR 340, Servlet 3.1?
Read more
S
Shing Wai Chan
Follow
Recommended
Servlet 3.1 by
Servlet 3.1
Arun Gupta
9K views
•
42 slides
Java EE 7: Boosting Productivity and Embracing HTML5 by
Java EE 7: Boosting Productivity and Embracing HTML5
Arun Gupta
6K views
•
34 slides
Rapid Network Application Development with Apache MINA by
Rapid Network Application Development with Apache MINA
trustinlee
1.8K views
•
36 slides
Networking and Data Access with Eqela by
Networking and Data Access with Eqela
jobandesther
1.7K views
•
31 slides
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013 by
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
Arun Gupta
6.7K views
•
107 slides
Tomcat New Evolution by
Tomcat New Evolution
Allan Huang
4.2K views
•
44 slides
More Related Content
What's hot
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out! by
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
Priyanka Aash
2.2K views
•
72 slides
Java EE 6 CDI Integrates with Spring & JSF by
Java EE 6 CDI Integrates with Spring & JSF
Jiayun Zhou
3.9K views
•
47 slides
Reactive server with netty by
Reactive server with netty
Dmitriy Dumanskiy
1.8K views
•
98 slides
Project Reactor Now and Tomorrow by
Project Reactor Now and Tomorrow
VMware Tanzu
3K views
•
136 slides
The Play Framework at LinkedIn by
The Play Framework at LinkedIn
Yevgeniy Brikman
282.3K views
•
143 slides
Servlets by
Servlets
Manav Prasad
293 views
•
26 slides
What's hot
(20)
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out! by Priyanka Aash
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
Priyanka Aash
•
2.2K views
Java EE 6 CDI Integrates with Spring & JSF by Jiayun Zhou
Java EE 6 CDI Integrates with Spring & JSF
Jiayun Zhou
•
3.9K views
Reactive server with netty by Dmitriy Dumanskiy
Reactive server with netty
Dmitriy Dumanskiy
•
1.8K views
Project Reactor Now and Tomorrow by VMware Tanzu
Project Reactor Now and Tomorrow
VMware Tanzu
•
3K views
The Play Framework at LinkedIn by Yevgeniy Brikman
The Play Framework at LinkedIn
Yevgeniy Brikman
•
282.3K views
Servlets by Manav Prasad
Servlets
Manav Prasad
•
293 views
Java servlets by yuvarani p
Java servlets
yuvarani p
•
129 views
Node.js vs Play Framework by Yevgeniy Brikman
Node.js vs Play Framework
Yevgeniy Brikman
•
173.7K views
Dependencies Managers in C/C++. Using stdcpp 2014 by biicode
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
•
4.4K views
How to bake reactive behavior into your Java EE applications by Ondrej Mihályi
How to bake reactive behavior into your Java EE applications
Ondrej Mihályi
•
1.3K views
Seven perilous pitfalls to avoid with Java | DevNation Tech Talk by Red Hat Developers
Seven perilous pitfalls to avoid with Java | DevNation Tech Talk
Red Hat Developers
•
3K views
GlassFish BOF by glassfish
GlassFish BOF
glassfish
•
13.7K views
Appium Automation with Kotlin by RapidValue
Appium Automation with Kotlin
RapidValue
•
383 views
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo... by 0xdaryl
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...
0xdaryl
•
3.2K views
Leveraging Completable Futures to handle your query results Asynchrhonously by David Gómez García
Leveraging Completable Futures to handle your query results Asynchrhonously
David Gómez García
•
169 views
Jersey framework by knight1128
Jersey framework
knight1128
•
3.6K views
Apache Tomcat 7 by Filip Hanik by Edgar Espina
Apache Tomcat 7 by Filip Hanik
Edgar Espina
•
2.1K views
Aci programmability by Cisco DevNet
Aci programmability
Cisco DevNet
•
2.1K views
Modern Java Workshop by Simon Ritter
Modern Java Workshop
Simon Ritter
•
252 views
Hacking oracle using metasploit by Alberto García Illera
Hacking oracle using metasploit
Alberto García Illera
•
867 views
Similar to JavaOne San Francisco 2013 - Servlet 3.1 (JSR 340)
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340) by
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)
Shing Wai Chan
810 views
•
50 slides
Java ee7 1hour by
Java ee7 1hour
Frank Rodriguez
62 views
•
40 slides
OTN Tour 2013: What's new in java EE 7 by
OTN Tour 2013: What's new in java EE 7
Bruno Borges
2.5K views
•
41 slides
Java EE7 by
Java EE7
Jay Lee
857 views
•
50 slides
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck by
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Edward Burns
3.1K views
•
24 slides
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R... by
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
jaxLondonConference
2.6K views
•
34 slides
Similar to JavaOne San Francisco 2013 - Servlet 3.1 (JSR 340)
(20)
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340) by Shing Wai Chan
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)
Shing Wai Chan
•
810 views
Java ee7 1hour by Frank Rodriguez
Java ee7 1hour
Frank Rodriguez
•
62 views
OTN Tour 2013: What's new in java EE 7 by Bruno Borges
OTN Tour 2013: What's new in java EE 7
Bruno Borges
•
2.5K views
Java EE7 by Jay Lee
Java EE7
Jay Lee
•
857 views
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck by Edward Burns
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Edward Burns
•
3.1K views
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R... by jaxLondonConference
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
jaxLondonConference
•
2.6K views
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948) by Fred Rowe
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
Fred Rowe
•
4.2K views
As novidades do Java EE 7: do HTML5 ao JMS 2.0 by Bruno Borges
As novidades do Java EE 7: do HTML5 ao JMS 2.0
Bruno Borges
•
1.3K views
Presente e Futuro: Java EE.next() by Bruno Borges
Presente e Futuro: Java EE.next()
Bruno Borges
•
1.6K views
Batch Applications for the Java Platform by Sivakumar Thyagarajan
Batch Applications for the Java Platform
Sivakumar Thyagarajan
•
1.9K views
Getting Started with WebSocket and Server-Sent Events in Java by Arun Gupta
Getting Started with WebSocket and Server-Sent Events in Java
Arun Gupta
•
6.7K views
112815 java ee8_davidd by Takashi Ito
112815 java ee8_davidd
Takashi Ito
•
516 views
Java API for WebSocket 1.0: Java EE 7 and GlassFish by Arun Gupta
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Arun Gupta
•
23K views
JAX RS 2.0 - OTN Bangalore 2013 by Jagadish Prasath
JAX RS 2.0 - OTN Bangalore 2013
Jagadish Prasath
•
683 views
JAX-RS 2.0: RESTful Web Services by Arun Gupta
JAX-RS 2.0: RESTful Web Services
Arun Gupta
•
5.5K views
"Quantum" Performance Effects by Sergey Kuksenko
"Quantum" Performance Effects
Sergey Kuksenko
•
4.8K views
Getting Started with WebSocket and Server-Sent Events using Java by Arun Gupta by Codemotion
Getting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
Codemotion
•
1.6K views
Getting started with Websocket and Server-sent Events using Java - Arun Gupta by jaxconf
Getting started with Websocket and Server-sent Events using Java - Arun Gupta
jaxconf
•
583 views
Best Practices for JSF, Gameduell 2013 by Edward Burns
Best Practices for JSF, Gameduell 2013
Edward Burns
•
4.9K views
Completable future by Srinivasan Raghvan
Completable future
Srinivasan Raghvan
•
915 views
Recently uploaded
Inawisdom IDP by
Inawisdom IDP
PhilipBasford
17 views
•
48 slides
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And... by
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
ShapeBlue
120 views
•
12 slides
KubeConNA23 Recap.pdf by
KubeConNA23 Recap.pdf
MichaelOLeary82
28 views
•
27 slides
The Power of Heat Decarbonisation Plans in the Built Environment by
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE
85 views
•
20 slides
PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」 by
PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」
PC Cluster Consortium
29 views
•
68 slides
Choosing the Right Flutter App Development Company by
Choosing the Right Flutter App Development Company
Ficode Technologies
13 views
•
9 slides
Recently uploaded
(20)
Inawisdom IDP by PhilipBasford
Inawisdom IDP
PhilipBasford
•
17 views
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And... by ShapeBlue
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
ShapeBlue
•
120 views
KubeConNA23 Recap.pdf by MichaelOLeary82
KubeConNA23 Recap.pdf
MichaelOLeary82
•
28 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE
•
85 views
PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」 by PC Cluster Consortium
PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」
PC Cluster Consortium
•
29 views
Choosing the Right Flutter App Development Company by Ficode Technologies
Choosing the Right Flutter App Development Company
Ficode Technologies
•
13 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada
Fwdays
•
59 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook Presentation
Rob McCarty
•
66 views
Business Analyst Series 2023 - Week 4 Session 8 by DianaGray10
Business Analyst Series 2023 - Week 4 Session 8
DianaGray10
•
180 views
"Running students' code in isolation. The hard way", Yurii Holiuk by Fwdays
"Running students' code in isolation. The hard way", Yurii Holiuk
Fwdays
•
38 views
"Node.js Development in 2024: trends and tools", Nikita Galkin by Fwdays
"Node.js Development in 2024: trends and tools", Nikita Galkin
Fwdays
•
37 views
What is Authentication Active Directory_.pptx by HeenaMehta35
What is Authentication Active Directory_.pptx
HeenaMehta35
•
15 views
AIM102-S_Cognizant_CognizantCognitive by PhilipBasford
AIM102-S_Cognizant_CognizantCognitive
PhilipBasford
•
23 views
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell by Fwdays
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
Fwdays
•
14 views
MVP and prioritization.pdf by rahuldharwal141
MVP and prioritization.pdf
rahuldharwal141
•
40 views
Mobile Core Solutions & Successful Cases.pdf by IPLOOK Networks
Mobile Core Solutions & Successful Cases.pdf
IPLOOK Networks
•
16 views
Generative AI: Shifting the AI Landscape by Deakin University
Generative AI: Shifting the AI Landscape
Deakin University
•
78 views
This talk was not generated with ChatGPT: how AI is changing science by Elena Simperl
This talk was not generated with ChatGPT: how AI is changing science
Elena Simperl
•
34 views
Cocktail of Environments. How to Mix Test and Development Environments and St... by Aleksandr Tarasov
Cocktail of Environments. How to Mix Test and Development Environments and St...
Aleksandr Tarasov
•
26 views
Measuring User on the web with the core web vitals - by @theafolayan.pptx by Oluwaseun Raphael Afolayan
Measuring User on the web with the core web vitals - by @theafolayan.pptx
Oluwaseun Raphael Afolayan
•
14 views
JavaOne San Francisco 2013 - Servlet 3.1 (JSR 340)
1.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.1
2.
What’s New in
JSR 340, Servlet 3.1? Shing Wai Chan Rajiv Mordani Session ID: CON 4854
3.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle s products remains at the sole discretion of Oracle.
4.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.4 Program Agenda § Servlet 3.1 Overview § Non-blocking IO § Protocol Upgrade § Security enhancements § Miscellaneous features § Resources
5.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.5 Servlet 3.1 Overview § FINAL: Part of Java EE 7 § Upgrade from Servlet 3.0 § Scalability – Expose Non-blocking IO API § Support newer technologies that leverage HTTP protocol for the initial handshake – Support general upgrade mechanism for protocols like WebSocket § Security enhancements
6.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.6 Program Agenda § Servlet 3.1 Overview § Non-blocking IO § Protocol Upgrade § Security enhancements § Miscellaneous features § Resources
7.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.7 Non-blocking IO public class TestServlet extends HttpServlet protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ServletInputStream input = request.getInputStream(); byte[] b = new byte[1024]; int len = -1; while ((len = input.read(b)) != -1) { … } } } Traditional IO Example
8.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.8 Non Blocking IO § Add two new interfaces: ReadListener, WriteListener § Add APIs to ServletInputStream, ServletOutputStream § For asynchronous and upgrade only Overview
9.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.9 Non-blocking IO public interface ReadListener extends EventListener { public void onDataAvailable() throws IOException; public void onAllDataRead() throws IOException; public void onError(Throwable t); } javax.servlet.ReadListener
10.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.10 Non-blocking IO public interface WriteListener extends EventListener { public void onWritePossible() throws IOException; public void onError(Throwable t); } javax.servlet.WriteListener
11.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.11 Non-blocking IO § javax.servlet.ServletInputStream – public abstract boolean isFinished() – public abstract boolean isReady() – public abstract void setReadListener(ReadListener listener) § javax.servlet.ServletOutputStream – public abstract boolean isReady() – public abstract setWriteListener(WriteListener listener) ServletInputStream, ServletOutputStream
12.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.12 Non-blocking IO public class TestServlet extends HttpServlet { protected void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { AsyncContext ac = req.startAsync(); … ServletInputStream input = req.getInputStream(); ReadListener readListener = new ReadListenerImpl(input, output, ac); input.setReadListener(readListener); } } Example
13.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.13 Non-blocking IO public class ReadListenerImpl implements ReadListener { … public void onDataAvailable() throws IOException { … int len = -1; byte b[] = new byte[1024]; while ((len = input.read(b)) != -1) { … } } public void onAllDataRead() throws IOException { … } public void onError(final Throwable t) { … } } Example (cont’d): Quiz
14.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.14 Non-blocking IO public class ReadListenerImpl implements ReadListener { … public void onDataAvailable() throws IOException { … int len = -1; byte b[] = new byte[1024]; while (input.isReady() && (len = input.read(b)) != -1) { … } } public void onAllDataRead() throws IOException { ac.complete(); } public void onError(final Throwable t) { … } } Example (cont’d 2): Answer
15.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.15 Non-blocking IO public class TestServlet2 extends HttpServlet { protected void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { AsyncContext ac = req.startAsync(); … ServletOutputStream output = req.getOutputStream(); WriteListener writeListener = new WriteListenerImpl(output, ac); output.setWriteListener(writeListener); } } Example 2
16.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.16 Non-blocking IO public class WriteListenerImpl implements WriteListener { … public void onWritePossible() throws IOException { … int len = -1; byte b[] = new byte[1024]; while (output.isReady()) { … } … } public void onError(final Throwable t) { … } } Example 2 (cont’d)
17.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.17 Program Agenda § Servlet 3.1 Overview § Non-blocking IO § Protocol Upgrade § Security Enhancements § Miscellaneous § Resources
18.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.18 Protocol Upgrade § HTTP 1.1 (RFC 2616) § Connection § Transition to some other, incompatible protocol – For examples, IRC/6.9, Web Socket HTTP Upgrade
19.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.19 Protocol Upgrade § Originally proposed as part of HTML5 § IETF-defined Protocol: RFC 6455 – Handshake – Data Transfer § W3C defined JavaScript API – Candidate Recommendation, 2012-09-20 § Bi-directional, full-duplex / TCP Example: WebSocket
20.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.20 Client GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Origin: http://example.com Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 13 Protocol Upgrade Server HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat WebSocket Example
21.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.21 Protocol Upgrade § Add API to HttpServletRequest § Add two new interfaces – javax.servlet.http.HttpUpgradeHandler – javax.servlet.http.WebConnection § Can use non-blocking IO API in upgrade Overview
22.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.22 Protocol Upgrade § New interface javax.servlet.http.HttpUpgradeHandler – void init(WebConnection wc) – void destroy() § New interface javax.servlet.http.WebConnection extends AutoClosable – ServletInputStream getInputStream() throws IOException – ServletOutputStream getOutputStream() throws IOException HttpUpgradeHandler, WebConnection
23.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.23 Protocol Upgrade § Add a method to HttpServletRequest – <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException HttpServletRequest
24.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.24 Protocol Upgrade HttpServlet / Filter req.upgrade(…) init destroy HTTP Request upgraded protocol requests / responses HttpUpgradeHandler
25.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.25 Protocol Upgrade public class UpgradeServlet extends HttpServlet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { … if (decideToUpgrade) { EchoHttpUpgradeHandler handler = request.upgrade(EchoHttpUpgradeHandler.class); … } } Example
26.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.26 Protocol Upgrade public class EchoHttpUpgradeHandler implements HttpUpgradeHandler { public void init(WebConnection wc) { try { ServletInputStream input = wc.getInputStream(); ServletOutputStream output = wc.getOutputStream(); ReadListener readListener = …; input.setReadListener(readListener); … } public void destroy() { … } } Example (cont’d)
27.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.27 Protocol Upgrade TyrusServletFilter req.upgrade(…) init destroy HTTP Request WebSocket requests / responses TyrusHttpUpgradeHandler Example 2: Reference Implementation of JSR 356, Java API for WebSocket
28.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.28 DEMO
29.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.29 Agenda § Servlet 3.1 Overview § Non-blocking IO § Protocol Upgrade § Security Enhancements § Miscellaneous § Resources
30.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.30 Security Enhancements § Emails or web pages from hackers containing – http://abank.com?SID=ABCDEFGHIJ § Change Session id on authentication – Add to interface HttpServletRequest § public String changeSessionId() – New interface javax.servlet.http.HttpSessionIdListener § void sessionIdChanged(HttpSessionEvent se, String oldSessionId) Session Fixation Attack
31.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.31 Security Enhancements User Group Role /foo (“*”) /bar (“admin”) Alice manager admin Bob staff staff Carol contractor Any authenticated users Quiz
32.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.32 Security Enhancements § Role “*” means any defined roles Any authenticated users Answer to the Quiz User Group Role /foo (“*”) /bar (“admin”) Alice manager admin ok ok Bob staff staff ok deny Carol contractor deny deny
33.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.33 Security Enhancements § Roles “**”, any authenticated users § For example, – @WebServlet(“/foo”) @ServletSecurity(@HttpConstraint(rolesAllowed={“**”})) Any authenticated users
34.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.34 Security Enhancements § deny-uncovered-http-methods in web.xml § For example, – <web-app …> " "…" " " "" " "<deny-uncovered-http-methods/> " "" " "<security-constraint> " " "<web-resource-collection> " " " "<web-resource-name>protected</web-resource-name> " " " "<url-pattern>/*</url-pattern> " " " "<http-method>GET</http-method> " " "</web-resource-collection> " " "<auth-constraint> " " " "<role-name>manager</role-name> " " "</auth-constraint> " "</security-constraint> </web-app>" deny-uncovered-http-methods
35.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.35 Security Enhancements § Clarification on run-as – Servlet#init, Servlet#destroy Run as
36.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.36 Security Enhancements § Java EE 7, not in Servlet 3.1 § Java security manager § Declaring permissions required by application components § META-INF/permission.xml § See EE.6.2 of Java EE 7 spec for details. Declaring Permissions
37.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.37 Agenda § Servlet 3.1 Overview § Non-blocking IO § Protocol Upgrade § Security Enhancements § Miscellaneous § Resources
38.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.38 Miscellaneous § ServletResponse#reset – Clears any data that exists in the buffer as well as the status code and headers § ServletResponse#setCharacterEncoding – Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8. – … ServletResponse#reset and #setCharacterEncoding Servlet 3.0
39.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.39 Miscellaneous public class TestServlet extends HttpServlet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); response.setCharacterEncoding("ISO-8859-1"); PrintWriter writer = response.getWriter(); … response.reset(); response.setContentType("text/plain"); response.setCharacterEncoding("Big5"); response.getOutputStream().println("Done"); } } ServletResponse#reset and setCharacterEncoding (cont’d) Quiz in Servlet 3.0
40.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.40 Miscellaneous public class TestServlet extends HttpServlet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); response.setCharacterEncoding("ISO-8859-1"); PrintWriter writer = response.getWriter(); … response.reset(); response.setContentType("text/plain"); response.setCharacterEncoding("Big5"); // no effect response.getOutputStream().println("Done"); // IllegalStateException } } ServletResponse#reset and setCharacterEncoding (cont’d 2) Answer to Quiz in Servlet 3.0
41.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.41 Miscellaneous § Character encoding setting after ServletResponse#reset – Only #getServletOutputStream or #getWriter – #setCharacterEncoding has no effect after calling #getWriter – Servlet 3.0 § #reset clears HTTP headers, status code, data in buffer – Servlet 3.1 § #reset clears – HTTP headers, status code, data in buffer – state of calling #getServletOutputStream or #getWriter ServletResponse#reset and #setCharacterEncoding (cont’d 3)
42.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.42 Miscellaneous public class TestServlet extends HttpServlet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); response.setCharacterEncoding("ISO-8859-1"); PrintWriter writer = response.getWriter(); … response.reset(); response.setContentType("text/plain"); response.setCharacterEncoding("Big5"); // set Big5 encoding response.getOutputStream().println("Done"); // print } } ServletResponse#reset and #setCharacterEncoding (cont’d 4) Example
43.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.43 Miscellaneous § HttpServletResponse.sendRedirect – a.jsp – /b/a.jsp – http://anotherhost.com/b/a.jsp – //anotherhost.com/b/a.jsp (Network Path Reference) Relative Protocol URL
44.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.44 Miscellaneous § Clarification for HttpServletRequest#getPart, #getParts without multi-part configuration – throw IllegalStateException § Add method javax.servlet.http.Part#getSubmittedFileName() Multi-part
45.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.45 Miscellaneous § Clarification for ServletContainerInitiailizer – independent of metadata-complete – instance per web application ServletContainerInitializer
46.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.46 Miscellaneous § ServletRequestWrapper#isWrapperFor(Class<?> c) § ServletResponseWrapper#isWrapperFor(Class<?> c) § HandlesTypes#value return Class<?>[ ] Generic
47.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.47 Miscellaneous § Add method ServletContext#getVirtualServerName() § Add method ServletRequest#getContentLengthLong() § Add method ServletResponse#setContentLengthLong(long len) Others
48.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.48 Agenda § Servlet 3.1 Overview § Non-blocking IO § Protocol Upgrade § Security § Miscellaneous § Resources
49.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.49 Resources § Spec and Javadoc – http://jcp.org/en/jsr/detail?id=340 – http://servlet-spec.java.net § GlassFish 4.0 – http://glassfish.java.net – webtier@glassfish.java.net § blog – http://www.java.net/blog/swchan2
50.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.50 Graphic Section Divider
51.
Copyright © 2013,
Oracle and/or its affiliates. All rights reserved.51