Author: cziegeler
Date: Mon Oct 17 11:08:10 2016
New Revision: 1765239

URL: http://svn.apache.org/viewvc?rev=1765239&view=rev
Log:
SLING-5784 : Use service property to identify the ServletContext registered by 
Sling

Modified:
    sling/trunk/bundles/scripting/jsp/pom.xml
    
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletContext.java
    
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ExternalServletContextWrapper.java
    
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/InternalServletConfigWrapper.java
    
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/tagplugins/jstl/Util.java

Modified: sling/trunk/bundles/scripting/jsp/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/pom.xml?rev=1765239&r1=1765238&r2=1765239&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/pom.xml (original)
+++ sling/trunk/bundles/scripting/jsp/pom.xml Mon Oct 17 11:08:10 2016
@@ -94,6 +94,10 @@
 
     <dependencies>
         <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
@@ -128,12 +132,6 @@
         
         <dependency>
             <groupId>org.apache.tomcat</groupId>
-            <artifactId>servlet-api</artifactId>
-            <version>6.0.14</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tomcat</groupId>
             <artifactId>jsp-api</artifactId>
             <version>6.0.14</version>
         </dependency>

Modified: 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletContext.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletContext.java?rev=1765239&r1=1765238&r2=1765239&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletContext.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletContext.java
 Mon Oct 17 11:08:10 2016
@@ -20,12 +20,21 @@ import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.Map;
 import java.util.Set;
 
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+import javax.servlet.ServletRegistration.Dynamic;
+import javax.servlet.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -54,6 +63,7 @@ public class JspServletContext implement
     /* (non-Javadoc)
      * @see javax.servlet.ServletContext#getResource(java.lang.String)
      */
+    @Override
     public URL getResource(String path) throws MalformedURLException {
 
         if (path.startsWith("/")) {
@@ -70,6 +80,7 @@ public class JspServletContext implement
     /* (non-Javadoc)
      * @see javax.servlet.ServletContext#getResourceAsStream(java.lang.String)
      */
+    @Override
     public InputStream getResourceAsStream(String path) {
         // path might be an URL, so only check resource provider in case of an
         // absolute path - assuming URLs have no leading slash at all, we
@@ -100,101 +111,124 @@ public class JspServletContext implement
         return null;
     }
 
-    public Set<?> getResourcePaths(String path) {
+    @Override
+    public Set<String> getResourcePaths(String path) {
         return ioProvider.getResourcePaths(path);
     }
 
+    @Override
     public void log(String msg) {
         log.info(msg);
     }
 
+    @Override
     @Deprecated
     public void log(Exception exception, String msg) {
         log(msg, exception);
     }
 
+    @Override
     public void log(String message, Throwable throwable) {
         log.error(message, throwable);
     }
 
     //---------- delegated methods --------------------------------------------
 
+    @Override
     public Object getAttribute(String name) {
         return delegatee.getAttribute(name);
     }
 
-    public Enumeration<?> getAttributeNames() {
+    @Override
+    public Enumeration<String> getAttributeNames() {
         return delegatee.getAttributeNames();
     }
 
+    @Override
     public void removeAttribute(String name) {
         delegatee.removeAttribute(name);
     }
 
+    @Override
     public void setAttribute(String name, Object object) {
         delegatee.setAttribute(name, object);
     }
 
+    @Override
     public ServletContext getContext(String uripath) {
         return delegatee.getContext(uripath);
     }
 
+    @Override
     public String getInitParameter(String name) {
         return delegatee.getInitParameter(name);
     }
 
-    public Enumeration<?> getInitParameterNames() {
+    @Override
+    public Enumeration<String> getInitParameterNames() {
         return delegatee.getInitParameterNames();
     }
 
+    @Override
     public int getMajorVersion() {
         return delegatee.getMajorVersion();
     }
 
+    @Override
     public String getMimeType(String file) {
         return delegatee.getMimeType(file);
     }
 
+    @Override
     public int getMinorVersion() {
         return delegatee.getMinorVersion();
     }
 
+    @Override
     public RequestDispatcher getNamedDispatcher(String name) {
         return delegatee.getNamedDispatcher(name);
     }
 
+    @Override
     public String getRealPath(String path) {
         return delegatee.getRealPath(path);
     }
 
+    @Override
     public RequestDispatcher getRequestDispatcher(String path) {
         return delegatee.getRequestDispatcher(path);
     }
 
+    @Override
     public String getServerInfo() {
         return delegatee.getServerInfo();
     }
 
+    @Override
     @Deprecated
     public Servlet getServlet(String name) throws ServletException {
         return delegatee.getServlet(name);
     }
 
+    @Override
     public String getServletContextName() {
         return delegatee.getServletContextName();
     }
 
+    @Override
     @Deprecated
-    public Enumeration<?> getServletNames() {
+    public Enumeration<String> getServletNames() {
         return delegatee.getServletNames();
     }
 
+    @Override
     @Deprecated
-    public Enumeration<?> getServlets() {
+    public Enumeration<Servlet> getServlets() {
         return delegatee.getServlets();
     }
 
     // Servlet API 2.5 method
+    @Override
     public String getContextPath() {
         return delegatee.getContextPath();
     }
@@ -227,4 +261,139 @@ public class JspServletContext implement
 
         return null;
     }
+
+    @Override
+    public int getEffectiveMajorVersion() {
+        return delegatee.getEffectiveMajorVersion();
+    }
+
+    @Override
+    public int getEffectiveMinorVersion() {
+        return delegatee.getEffectiveMinorVersion();
+    }
+
+    @Override
+    public boolean setInitParameter(String name, String value) {
+        return delegatee.setInitParameter(name, value);
+    }
+
+    @Override
+    public Dynamic addServlet(String servletName, String className) {
+        return delegatee.addServlet(servletName, className);
+    }
+
+    @Override
+    public Dynamic addServlet(String servletName, Servlet servlet) {
+        return delegatee.addServlet(servletName, servlet);
+    }
+
+    @Override
+    public Dynamic addServlet(String servletName, Class<? extends Servlet> 
servletClass) {
+        return delegatee.addServlet(servletName, servletClass);
+    }
+
+    @Override
+    public <T extends Servlet> T createServlet(Class<T> clazz) throws 
ServletException {
+        return delegatee.createServlet(clazz);
+    }
+
+    @Override
+    public ServletRegistration getServletRegistration(String servletName) {
+        return delegatee.getServletRegistration(servletName);
+    }
+
+    @Override
+    public Map<String, ? extends ServletRegistration> 
getServletRegistrations() {
+        return delegatee.getServletRegistrations();
+    }
+
+    @Override
+    public javax.servlet.FilterRegistration.Dynamic addFilter(String 
filterName, String className) {
+        return delegatee.addFilter(filterName, className);
+    }
+
+    @Override
+    public javax.servlet.FilterRegistration.Dynamic addFilter(String 
filterName, Filter filter) {
+        return delegatee.addFilter(filterName, filter);
+    }
+
+    @Override
+    public javax.servlet.FilterRegistration.Dynamic addFilter(String 
filterName, Class<? extends Filter> filterClass) {
+        return delegatee.addFilter(filterName, filterClass);
+    }
+
+    @Override
+    public <T extends Filter> T createFilter(Class<T> clazz) throws 
ServletException {
+        return delegatee.createFilter(clazz);
+    }
+
+    @Override
+    public FilterRegistration getFilterRegistration(String filterName) {
+        return delegatee.getFilterRegistration(filterName);
+    }
+
+    @Override
+    public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+        return delegatee.getFilterRegistrations();
+    }
+
+    @Override
+    public SessionCookieConfig getSessionCookieConfig() {
+        return delegatee.getSessionCookieConfig();
+    }
+
+    @Override
+    public void setSessionTrackingModes(Set<SessionTrackingMode> 
sessionTrackingModes) {
+        delegatee.setSessionTrackingModes(sessionTrackingModes);
+    }
+
+    @Override
+    public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+        return delegatee.getDefaultSessionTrackingModes();
+    }
+
+    @Override
+    public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+        return delegatee.getEffectiveSessionTrackingModes();
+    }
+
+    @Override
+    public void addListener(String className) {
+        delegatee.addListener(className);
+    }
+
+    @Override
+    public <T extends EventListener> void addListener(T t) {
+        delegatee.addListener(t);
+    }
+
+    @Override
+    public void addListener(Class<? extends EventListener> listenerClass) {
+        delegatee.addListener(listenerClass);
+    }
+
+    @Override
+    public <T extends EventListener> T createListener(Class<T> clazz) throws 
ServletException {
+        return delegatee.createListener(clazz);
+    }
+
+    @Override
+    public JspConfigDescriptor getJspConfigDescriptor() {
+        return delegatee.getJspConfigDescriptor();
+    }
+
+    @Override
+    public ClassLoader getClassLoader() {
+        return delegatee.getClassLoader();
+    }
+
+    @Override
+    public void declareRoles(String... roleNames) {
+        delegatee.declareRoles(roleNames);
+    }
+
+    @Override
+    public String getVirtualServerName() {
+        return delegatee.getVirtualServerName();
+    }
 }

Modified: 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ExternalServletContextWrapper.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ExternalServletContextWrapper.java?rev=1765239&r1=1765238&r2=1765239&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ExternalServletContextWrapper.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ExternalServletContextWrapper.java
 Mon Oct 17 11:08:10 2016
@@ -5,9 +5,9 @@
  * licenses this file to You under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -21,14 +21,23 @@ import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.Map;
 import java.util.Set;
 
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+import javax.servlet.ServletRegistration.Dynamic;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
+import javax.servlet.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
 import javax.servlet.jsp.JspFactory;
 import javax.servlet.jsp.PageContext;
 
@@ -39,123 +48,285 @@ import org.apache.sling.scripting.jsp.ja
  * returned by servletContext.getContext(String)
  */
 class ExternalServletContextWrapper implements ServletContext {
-    
+
     private final ServletContext delegate;
+
+    @Override
+    public int getEffectiveMajorVersion() {
+        return delegate.getEffectiveMajorVersion();
+    }
+
+    @Override
+    public int getEffectiveMinorVersion() {
+        return delegate.getEffectiveMinorVersion();
+    }
+
+    @Override
+    public boolean setInitParameter(String name, String value) {
+        return delegate.setInitParameter(name, value);
+    }
+
+    @Override
+    public Dynamic addServlet(String servletName, String className) {
+        return delegate.addServlet(servletName, className);
+    }
+
+    @Override
+    public Dynamic addServlet(String servletName, Servlet servlet) {
+        return delegate.addServlet(servletName, servlet);
+    }
+
+    @Override
+    public Dynamic addServlet(String servletName, Class<? extends Servlet> 
servletClass) {
+        return delegate.addServlet(servletName, servletClass);
+    }
+
+    @Override
+    public <T extends Servlet> T createServlet(Class<T> clazz) throws 
ServletException {
+        return delegate.createServlet(clazz);
+    }
+
+    @Override
+    public ServletRegistration getServletRegistration(String servletName) {
+        return delegate.getServletRegistration(servletName);
+    }
+
+    @Override
+    public Map<String, ? extends ServletRegistration> 
getServletRegistrations() {
+        return delegate.getServletRegistrations();
+    }
+
+    @Override
+    public javax.servlet.FilterRegistration.Dynamic addFilter(String 
filterName, String className) {
+        return delegate.addFilter(filterName, className);
+    }
+
+    @Override
+    public javax.servlet.FilterRegistration.Dynamic addFilter(String 
filterName, Filter filter) {
+        return delegate.addFilter(filterName, filter);
+    }
+
+    @Override
+    public javax.servlet.FilterRegistration.Dynamic addFilter(String 
filterName, Class<? extends Filter> filterClass) {
+        return delegate.addFilter(filterName, filterClass);
+    }
+
+    @Override
+    public <T extends Filter> T createFilter(Class<T> clazz) throws 
ServletException {
+        return delegate.createFilter(clazz);
+    }
+
+    @Override
+    public FilterRegistration getFilterRegistration(String filterName) {
+        return delegate.getFilterRegistration(filterName);
+    }
+
+    @Override
+    public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+        return delegate.getFilterRegistrations();
+    }
+
+    @Override
+    public SessionCookieConfig getSessionCookieConfig() {
+        return delegate.getSessionCookieConfig();
+    }
+
+    @Override
+    public void setSessionTrackingModes(Set<SessionTrackingMode> 
sessionTrackingModes) {
+        delegate.setSessionTrackingModes(sessionTrackingModes);
+    }
+
+    @Override
+    public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+        return delegate.getDefaultSessionTrackingModes();
+    }
+
+    @Override
+    public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+        return delegate.getEffectiveSessionTrackingModes();
+    }
+
+    @Override
+    public void addListener(String className) {
+        delegate.addListener(className);
+    }
+
+    @Override
+    public <T extends EventListener> void addListener(T t) {
+        delegate.addListener(t);
+    }
+
+    @Override
+    public void addListener(Class<? extends EventListener> listenerClass) {
+        delegate.addListener(listenerClass);
+    }
+
+    @Override
+    public <T extends EventListener> T createListener(Class<T> clazz) throws 
ServletException {
+        return delegate.createListener(clazz);
+    }
+
+    @Override
+    public JspConfigDescriptor getJspConfigDescriptor() {
+        return delegate.getJspConfigDescriptor();
+    }
+
+    @Override
+    public ClassLoader getClassLoader() {
+        return delegate.getClassLoader();
+    }
+
+    @Override
+    public void declareRoles(String... roleNames) {
+        delegate.declareRoles(roleNames);
+    }
+
+    @Override
+    public String getVirtualServerName() {
+        return delegate.getVirtualServerName();
+    }
+
     private final PageContext pageContext;
-    
+
     public ExternalServletContextWrapper(ServletContext sc, PageContext 
pageContext) {
         this.delegate = sc;
         this.pageContext = pageContext;
     }
 
+    @Override
     public ServletContext getContext(String s) {
         return delegate.getContext(s);
     }
 
+    @Override
     public String getContextPath() {
         return delegate.getContextPath();
     }
 
+    @Override
     public int getMajorVersion() {
         return delegate.getMajorVersion();
     }
 
+    @Override
     public int getMinorVersion() {
         return delegate.getMinorVersion();
     }
 
+    @Override
     public String getMimeType(String s) {
         return delegate.getMimeType(s);
     }
 
-    public Set getResourcePaths(String s) {
+    @Override
+    public Set<String> getResourcePaths(String s) {
         return delegate.getResourcePaths(s);
     }
 
+    @Override
     public URL getResource(String s) throws MalformedURLException {
         return delegate.getResource(s);
     }
 
+    @Override
     public InputStream getResourceAsStream(String s) {
         return delegate.getResourceAsStream(s);
     }
 
+    @Override
     public RequestDispatcher getRequestDispatcher(String s) {
         return new RequestDispatcherWrapper(delegate.getRequestDispatcher(s));
     }
 
+    @Override
     public RequestDispatcher getNamedDispatcher(String s) {
         return new RequestDispatcherWrapper(delegate.getNamedDispatcher(s));
     }
 
+    @Override
     public Servlet getServlet(String s) throws ServletException {
         return delegate.getServlet(s);
     }
 
-    public Enumeration getServlets() {
+    @Override
+    public Enumeration<Servlet> getServlets() {
         return delegate.getServlets();
     }
 
-    public Enumeration getServletNames() {
+    @Override
+    public Enumeration<String> getServletNames() {
         return delegate.getServletNames();
     }
 
+    @Override
     public void log(String s) {
         delegate.log(s);
     }
 
+    @Override
     public void log(Exception exception, String s) {
         delegate.log(exception, s);
     }
 
+    @Override
     public void log(String s, Throwable throwable) {
         delegate.log(s, throwable);
     }
 
+    @Override
     public String getRealPath(String s) {
         return delegate.getRealPath(s);
     }
 
+    @Override
     public String getServerInfo() {
         return delegate.getServerInfo();
     }
 
+    @Override
     public String getInitParameter(String s) {
         return delegate.getInitParameter(s);
     }
 
-    public Enumeration getInitParameterNames() {
+    @Override
+    public Enumeration<String> getInitParameterNames() {
         return delegate.getInitParameterNames();
     }
 
+    @Override
     public Object getAttribute(String s) {
         return delegate.getAttribute(s);
     }
 
-    public Enumeration getAttributeNames() {
+    @Override
+    public Enumeration<String> getAttributeNames() {
         return delegate.getAttributeNames();
     }
 
+    @Override
     public void setAttribute(String s, Object obj) {
         delegate.setAttribute(s, obj);
     }
 
+    @Override
     public void removeAttribute(String s) {
         delegate.removeAttribute(s);
     }
 
+    @Override
     public String getServletContextName() {
         return delegate.getServletContextName();
     }
 
     class RequestDispatcherWrapper implements RequestDispatcher {
-        
+
         private final RequestDispatcher delegate;
-        
+
         public RequestDispatcherWrapper(RequestDispatcher rd) {
             this.delegate = rd;
         }
 
+        @Override
         public void forward(ServletRequest request, ServletResponse response) 
throws ServletException,
                 IOException {
             JspFactory jspFactory = JspFactory.getDefaultFactory();
@@ -170,6 +341,7 @@ class ExternalServletContextWrapper impl
             }
         }
 
+        @Override
         public void include(ServletRequest request, ServletResponse response) 
throws ServletException,
                 IOException {
             JspFactory jspFactory = JspFactory.getDefaultFactory();

Modified: 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/InternalServletConfigWrapper.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/InternalServletConfigWrapper.java?rev=1765239&r1=1765238&r2=1765239&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/InternalServletConfigWrapper.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/InternalServletConfigWrapper.java
 Mon Oct 17 11:08:10 2016
@@ -5,9 +5,9 @@
  * licenses this file to You under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -20,13 +20,22 @@ import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.Map;
 import java.util.Set;
 
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+import javax.servlet.ServletRegistration.Dynamic;
+import javax.servlet.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
 import javax.servlet.jsp.PageContext;
 
 /**
@@ -34,40 +43,181 @@ import javax.servlet.jsp.PageContext;
  * for other servlet contexts.
  */
 class InternalServletConfigWrapper implements ServletConfig {
-    
+
     private final ServletConfig delegate;
-    
+
     private final PageContext pageContext;
-    
+
     public InternalServletConfigWrapper(ServletConfig sc, PageContext 
pageContext) {
         this.delegate = sc;
         this.pageContext = pageContext;
     }
 
+    @Override
     public String getServletName() {
         return delegate.getServletName();
     }
 
+    @Override
     public ServletContext getServletContext() {
         return new InternalServletContextWrapper(delegate.getServletContext());
     }
 
+    @Override
     public String getInitParameter(String s) {
         return delegate.getInitParameter(s);
     }
 
+    @Override
     public Enumeration getInitParameterNames() {
         return delegate.getInitParameterNames();
     }
-    
+
     class InternalServletContextWrapper implements ServletContext {
-        
+
         private final ServletContext delegate;
-        
+
+        @Override
+        public int getEffectiveMajorVersion() {
+            return delegate.getEffectiveMajorVersion();
+        }
+
+        @Override
+        public int getEffectiveMinorVersion() {
+            return delegate.getEffectiveMinorVersion();
+        }
+
+        @Override
+        public boolean setInitParameter(String name, String value) {
+            return delegate.setInitParameter(name, value);
+        }
+
+        @Override
+        public Dynamic addServlet(String servletName, String className) {
+            return delegate.addServlet(servletName, className);
+        }
+
+        @Override
+        public Dynamic addServlet(String servletName, Servlet servlet) {
+            return delegate.addServlet(servletName, servlet);
+        }
+
+        @Override
+        public Dynamic addServlet(String servletName, Class<? extends Servlet> 
servletClass) {
+            return delegate.addServlet(servletName, servletClass);
+        }
+
+        @Override
+        public <T extends Servlet> T createServlet(Class<T> clazz) throws 
ServletException {
+            return delegate.createServlet(clazz);
+        }
+
+        @Override
+        public ServletRegistration getServletRegistration(String servletName) {
+            return delegate.getServletRegistration(servletName);
+        }
+
+        @Override
+        public Map<String, ? extends ServletRegistration> 
getServletRegistrations() {
+            return delegate.getServletRegistrations();
+        }
+
+        @Override
+        public javax.servlet.FilterRegistration.Dynamic addFilter(String 
filterName, String className) {
+            return delegate.addFilter(filterName, className);
+        }
+
+        @Override
+        public javax.servlet.FilterRegistration.Dynamic addFilter(String 
filterName, Filter filter) {
+            return delegate.addFilter(filterName, filter);
+        }
+
+        @Override
+        public javax.servlet.FilterRegistration.Dynamic addFilter(String 
filterName,
+                Class<? extends Filter> filterClass) {
+            return delegate.addFilter(filterName, filterClass);
+        }
+
+        @Override
+        public <T extends Filter> T createFilter(Class<T> clazz) throws 
ServletException {
+            return delegate.createFilter(clazz);
+        }
+
+        @Override
+        public FilterRegistration getFilterRegistration(String filterName) {
+            return delegate.getFilterRegistration(filterName);
+        }
+
+        @Override
+        public Map<String, ? extends FilterRegistration> 
getFilterRegistrations() {
+            return delegate.getFilterRegistrations();
+        }
+
+        @Override
+        public SessionCookieConfig getSessionCookieConfig() {
+            return delegate.getSessionCookieConfig();
+        }
+
+        @Override
+        public void setSessionTrackingModes(Set<SessionTrackingMode> 
sessionTrackingModes) {
+            delegate.setSessionTrackingModes(sessionTrackingModes);
+        }
+
+        @Override
+        public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+            return delegate.getDefaultSessionTrackingModes();
+        }
+
+        @Override
+        public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+            return delegate.getEffectiveSessionTrackingModes();
+        }
+
+        @Override
+        public void addListener(String className) {
+            delegate.addListener(className);
+        }
+
+        @Override
+        public <T extends EventListener> void addListener(T t) {
+            delegate.addListener(t);
+        }
+
+        @Override
+        public void addListener(Class<? extends EventListener> listenerClass) {
+            delegate.addListener(listenerClass);
+        }
+
+        @Override
+        public <T extends EventListener> T createListener(Class<T> clazz) 
throws ServletException {
+            return delegate.createListener(clazz);
+        }
+
+        @Override
+        public JspConfigDescriptor getJspConfigDescriptor() {
+            return delegate.getJspConfigDescriptor();
+        }
+
+        @Override
+        public ClassLoader getClassLoader() {
+            return delegate.getClassLoader();
+        }
+
+        @Override
+        public void declareRoles(String... roleNames) {
+            delegate.declareRoles(roleNames);
+        }
+
+        @Override
+        public String getVirtualServerName() {
+            return delegate.getVirtualServerName();
+        }
+
         public InternalServletContextWrapper(ServletContext sc) {
             this.delegate = sc;
         }
 
+        @Override
         public ServletContext getContext(String s) {
             ServletContext sc = delegate.getContext(s);
             if (sc == delegate) {
@@ -77,105 +227,129 @@ class InternalServletConfigWrapper imple
             }
         }
 
+        @Override
         public String getContextPath() {
             return delegate.getContextPath();
         }
 
+        @Override
         public int getMajorVersion() {
             return delegate.getMajorVersion();
         }
 
+        @Override
         public int getMinorVersion() {
             return delegate.getMinorVersion();
         }
 
+        @Override
         public String getMimeType(String s) {
             return delegate.getMimeType(s);
         }
 
-        public Set getResourcePaths(String s) {
+        @Override
+        public Set<String> getResourcePaths(String s) {
             return delegate.getResourcePaths(s);
         }
 
+        @Override
         public URL getResource(String s) throws MalformedURLException {
             return delegate.getResource(s);
         }
 
+        @Override
         public InputStream getResourceAsStream(String s) {
             return delegate.getResourceAsStream(s);
         }
 
+        @Override
         public RequestDispatcher getRequestDispatcher(String s) {
             return delegate.getRequestDispatcher(s);
         }
 
+        @Override
         public RequestDispatcher getNamedDispatcher(String s) {
             return delegate.getNamedDispatcher(s);
         }
 
+        @Override
         public Servlet getServlet(String s) throws ServletException {
             return delegate.getServlet(s);
         }
 
-        public Enumeration getServlets() {
+        @Override
+        public Enumeration<Servlet> getServlets() {
             return delegate.getServlets();
         }
 
-        public Enumeration getServletNames() {
+        @Override
+        public Enumeration<String> getServletNames() {
             return delegate.getServletNames();
         }
 
+        @Override
         public void log(String s) {
             delegate.log(s);
         }
 
+        @Override
         public void log(Exception exception, String s) {
             delegate.log(exception, s);
         }
 
+        @Override
         public void log(String s, Throwable throwable) {
             delegate.log(s, throwable);
         }
 
+        @Override
         public String getRealPath(String s) {
             return delegate.getRealPath(s);
         }
 
+        @Override
         public String getServerInfo() {
             return delegate.getServerInfo();
         }
 
+        @Override
         public String getInitParameter(String s) {
             return delegate.getInitParameter(s);
         }
 
-        public Enumeration getInitParameterNames() {
+        @Override
+        public Enumeration<String> getInitParameterNames() {
             return delegate.getInitParameterNames();
         }
 
+        @Override
         public Object getAttribute(String s) {
             return delegate.getAttribute(s);
         }
 
-        public Enumeration getAttributeNames() {
+        @Override
+        public Enumeration<String> getAttributeNames() {
             return delegate.getAttributeNames();
         }
 
+        @Override
         public void setAttribute(String s, Object obj) {
             delegate.setAttribute(s, obj);
         }
 
+        @Override
         public void removeAttribute(String s) {
             delegate.removeAttribute(s);
         }
 
+        @Override
         public String getServletContextName() {
             return delegate.getServletContextName();
         }
-        
-        
+
+
     }
-    
-    
+
+
 
 }

Modified: 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/tagplugins/jstl/Util.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/tagplugins/jstl/Util.java?rev=1765239&r1=1765238&r2=1765239&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/tagplugins/jstl/Util.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/tagplugins/jstl/Util.java
 Mon Oct 17 11:08:10 2016
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,8 +18,6 @@
 
 package org.apache.sling.scripting.jsp.jasper.tagplugins.jstl;
 
-import org.apache.sling.scripting.jsp.jasper.Constants;
-
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -28,6 +26,7 @@ import java.io.UnsupportedEncodingExcept
 import java.util.Locale;
 
 import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponseWrapper;
@@ -35,23 +34,25 @@ import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.JspTagException;
 import javax.servlet.jsp.PageContext;
 
+import org.apache.sling.scripting.jsp.jasper.Constants;
+
 /**
  * Util contains some often used consts, static methods and embedded class
  * to support the JSTL tag plugin.
  */
 
 public class Util {
-    
-    public static final String VALID_SCHEME_CHAR = 
+
+    public static final String VALID_SCHEME_CHAR =
         "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+.-";
-    
-    public static final String DEFAULT_ENCODING = 
+
+    public static final String DEFAULT_ENCODING =
         "ISO-8859-1";
-    
+
     public static final int HIGHEST_SPECIAL = '>';
-    
+
     public static char[][] specialCharactersRepresentation = new 
char[HIGHEST_SPECIAL + 1][];
-    
+
     static {
         specialCharactersRepresentation['&'] = "&amp;".toCharArray();
         specialCharactersRepresentation['<'] = "&lt;".toCharArray();
@@ -59,7 +60,7 @@ public class Util {
         specialCharactersRepresentation['"'] = "&#034;".toCharArray();
         specialCharactersRepresentation['\''] = "&#039;".toCharArray();
     }
-    
+
     /**
      * Converts the given string description of a scope to the corresponding
      * PageContext constant.
@@ -70,12 +71,12 @@ public class Util {
      * @param scope String description of scope
      *
      * @return PageContext constant corresponding to given scope description
-     * 
-     * taken from org.apache.taglibs.standard.tag.common.core.Util  
+     *
+     * taken from org.apache.taglibs.standard.tag.common.core.Util
      */
     public static int getScope(String scope){
         int ret = PageContext.PAGE_SCOPE;
-        
+
         if("request".equalsIgnoreCase(scope)){
             ret = PageContext.REQUEST_SCOPE;
         }else if("session".equalsIgnoreCase(scope)){
@@ -83,10 +84,10 @@ public class Util {
         }else if("application".equalsIgnoreCase(scope)){
             ret = PageContext.APPLICATION_SCOPE;
         }
-        
+
         return ret;
     }
-    
+
     /**
      * Returns <tt>true</tt> if our current URL is absolute,
      * <tt>false</tt> otherwise.
@@ -96,21 +97,21 @@ public class Util {
         if(url == null){
             return false;
         }
-        
+
         int colonPos = url.indexOf(":");
         if(colonPos == -1){
             return false;
         }
-        
+
         for(int i=0;i<colonPos;i++){
             if(VALID_SCHEME_CHAR.indexOf(url.charAt(i)) == -1){
                 return false;
             }
         }
-        
+
         return true;
     }
-    
+
     /**
      * Get the value associated with a content-type attribute.
      * Syntax defined in RFC 2045, section 5.1.
@@ -126,7 +127,7 @@ public class Util {
         if (index == -1) return null;
         index += 1; // positioned after the '='
         input = input.substring(index).trim();
-        
+
         if (input.charAt(0) == '"') {
             // attribute value is a quoted string
             begin = 1;
@@ -140,13 +141,13 @@ public class Util {
         }
         return input.substring(begin, end).trim();
     }
-    
+
     /**
      * Strips a servlet session ID from <tt>url</tt>.  The session ID
      * is encoded as a URL "path parameter" beginning with "jsessionid=".
      * We thus remove anything we find between ";jsessionid=" (inclusive)
      * and either EOS or a subsequent ';' (exclusive).
-     * 
+     *
      * taken from org.apache.taglibs.standard.tag.common.core.ImportSupport
      */
     public static String stripSession(String url) {
@@ -162,8 +163,8 @@ public class Util {
         }
         return u.toString();
     }
-    
-    
+
+
     /**
      * Performs the following substring replacements
      * (to facilitate output to XML/HTML pages):
@@ -175,7 +176,7 @@ public class Util {
      *    ' -> &#039;
      *
      * See also OutSupport.writeEscapedXml().
-     * 
+     *
      * taken from org.apache.taglibs.standard.tag.common.core.Util
      */
     public static String escapeXml(String buffer) {
@@ -183,7 +184,7 @@ public class Util {
         int length = buffer.length();
         char[] arrayBuffer = buffer.toCharArray();
         StringBuffer escapedBuffer = null;
-        
+
         for (int i = 0; i < length; i++) {
             char c = arrayBuffer[i];
             if (c <= HIGHEST_SPECIAL) {
@@ -213,7 +214,7 @@ public class Util {
         }
         return escapedBuffer.toString();
     }
-    
+
     /** Utility methods
      * taken from org.apache.taglibs.standard.tag.common.core.UrlSupport
      */
@@ -223,7 +224,7 @@ public class Util {
         // don't touch absolute URLs
         if (isAbsoluteUrl(url))
             return url;
-        
+
         // normalize relative URLs against a context root
         HttpServletRequest request =
             (HttpServletRequest) pageContext.getRequest();
@@ -247,29 +248,41 @@ public class Util {
             }
         }
     }
-    
-    /** Wraps responses to allow us to retrieve results as Strings. 
-     * mainly taken from 
org.apache.taglibs.standard.tag.common.core.importSupport 
+
+    /** Wraps responses to allow us to retrieve results as Strings.
+     * mainly taken from 
org.apache.taglibs.standard.tag.common.core.importSupport
      */
     public static class ImportResponseWrapper extends 
HttpServletResponseWrapper{
-        
+
         private StringWriter sw = new StringWriter();
         private ByteArrayOutputStream bos = new ByteArrayOutputStream();
         private ServletOutputStream sos = new ServletOutputStream() {
+            @Override
             public void write(int b) throws IOException {
                 bos.write(b);
             }
+
+            @Override
+            public boolean isReady() {
+                return true;
+            }
+
+            @Override
+            public void setWriteListener(WriteListener writeListener) {
+                // ignore
+            }
         };
         private boolean isWriterUsed;
         private boolean isStreamUsed;
         private int status = 200;
         private String charEncoding;
-        
+
         public ImportResponseWrapper(HttpServletResponse arg0) {
             super(arg0);
             // TODO Auto-generated constructor stub
         }
-        
+
+        @Override
         public PrintWriter getWriter() {
             if (isStreamUsed)
                 throw new IllegalStateException("Unexpected internal error 
during &lt;import&gt: " +
@@ -277,7 +290,8 @@ public class Util {
             isWriterUsed = true;
             return new PrintWriter(sw);
         }
-        
+
+        @Override
         public ServletOutputStream getOutputStream() {
             if (isWriterUsed)
                 throw new IllegalStateException("Unexpected internal error 
during &lt;import&gt: " +
@@ -285,33 +299,37 @@ public class Util {
             isStreamUsed = true;
             return sos;
         }
-        
+
         /** Has no effect. */
+        @Override
         public void setContentType(String x) {
             // ignore
         }
-        
+
         /** Has no effect. */
+        @Override
         public void setLocale(Locale x) {
             // ignore
         }
-        
+
+        @Override
         public void setStatus(int status) {
             this.status = status;
         }
-        
+
+        @Override
         public int getStatus() {
             return status;
         }
-        
+
         public String getCharEncoding(){
             return this.charEncoding;
         }
-        
+
         public void setCharEncoding(String ce){
             this.charEncoding = ce;
         }
-        
+
         public String getString() throws UnsupportedEncodingException {
             if (isWriterUsed)
                 return sw.toString();
@@ -324,5 +342,5 @@ public class Util {
                 return "";             // target didn't write anything
         }
     }
-    
+
 }



Reply via email to