Skip to content

Commit

Permalink
Remove restriction from some methods according to Servlet 6 rules
Browse files Browse the repository at this point in the history
Signed-off-by: Arjan Tijms <arjan.tijms@gmail.com>
  • Loading branch information
arjantijms committed Apr 7, 2022
1 parent 7345224 commit e42888d
Showing 1 changed file with 4 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation.
* Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved.
* Copyright 2004 The Apache Software Foundation
*
Expand Down Expand Up @@ -93,16 +94,6 @@ public StandardContext getStandardContext() {
}


// ----------------------------------------------------- Class Variables

// START PWC 1.2
/*
private static final SecurityPermission GET_UNWRAPPED_CONTEXT_PERMISSION =
new SecurityPermission("getUnwrappedContext");
*/
// END PWC 1.2


// ----------------------------------------------------- Instance Variables

/**
Expand Down Expand Up @@ -243,7 +234,7 @@ public String getInitParameter(final String name) {
*/
@Override
public Enumeration<String> getInitParameterNames() {
return (new Enumerator<String>(parameters.keySet()));
return new Enumerator<String>(parameters.keySet());
}

/**
Expand All @@ -267,15 +258,15 @@ public boolean setInitParameter(String name, String value) {
*/
@Override
public int getMajorVersion() {
return (Constants.MAJOR_VERSION);
return Constants.MAJOR_VERSION;
}

/**
* Return the minor version of the Java Servlet API that we implement.
*/
@Override
public int getMinorVersion() {
return (Constants.MINOR_VERSION);
return Constants.MINOR_VERSION;
}

/**
Expand All @@ -284,10 +275,6 @@ public int getMinorVersion() {
*/
@Override
public int getEffectiveMajorVersion() {
if (isRestricted) {
throw new UnsupportedOperationException(
rb.getString(LogFacade.UNSUPPORTED_OPERATION_EXCEPTION));
}
return context.getEffectiveMajorVersion();
}

Expand All @@ -297,10 +284,6 @@ public int getEffectiveMajorVersion() {
*/
@Override
public int getEffectiveMinorVersion() {
if (isRestricted) {
throw new UnsupportedOperationException(
rb.getString(LogFacade.UNSUPPORTED_OPERATION_EXCEPTION));
}
return context.getEffectiveMinorVersion();
}

Expand Down Expand Up @@ -803,10 +786,6 @@ public void setSessionTrackingModes(
*/
@Override
public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
if (isRestricted) {
throw new UnsupportedOperationException(
rb.getString(LogFacade.UNSUPPORTED_OPERATION_EXCEPTION));
}
return context.getDefaultSessionTrackingModes();
}

Expand All @@ -819,10 +798,6 @@ public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
*/
@Override
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
if (isRestricted) {
throw new UnsupportedOperationException(
rb.getString(LogFacade.UNSUPPORTED_OPERATION_EXCEPTION));
}
return context.getEffectiveSessionTrackingModes();
}

Expand Down Expand Up @@ -885,19 +860,11 @@ public <T extends EventListener> T createListener(Class<T> clazz)
*/
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
if (isRestricted) {
throw new UnsupportedOperationException(
rb.getString(LogFacade.UNSUPPORTED_OPERATION_EXCEPTION));
}
return context.getJspConfigDescriptor();
}

@Override
public ClassLoader getClassLoader() {
if (isRestricted) {
throw new UnsupportedOperationException(
rb.getString(LogFacade.UNSUPPORTED_OPERATION_EXCEPTION));
}
return context.getClassLoader();
}

Expand All @@ -912,19 +879,11 @@ public void declareRoles(String... roleNames) {

@Override
public String getVirtualServerName() {
if (isRestricted) {
throw new UnsupportedOperationException(
rb.getString(LogFacade.UNSUPPORTED_OPERATION_EXCEPTION));
}
return context.getVirtualServerName();
}

@Override
public int getSessionTimeout() {
if (isRestricted) {
throw new UnsupportedOperationException(
rb.getString(LogFacade.UNSUPPORTED_OPERATION_EXCEPTION));
}
return context.getSessionTimeout();
}

Expand All @@ -939,10 +898,6 @@ public void setSessionTimeout(int sessionTimeout) {

@Override
public String getRequestCharacterEncoding() {
if (isRestricted) {
throw new UnsupportedOperationException(
rb.getString(LogFacade.UNSUPPORTED_OPERATION_EXCEPTION));
}
return context.getRequestCharacterEncoding();
}

Expand All @@ -957,10 +912,6 @@ public void setRequestCharacterEncoding(String encoding) {

@Override
public String getResponseCharacterEncoding() {
if (isRestricted) {
throw new UnsupportedOperationException(
rb.getString(LogFacade.UNSUPPORTED_OPERATION_EXCEPTION));
}
return context.getResponseCharacterEncoding();
}

Expand All @@ -973,26 +924,6 @@ public void setResponseCharacterEncoding(String encoding) {
context.setResponseCharacterEncoding(encoding);
}

// START PWC 1.2
/**
* Gets the underlying StandardContext to which this ApplicationContext is
* delegating.
*
* @return The underlying StandardContext
*/
/*
public StandardContext getUnwrappedContext() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(GET_UNWRAPPED_CONTEXT_PERMISSION);
}
return this.context;
}
*/
// END PWC 1.2


// -------------------------------------------------------- Package Methods

Expand Down

0 comments on commit e42888d

Please sign in to comment.