Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6222B1044A for ; Sun, 1 Feb 2015 11:47:18 +0000 (UTC) Received: (qmail 7628 invoked by uid 500); 1 Feb 2015 11:47:19 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 7580 invoked by uid 500); 1 Feb 2015 11:47:19 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 7570 invoked by uid 99); 1 Feb 2015 11:47:19 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Feb 2015 11:47:19 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id D0AECAC0043; Sun, 1 Feb 2015 11:47:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1656284 - in /felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard: ContextHandler.java SharedServletContextImpl.java Date: Sun, 01 Feb 2015 11:47:18 -0000 To: commits@felix.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150201114718.D0AECAC0043@hades.apache.org> Author: cziegeler Date: Sun Feb 1 11:47:18 2015 New Revision: 1656284 URL: http://svn.apache.org/r1656284 Log: FELIX-4545 : Implement Servlet Context Helper, more refactoring, add support for ServletContextListener services Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ContextHandler.java felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/SharedServletContextImpl.java Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ContextHandler.java URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ContextHandler.java?rev=1656284&r1=1656283&r2=1656284&view=diff ============================================================================== --- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ContextHandler.java (original) +++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ContextHandler.java Sun Feb 1 11:47:18 2015 @@ -51,7 +51,7 @@ public final class ContextHandler implem public ContextHandler(final ContextInfo info, final ServletContext webContext) { this.info = info; - this.sharedContext = new SharedServletContextImpl(webContext); + this.sharedContext = new SharedServletContextImpl(webContext, info.getPrefix(), info.getName()); } /** Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/SharedServletContextImpl.java URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/SharedServletContextImpl.java?rev=1656284&r1=1656283&r2=1656284&view=diff ============================================================================== --- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/SharedServletContextImpl.java (original) +++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/SharedServletContextImpl.java Sun Feb 1 11:47:18 2015 @@ -50,10 +50,23 @@ public class SharedServletContextImpl im private final ServletContext context; private final Map attributes = new ConcurrentHashMap(); + private final String contextPath; + private final String name; - public SharedServletContextImpl(final ServletContext webContext) + public SharedServletContextImpl(final ServletContext webContext, + final String name, + final String prefix) { this.context = webContext; + if ( prefix == null ) + { + this.contextPath = webContext.getContextPath(); + } + else + { + this.contextPath = webContext.getContextPath() + prefix; + } + this.name = name; } @Override @@ -95,79 +108,79 @@ public class SharedServletContextImpl im } @Override - public FilterRegistration.Dynamic addFilter(String filterName, Class type) + public FilterRegistration.Dynamic addFilter(final String filterName, final Class type) { throw new UnsupportedOperationException(); } @Override - public FilterRegistration.Dynamic addFilter(String filterName, Filter filter) + public FilterRegistration.Dynamic addFilter(final String filterName, final Filter filter) { throw new UnsupportedOperationException(); } @Override - public FilterRegistration.Dynamic addFilter(String filterName, String className) + public FilterRegistration.Dynamic addFilter(final String filterName, final String className) { throw new UnsupportedOperationException(); } @Override - public void addListener(Class type) + public void addListener(final Class type) { throw new UnsupportedOperationException(); } @Override - public void addListener(String className) + public void addListener(final String className) { throw new UnsupportedOperationException(); } @Override - public void addListener(T listener) + public void addListener(final T listener) { throw new UnsupportedOperationException(); } @Override - public ServletRegistration.Dynamic addServlet(String servletName, Class type) + public ServletRegistration.Dynamic addServlet(final String servletName, final Class type) { throw new UnsupportedOperationException(); } @Override - public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) + public ServletRegistration.Dynamic addServlet(final String servletName, final Servlet servlet) { throw new UnsupportedOperationException(); } @Override - public ServletRegistration.Dynamic addServlet(String servletName, String className) + public ServletRegistration.Dynamic addServlet(final String servletName, final String className) { throw new UnsupportedOperationException(); } @Override - public T createFilter(Class type) throws ServletException + public T createFilter(final Class type) throws ServletException { throw new UnsupportedOperationException(); } @Override - public T createListener(Class type) throws ServletException + public T createListener(final Class type) throws ServletException { throw new UnsupportedOperationException(); } @Override - public T createServlet(Class type) throws ServletException + public T createServlet(final Class type) throws ServletException { throw new UnsupportedOperationException(); } @Override - public void declareRoles(String... roleNames) + public void declareRoles(final String... roleNames) { this.context.declareRoles(roleNames); } @@ -178,7 +191,7 @@ public class SharedServletContextImpl im } @Override - public Object getAttribute(String name) + public Object getAttribute(final String name) { return this.attributes.get(name); } @@ -190,17 +203,15 @@ public class SharedServletContextImpl im } @Override - public ServletContext getContext(String uri) + public ServletContext getContext(final String uri) { - // TODO return this.context.getContext(uri); } @Override public String getContextPath() { - // TODO - return this.context.getContextPath(); + return this.contextPath; } @Override @@ -228,7 +239,7 @@ public class SharedServletContextImpl im } @Override - public FilterRegistration getFilterRegistration(String filterName) + public FilterRegistration getFilterRegistration(final String filterName) { return this.context.getFilterRegistration(filterName); } @@ -240,21 +251,23 @@ public class SharedServletContextImpl im } @Override - public String getInitParameter(String name) + public String getInitParameter(final String name) { + // TODO return this.context.getInitParameter(name); } @Override public Enumeration getInitParameterNames() { + // TODO return this.context.getInitParameterNames(); } @Override public JspConfigDescriptor getJspConfigDescriptor() { - throw new UnsupportedOperationException(); + return null; } @Override @@ -270,19 +283,21 @@ public class SharedServletContextImpl im } @Override - public RequestDispatcher getNamedDispatcher(String name) + public RequestDispatcher getNamedDispatcher(final String name) { + // TODO return this.context.getNamedDispatcher(name); } @Override - public RequestDispatcher getRequestDispatcher(String uri) + public RequestDispatcher getRequestDispatcher(final String uri) { + // TODO return this.context.getRequestDispatcher(uri); } @Override - public InputStream getResourceAsStream(String path) + public InputStream getResourceAsStream(final String path) { final URL res = getResource(path); if (res != null) @@ -306,7 +321,7 @@ public class SharedServletContextImpl im } @Override - public Servlet getServlet(String name) throws ServletException + public Servlet getServlet(final String name) throws ServletException { return this.context.getServlet(name); } @@ -314,7 +329,7 @@ public class SharedServletContextImpl im @Override public String getServletContextName() { - return this.context.getServletContextName(); + return this.name; } @Override @@ -324,7 +339,7 @@ public class SharedServletContextImpl im } @Override - public ServletRegistration getServletRegistration(String servletName) + public ServletRegistration getServletRegistration(final String servletName) { return this.context.getServletRegistration(servletName); } @@ -344,29 +359,30 @@ public class SharedServletContextImpl im @Override public SessionCookieConfig getSessionCookieConfig() { + // TODO return this.context.getSessionCookieConfig(); } @Override - public void log(Exception cause, String message) + public void log(final Exception cause, final String message) { SystemLogger.error(message, cause); } @Override - public void log(String message) + public void log(final String message) { SystemLogger.info(message); } @Override - public void log(String message, Throwable cause) + public void log(final String message, final Throwable cause) { SystemLogger.error(message, cause); } @Override - public void removeAttribute(String name) + public void removeAttribute(final String name) { Object oldValue = this.attributes.remove(name); @@ -377,7 +393,7 @@ public class SharedServletContextImpl im } @Override - public void setAttribute(String name, Object value) + public void setAttribute(final String name, final Object value) { if (value == null) { @@ -399,14 +415,14 @@ public class SharedServletContextImpl im } @Override - public boolean setInitParameter(String name, String value) + public boolean setInitParameter(final String name, final String value) { - return this.context.setInitParameter(name, value); + throw new IllegalStateException(); } @Override - public void setSessionTrackingModes(Set modes) + public void setSessionTrackingModes(final Set modes) { - this.context.setSessionTrackingModes(modes); + throw new IllegalStateException(); } }