12.3.2 Changes in servlets
- Organization of this subsection
(1) Handling of non-supported Servlet 3.0 APIs
Application Server version 11 and Developer version 11 now support some Servlet 3.0 APIs that were not supported in version 9. For this reason, when the relevant APIs are used, they operate according to the Servlet 3.0 specifications in Application Server version 11 and Developer version 11 even though the UnsupportedOperationException exception was thrown in Application Server version 9.
The relevant APIs are listed in the following table. If the application always expects the UnsupportedOperationException exception to be thrown from these APIs, you need to modify the application so that the implementation is based on the assumption that no exception will be thrown.
Package |
Class |
Method |
---|---|---|
javax.servlet |
AsyncContext |
All methods |
AsyncListener |
All methods |
|
ServletRequest |
startAsync |
|
isAsyncStarted |
||
isAsyncSupported |
||
getAsyncContext |
||
getDispatcherType |
||
AsyncEvent |
All methods |
|
ServletRequestWrapper |
startAsync |
|
isAsyncStarted |
||
isAsyncSupported |
||
getAsyncContext |
||
getDispatcherType |
||
Registration |
setAsyncSupported |
In addition, for APIs that remain unsupported in Application Server version 11 and Developer version 11, no exception will be thrown by default in Application Server version 11 and Developer version 11 even though the UnsupportedOperationException exception was thrown in Application Server version 9 and Developer version 9. The relevant APIs are listed in the following table.
Package |
Class |
Method |
Operation for the value specified for webserver.servlet_api.unsupported.throwUnsupportedOperationException |
|
---|---|---|---|---|
false (default) |
true |
|||
javax.servlet |
ServletContext |
getJspConfigDescriptor |
Returns null. |
Throws the UnsupportedOperationException exception. |
If the application always expects the UnsupportedOperationException exception to be thrown from these APIs, modify the application so that the implementation is based on the assumption that no exception will be thrown, or add the following definition to the user property file for J2EE servers.
webserver.servlet_api.unsupported.throwUnsupportedOperationException=true
(2) Processing to dynamically add a servlet that maps to the context root
In Application Server version 9 and Developer version 9, if you specified / to indicate the context root for the argument of the addMapping method of javax.servlet.ServletRegistration, the mapping could not be overwritten because the default servlet was already mapped.
In Application Server version 11 and Developer version 11, you can overwrite the mapping to the context root only once for the same ServletContext. This enables you to map a user-defined servlet (instead of the default servlet) to the context root.
If the application does not expect Application Server version 11 and Developer version 11 to operate accordingly but expects the addMapping method to refuse to overwrite the mapping, you need to modify the application so that the addMapping method that performs mapping to the context root is not invoked. If you migrate to Application Server version 11 and Developer version 11 without modifying the application, the mapping to the default servlet might be overwritten with mapping to a user servlet.