Skip to content

Commit

Permalink
Remove restriction on ServletContext getters (#441)
Browse files Browse the repository at this point in the history
Remove the restriction on programatically added listeners calling getter
methods on the ServletContext.

Fixes #416

Signed-off-by: Stuart Douglas <[email protected]>
  • Loading branch information
stuartwdouglas authored Nov 12, 2021
1 parent 8d6d2ec commit a1299d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 50 deletions.
50 changes: 0 additions & 50 deletions api/src/main/java/jakarta/servlet/ServletContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ public interface ServletContext {
* @return the major version of the Servlet specification that the application represented by this ServletContext is
* based on
*
* @throws UnsupportedOperationException if this ServletContext was passed to the
* {@link ServletContextListener#contextInitialized} method of a {@link ServletContextListener} that was neither
* declared in <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with
* {@link jakarta.servlet.annotation.WebListener}
*
* @since Servlet 3.0
*/
public int getEffectiveMajorVersion();
Expand All @@ -157,11 +152,6 @@ public interface ServletContext {
* @return the minor version of the Servlet specification that the application represented by this ServletContext is
* based on
*
* @throws UnsupportedOperationException if this ServletContext was passed to the
* {@link ServletContextListener#contextInitialized} method of a {@link ServletContextListener} that was neither
* declared in <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with
* {@link jakarta.servlet.annotation.WebListener}
*
* @since Servlet 3.0
*/
public int getEffectiveMinorVersion();
Expand Down Expand Up @@ -990,11 +980,6 @@ public interface ServletContext {
*
* @return set of the session tracking modes supported by default for this <tt>ServletContext</tt>
*
* @throws UnsupportedOperationException if this ServletContext was passed to the
* {@link ServletContextListener#contextInitialized} method of a {@link ServletContextListener} that was neither
* declared in <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with
* {@link jakarta.servlet.annotation.WebListener}
*
* @since Servlet 3.0
*/
public Set<SessionTrackingMode> getDefaultSessionTrackingModes();
Expand All @@ -1012,11 +997,6 @@ public interface ServletContext {
*
* @return set of the session tracking modes in effect for this <tt>ServletContext</tt>
*
* @throws UnsupportedOperationException if this ServletContext was passed to the
* {@link ServletContextListener#contextInitialized} method of a {@link ServletContextListener} that was neither
* declared in <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with
* {@link jakarta.servlet.annotation.WebListener}
*
* @since Servlet 3.0
*/
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes();
Expand Down Expand Up @@ -1207,11 +1187,6 @@ public interface ServletContext {
* and <code>web-fragment.xml</code> descriptor files of the web application represented by this ServletContext, or null
* if no such configuration exists
*
* @throws UnsupportedOperationException if this ServletContext was passed to the
* {@link ServletContextListener#contextInitialized} method of a {@link ServletContextListener} that was neither
* declared in <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with
* {@link jakarta.servlet.annotation.WebListener}
*
* @see jakarta.servlet.descriptor.JspConfigDescriptor
*
* @since Servlet 3.0
Expand All @@ -1229,11 +1204,6 @@ public interface ServletContext {
*
* @return the class loader of the web application represented by this ServletContext
*
* @throws UnsupportedOperationException if this ServletContext was passed to the
* {@link ServletContextListener#contextInitialized} method of a {@link ServletContextListener} that was neither
* declared in <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with
* {@link jakarta.servlet.annotation.WebListener}
*
* @throws SecurityException if a security manager denies access to the requested class loader
*
* @since Servlet 3.0
Expand Down Expand Up @@ -1275,11 +1245,6 @@ public interface ServletContext {
* @return a <code>String</code> containing the configuration name of the logical host on which the servlet context is
* deployed.
*
* @throws UnsupportedOperationException if this ServletContext was passed to the
* {@link ServletContextListener#contextInitialized} method of a {@link ServletContextListener} that was neither
* declared in <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with
* {@link jakarta.servlet.annotation.WebListener}
*
* @since Servlet 3.1
*/
public String getVirtualServerName();
Expand All @@ -1289,11 +1254,6 @@ public interface ServletContext {
*
* @return the session timeout in minutes that are supported by default for this <tt>ServletContext</tt>
*
* @throws UnsupportedOperationException if this ServletContext was passed to the
* {@link ServletContextListener#contextInitialized} method of a {@link ServletContextListener} that was neither
* declared in <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with
* {@link jakarta.servlet.annotation.WebListener}
*
* @since Servlet 4.0
*/
public int getSessionTimeout();
Expand Down Expand Up @@ -1321,11 +1281,6 @@ public interface ServletContext {
*
* @return the request character encoding that are supported by default for this <tt>ServletContext</tt>
*
* @throws UnsupportedOperationException if this ServletContext was passed to the
* {@link ServletContextListener#contextInitialized} method of a {@link ServletContextListener} that was neither
* declared in <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with
* {@link jakarta.servlet.annotation.WebListener}
*
* @since Servlet 4.0
*/
public String getRequestCharacterEncoding();
Expand Down Expand Up @@ -1353,11 +1308,6 @@ public interface ServletContext {
*
* @return the request character encoding that are supported by default for this <tt>ServletContext</tt>
*
* @throws UnsupportedOperationException if this ServletContext was passed to the
* {@link ServletContextListener#contextInitialized} method of a {@link ServletContextListener} that was neither
* declared in <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with
* {@link jakarta.servlet.annotation.WebListener}
*
* @since Servlet 4.0
*/
public String getResponseCharacterEncoding();
Expand Down
3 changes: 3 additions & 0 deletions spec/src/main/asciidoc/servlet-spec-body.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8546,6 +8546,9 @@ Jakarta Servlet {spec-version} specification developed under the Jakarta EE Work

=== Changes Since Jakarta Servlet 5.0

link:https://github.com/eclipse-ee4j/servlet-api/issues/416[Issue 416]::
Remove the restriction on programatically added listeners calling some `ServletContext` getter methods.

link:https://github.com/eclipse-ee4j/servlet-api/issues/18[Issue 18]::
Clarify the decoding and normalization of URI paths.

Expand Down

0 comments on commit a1299d6

Please sign in to comment.