Author: fmeschbe Date: Mon Jan 24 15:31:45 2011 New Revision: 1062830 URL: http://svn.apache.org/viewvc?rev=1062830&view=rev Log: FELIX-2788 Allow for the configuration of shared ServletContext attributes. Currently configuration is static using a framework property -- org.apache.felix.http.shared_servlet_context_attributes -- which when set to true causes servlet context attributes to be shared amongst all servlet contexts as well as the servlet container's servlet context.
Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/HttpServiceController.java felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/context/ServletContextImpl.java felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/context/ServletContextManager.java felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceFactory.java felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/context/ServletContextImplTest.java felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/context/ServletContextManagerTest.java Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/HttpServiceController.java URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/HttpServiceController.java?rev=1062830&r1=1062829&r2=1062830&view=diff ============================================================================== --- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/HttpServiceController.java (original) +++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/HttpServiceController.java Mon Jan 24 15:31:45 2011 @@ -35,6 +35,26 @@ import org.osgi.service.http.HttpService public final class HttpServiceController { + /** + * Name of the Framework property indicating whether the servlet context + * attributes of the ServletContext objects created for each HttpContext + * used to register servlets and resources share their attributes or not. + * By default (if this property is not specified or it's value is not + * <code>true</code> (case-insensitive)) servlet context attributes are not + * shared. To have servlet context attributes shared amongst servlet context + * and also with the ServletContext provided by the servlet container ensure + * setting the property as follows: + * <pre> + * org.apache.felix.http.shared_servlet_context_attributes = true + * </pre> + * <p> + * <b>WARNING:</b> Only set this property if absolutely needed (for example + * you implement an HttpSessionListener and want to access servlet context + * attributes of the ServletContext to which the HttpSession is linked). + * Otherwise leave this property unset. + */ + private static final String FELIX_HTTP_SHARED_SERVLET_CONTEXT_ATTRIBUTES = "org.apache.felix.http.shared_servlet_context_attributes"; + private final BundleContext bundleContext; private final HandlerRegistry registry; private final Dispatcher dispatcher; @@ -44,6 +64,7 @@ public final class HttpServiceController private final ServletRequestAttributeListenerManager requestAttributeListener; private final HttpSessionListenerManager sessionListener; private final HttpSessionAttributeListenerManager sessionAttributeListener; + private final boolean sharedContextAttributes; private ServiceRegistration serviceReg; public HttpServiceController(BundleContext bundleContext) @@ -57,6 +78,7 @@ public final class HttpServiceController this.requestAttributeListener = new ServletRequestAttributeListenerManager(bundleContext); this.sessionListener = new HttpSessionListenerManager(bundleContext); this.sessionAttributeListener = new HttpSessionAttributeListenerManager(bundleContext); + this.sharedContextAttributes = getBoolean(FELIX_HTTP_SHARED_SERVLET_CONTEXT_ATTRIBUTES); } public Dispatcher getDispatcher() @@ -107,7 +129,8 @@ public final class HttpServiceController this.sessionListener.open(); this.sessionAttributeListener.open(); - HttpServiceFactory factory = new HttpServiceFactory(servletContext, this.registry, this.contextAttributeListener); + HttpServiceFactory factory = new HttpServiceFactory(servletContext, this.registry, + this.contextAttributeListener, this.sharedContextAttributes); String[] ifaces = new String[] { HttpService.class.getName(), ExtHttpService.class.getName() }; this.serviceReg = this.bundleContext.registerService(ifaces, factory, this.serviceProps); } @@ -131,4 +154,10 @@ public final class HttpServiceController this.serviceReg = null; } } + + private boolean getBoolean(final String property) + { + String prop = this.bundleContext.getProperty(property); + return (prop != null) ? Boolean.valueOf(prop).booleanValue() : false; + } } Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/context/ServletContextImpl.java URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/context/ServletContextImpl.java?rev=1062830&r1=1062829&r2=1062830&view=diff ============================================================================== --- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/context/ServletContextImpl.java (original) +++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/context/ServletContextImpl.java Mon Jan 24 15:31:45 2011 @@ -50,13 +50,13 @@ public final class ServletContextImpl private final ServletContextAttributeListener attributeListener; public ServletContextImpl(Bundle bundle, ServletContext context, HttpContext httpContext, - ServletContextAttributeListener attributeListener) + ServletContextAttributeListener attributeListener, boolean sharedAttributes) { this.bundle = bundle; this.context = context; this.httpContext = httpContext; - this.attributes = new ConcurrentHashMap<String, Object>(); this.attributeListener = attributeListener; + this.attributes = sharedAttributes ? null : new ConcurrentHashMap<String, Object>(); } public String getContextPath() @@ -149,12 +149,13 @@ public final class ServletContextImpl public Object getAttribute(String name) { - return this.attributes.get(name); + return (this.attributes != null) ? this.attributes.get(name) : this.context.getAttribute(name); } public Enumeration getAttributeNames() { - return Collections.enumeration(this.attributes.keySet()); + return (this.attributes != null) ? Collections.enumeration(this.attributes.keySet()) : this.context + .getAttributeNames(); } public void setAttribute(String name, Object value) @@ -165,7 +166,17 @@ public final class ServletContextImpl } else if (name != null) { - Object oldValue = this.attributes.put(name, value); + Object oldValue; + if (this.attributes != null) + { + oldValue = this.attributes.put(name, value); + } + else + { + oldValue = this.context.getAttribute(name); + this.context.setAttribute(name, value); + } + if (oldValue == null) { attributeListener.attributeAdded(new ServletContextAttributeEvent(this, name, value)); @@ -179,7 +190,17 @@ public final class ServletContextImpl public void removeAttribute(String name) { - Object oldValue = this.attributes.remove(name); + Object oldValue; + if (this.attributes != null) + { + oldValue = this.attributes.remove(name); + } + else + { + oldValue = this.context.getAttribute(name); + this.context.removeAttribute(name); + } + if (oldValue != null) { attributeListener.attributeRemoved(new ServletContextAttributeEvent(this, name, oldValue)); Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/context/ServletContextManager.java URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/context/ServletContextManager.java?rev=1062830&r1=1062829&r2=1062830&view=diff ============================================================================== --- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/context/ServletContextManager.java (original) +++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/context/ServletContextManager.java Mon Jan 24 15:31:45 2011 @@ -31,14 +31,16 @@ public final class ServletContextManager private final ServletContext context; private final ServletContextAttributeListener attributeListener; private final Map<HttpContext, ExtServletContext> contextMap; + private final boolean sharedAttributes; public ServletContextManager(Bundle bundle, ServletContext context, - ServletContextAttributeListener attributeListener) + ServletContextAttributeListener attributeListener, boolean sharedAttributes) { this.bundle = bundle; this.context = context; this.attributeListener = attributeListener; this.contextMap = new HashMap<HttpContext, ExtServletContext>(); + this.sharedAttributes = sharedAttributes; } public ExtServletContext getServletContext(HttpContext httpContext) @@ -55,7 +57,8 @@ public final class ServletContextManager private ExtServletContext addServletContext(HttpContext httpContext) { - ExtServletContext context = new ServletContextImpl(this.bundle, this.context, httpContext, attributeListener); + ExtServletContext context = new ServletContextImpl(this.bundle, this.context, httpContext, attributeListener, + sharedAttributes); this.contextMap.put(httpContext, context); return context; } Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceFactory.java URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceFactory.java?rev=1062830&r1=1062829&r2=1062830&view=diff ============================================================================== --- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceFactory.java (original) +++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceFactory.java Mon Jan 24 15:31:45 2011 @@ -30,18 +30,21 @@ public final class HttpServiceFactory private final ServletContext context; private final ServletContextAttributeListener attributeListener; private final HandlerRegistry handlerRegistry; + private final boolean sharedContextAttributes; public HttpServiceFactory(ServletContext context, HandlerRegistry handlerRegistry, - ServletContextAttributeListener attributeListener) + ServletContextAttributeListener attributeListener, boolean sharedContextAttributes) { this.context = context; this.attributeListener = attributeListener; this.handlerRegistry = handlerRegistry; + this.sharedContextAttributes = sharedContextAttributes; } public Object getService(Bundle bundle, ServiceRegistration reg) { - return new HttpServiceImpl(bundle, this.context, this.handlerRegistry, attributeListener); + return new HttpServiceImpl(bundle, this.context, this.handlerRegistry, this.attributeListener, + this.sharedContextAttributes); } public void ungetService(Bundle bundle, ServiceRegistration reg, Object service) Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java?rev=1062830&r1=1062829&r2=1062830&view=diff ============================================================================== --- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java (original) +++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java Mon Jan 24 15:31:45 2011 @@ -39,13 +39,15 @@ public final class HttpServiceImpl private final HashSet<Filter> localFilters; private final ServletContextManager contextManager; - public HttpServiceImpl(Bundle bundle, ServletContext context, HandlerRegistry handlerRegistry, ServletContextAttributeListener servletAttributeListener) + public HttpServiceImpl(Bundle bundle, ServletContext context, HandlerRegistry handlerRegistry, + ServletContextAttributeListener servletAttributeListener, boolean sharedContextAttributes) { this.bundle = bundle; this.handlerRegistry = handlerRegistry; this.localServlets = new HashSet<Servlet>(); this.localFilters = new HashSet<Filter>(); - this.contextManager = new ServletContextManager(this.bundle, context, servletAttributeListener); + this.contextManager = new ServletContextManager(this.bundle, context, servletAttributeListener, + sharedContextAttributes); } private ExtServletContext getServletContext(HttpContext context) Modified: felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/context/ServletContextImplTest.java URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/context/ServletContextImplTest.java?rev=1062830&r1=1062829&r2=1062830&view=diff ============================================================================== --- felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/context/ServletContextImplTest.java (original) +++ felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/context/ServletContextImplTest.java Mon Jan 24 15:31:45 2011 @@ -25,10 +25,12 @@ import org.osgi.service.http.HttpContext import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.RequestDispatcher; +import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletContextAttributeEvent; import javax.servlet.ServletContextAttributeListener; - +import java.io.InputStream; import java.net.URL; import java.util.*; @@ -46,7 +48,7 @@ public class ServletContextImplTest ServletContext globalContext = Mockito.mock(ServletContext.class); this.httpContext = Mockito.mock(HttpContext.class); this.listener = new AttributeListener(); - this.context = new ServletContextImpl(this.bundle, globalContext, this.httpContext, this.listener); + this.context = new ServletContextImpl(this.bundle, globalContext, this.httpContext, this.listener, false); } @Test @@ -149,6 +151,230 @@ public class ServletContextImplTest } @Test + public void testGetSharedAttribute() + { + ServletContext globalContext = new MockServletContext(); + ServletContext ctx1 = new ServletContextImpl(bundle, globalContext, httpContext, listener, true); + ServletContext ctx2 = new ServletContextImpl(bundle, globalContext, httpContext, listener, true); + + Assert.assertNull(ctx1.getAttribute("key1")); + Assert.assertNull(ctx2.getAttribute("key1")); + Assert.assertNull(globalContext.getAttribute("key1")); + + // Operations on ctx1 and check results + + ctx1.setAttribute("key1", "value1"); + this.listener.checkAdded("key1", "value1"); + Assert.assertEquals("value1", ctx1.getAttribute("key1")); + Assert.assertEquals("value1", ctx2.getAttribute("key1")); + Assert.assertEquals("value1", globalContext.getAttribute("key1")); + + ctx1.removeAttribute("key1"); + this.listener.checkRemoved("key1", "value1"); + Assert.assertNull(ctx1.getAttribute("key1")); + Assert.assertNull(ctx2.getAttribute("key1")); + Assert.assertNull(globalContext.getAttribute("key1")); + + ctx1.setAttribute("key1", null); + this.listener.checkNull(); + Assert.assertNull(ctx1.getAttribute("key1")); + Assert.assertNull(ctx2.getAttribute("key1")); + Assert.assertNull(globalContext.getAttribute("key1")); + + ctx1.setAttribute("key1", "value1"); + this.listener.checkAdded("key1", "value1"); + Assert.assertEquals("value1", ctx1.getAttribute("key1")); + Assert.assertEquals("value1", ctx2.getAttribute("key1")); + Assert.assertEquals("value1", globalContext.getAttribute("key1")); + + ctx1.setAttribute("key1", "newValue"); + this.listener.checkReplaced("key1", "value1"); + Assert.assertEquals("newValue", ctx1.getAttribute("key1")); + Assert.assertEquals("newValue", ctx2.getAttribute("key1")); + Assert.assertEquals("newValue", globalContext.getAttribute("key1")); + + ctx1.removeAttribute("key1"); + + // Operations on ctx2 and check results + + ctx2.setAttribute("key1", "value1"); + this.listener.checkAdded("key1", "value1"); + Assert.assertEquals("value1", ctx1.getAttribute("key1")); + Assert.assertEquals("value1", ctx2.getAttribute("key1")); + Assert.assertEquals("value1", globalContext.getAttribute("key1")); + + ctx2.removeAttribute("key1"); + this.listener.checkRemoved("key1", "value1"); + Assert.assertNull(ctx1.getAttribute("key1")); + Assert.assertNull(ctx2.getAttribute("key1")); + Assert.assertNull(globalContext.getAttribute("key1")); + + ctx2.setAttribute("key1", null); + this.listener.checkNull(); + Assert.assertNull(ctx1.getAttribute("key1")); + Assert.assertNull(ctx2.getAttribute("key1")); + Assert.assertNull(globalContext.getAttribute("key1")); + + ctx2.setAttribute("key1", "value1"); + this.listener.checkAdded("key1", "value1"); + Assert.assertEquals("value1", ctx1.getAttribute("key1")); + Assert.assertEquals("value1", ctx2.getAttribute("key1")); + Assert.assertEquals("value1", globalContext.getAttribute("key1")); + + ctx2.setAttribute("key1", "newValue"); + this.listener.checkReplaced("key1", "value1"); + Assert.assertEquals("newValue", ctx1.getAttribute("key1")); + Assert.assertEquals("newValue", ctx2.getAttribute("key1")); + Assert.assertEquals("newValue", globalContext.getAttribute("key1")); + + ctx2.removeAttribute("key1"); + + // Operations on globalContext and check results + + globalContext.setAttribute("key1", "value1"); + Assert.assertEquals("value1", ctx1.getAttribute("key1")); + Assert.assertEquals("value1", ctx2.getAttribute("key1")); + Assert.assertEquals("value1", globalContext.getAttribute("key1")); + + globalContext.removeAttribute("key1"); + Assert.assertNull(ctx1.getAttribute("key1")); + Assert.assertNull(ctx2.getAttribute("key1")); + Assert.assertNull(globalContext.getAttribute("key1")); + + globalContext.setAttribute("key1", null); + Assert.assertNull(ctx1.getAttribute("key1")); + Assert.assertNull(ctx2.getAttribute("key1")); + Assert.assertNull(globalContext.getAttribute("key1")); + + globalContext.setAttribute("key1", "value1"); + Assert.assertEquals("value1", ctx1.getAttribute("key1")); + Assert.assertEquals("value1", ctx2.getAttribute("key1")); + Assert.assertEquals("value1", globalContext.getAttribute("key1")); + + globalContext.setAttribute("key1", "newValue"); + Assert.assertEquals("newValue", ctx1.getAttribute("key1")); + Assert.assertEquals("newValue", ctx2.getAttribute("key1")); + Assert.assertEquals("newValue", globalContext.getAttribute("key1")); + + globalContext.removeAttribute("key1"); + } + + @Test + public void testGetSharedAttributeNames() + { + ServletContext globalContext = new MockServletContext(); + ServletContext ctx1 = new ServletContextImpl(bundle, globalContext, httpContext, listener, true); + ServletContext ctx2 = new ServletContextImpl(bundle, globalContext, httpContext, listener, true); + + Enumeration e = ctx1.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertFalse(e.hasMoreElements()); + e = ctx2.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertFalse(e.hasMoreElements()); + e = globalContext.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertFalse(e.hasMoreElements()); + + ctx1.setAttribute("key1", "value1"); + this.listener.checkAdded("key1", "value1"); + e = ctx1.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertTrue(e.hasMoreElements()); + Assert.assertEquals("key1", e.nextElement()); + Assert.assertFalse(e.hasMoreElements()); + e = ctx2.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertTrue(e.hasMoreElements()); + Assert.assertEquals("key1", e.nextElement()); + Assert.assertFalse(e.hasMoreElements()); + e = globalContext.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertTrue(e.hasMoreElements()); + Assert.assertEquals("key1", e.nextElement()); + Assert.assertFalse(e.hasMoreElements()); + } + + + @Test + public void testGetUnsharedAttribute() + { + ServletContext globalContext = new MockServletContext(); + ServletContext ctx1 = new ServletContextImpl(bundle, globalContext, httpContext, listener, false); + ServletContext ctx2 = new ServletContextImpl(bundle, globalContext, httpContext, listener, false); + + Assert.assertNull(ctx1.getAttribute("key1")); + Assert.assertNull(ctx2.getAttribute("key1")); + Assert.assertNull(globalContext.getAttribute("key1")); + + // Operations on ctx1 and check results + + ctx2.setAttribute("key1", "ctx2_private_value"); + globalContext.setAttribute("key1", "globalContext_private_value"); + ctx1.setAttribute("key1", "value1"); + this.listener.checkAdded("key1", "value1"); + Assert.assertEquals("value1", ctx1.getAttribute("key1")); + Assert.assertEquals("ctx2_private_value", ctx2.getAttribute("key1")); + Assert.assertEquals("globalContext_private_value", globalContext.getAttribute("key1")); + + ctx1.removeAttribute("key1"); + this.listener.checkRemoved("key1", "value1"); + Assert.assertNull(ctx1.getAttribute("key1")); + Assert.assertEquals("ctx2_private_value", ctx2.getAttribute("key1")); + Assert.assertEquals("globalContext_private_value", globalContext.getAttribute("key1")); + + ctx1.setAttribute("key1", null); + this.listener.checkNull(); + Assert.assertNull(ctx1.getAttribute("key1")); + Assert.assertEquals("ctx2_private_value", ctx2.getAttribute("key1")); + Assert.assertEquals("globalContext_private_value", globalContext.getAttribute("key1")); + + ctx1.setAttribute("key1", "value1"); + this.listener.checkAdded("key1", "value1"); + Assert.assertEquals("value1", ctx1.getAttribute("key1")); + Assert.assertEquals("ctx2_private_value", ctx2.getAttribute("key1")); + Assert.assertEquals("globalContext_private_value", globalContext.getAttribute("key1")); + + ctx1.setAttribute("key1", "newValue"); + this.listener.checkReplaced("key1", "value1"); + Assert.assertEquals("newValue", ctx1.getAttribute("key1")); + Assert.assertEquals("ctx2_private_value", ctx2.getAttribute("key1")); + Assert.assertEquals("globalContext_private_value", globalContext.getAttribute("key1")); + } + + @Test + public void testGetUnsharedAttributeNames() + { + ServletContext globalContext = new MockServletContext(); + ServletContext ctx1 = new ServletContextImpl(bundle, globalContext, httpContext, listener, false); + ServletContext ctx2 = new ServletContextImpl(bundle, globalContext, httpContext, listener, false); + + Enumeration e = ctx1.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertFalse(e.hasMoreElements()); + e = ctx2.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertFalse(e.hasMoreElements()); + e = globalContext.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertFalse(e.hasMoreElements()); + + ctx1.setAttribute("key1", "value1"); + this.listener.checkAdded("key1", "value1"); + e = ctx1.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertTrue(e.hasMoreElements()); + Assert.assertEquals("key1", e.nextElement()); + Assert.assertFalse(e.hasMoreElements()); + e = ctx2.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertFalse(e.hasMoreElements()); + e = globalContext.getAttributeNames(); + Assert.assertNotNull(e); + Assert.assertFalse(e.hasMoreElements()); + } + + @Test public void testGetServlet() throws Exception { @@ -260,4 +486,138 @@ public class ServletContextImplTest } } } + + private class MockServletContext implements ServletContext { + + private Dictionary attributes = new Hashtable(); + + public Object getAttribute(String name) + { + return attributes.get(name); + } + + public Enumeration getAttributeNames() + { + return attributes.keys(); + } + + public void setAttribute(String name, Object object) + { + if (object != null) + { + attributes.put(name, object); + } + else + { + removeAttribute(name); + } + } + + public void removeAttribute(String name) + { + attributes.remove(name); + } + + public String getContextPath() + { + return null; + } + + public ServletContext getContext(String uripath) + { + return null; + } + + public int getMajorVersion() + { + return 0; + } + + public int getMinorVersion() + { + return 0; + } + + public String getMimeType(String file) + { + return null; + } + + public Set getResourcePaths(String path) + { + return null; + } + + public URL getResource(String path) + { + return null; + } + + public InputStream getResourceAsStream(String path) + { + return null; + } + + public RequestDispatcher getRequestDispatcher(String path) + { + return null; + } + + public RequestDispatcher getNamedDispatcher(String name) + { + return null; + } + + public Servlet getServlet(String name) + { + return null; + } + + public Enumeration getServlets() + { + return null; + } + + public Enumeration getServletNames() + { + return null; + } + + public void log(String msg) + { + } + + public void log(Exception exception, String msg) + { + } + + public void log(String message, Throwable throwable) + { + } + + public String getRealPath(String path) + { + return null; + } + + public String getServerInfo() + { + return null; + } + + public String getInitParameter(String name) + { + return null; + } + + public Enumeration getInitParameterNames() + { + return null; + } + + public String getServletContextName() + { + return null; + } + } } Modified: felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/context/ServletContextManagerTest.java URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/context/ServletContextManagerTest.java?rev=1062830&r1=1062829&r2=1062830&view=diff ============================================================================== --- felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/context/ServletContextManagerTest.java (original) +++ felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/context/ServletContextManagerTest.java Mon Jan 24 15:31:45 2011 @@ -34,7 +34,7 @@ public class ServletContextManagerTest { Bundle bundle = Mockito.mock(Bundle.class); ServletContext globalContext = Mockito.mock(ServletContext.class); - this.manager = new ServletContextManager(bundle, globalContext, null); + this.manager = new ServletContextManager(bundle, globalContext, null, false); } @Test