public void unregisterOverlapping() throws Exception { HttpService _httpSR = getContext().getServiceReference(HttpService.class.getName()); ServiceReference _http = (HttpService) getContext().getService(_httpSR); HttpContext httpContext = new HttpContext() { public java.net.URL getResource(final String name) { // Map a resource name to a URL. return (URL) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return getClass().getResource(name); } }); } public String getMimeType(String name) { // Map a name to a MIME type. return null; } public boolean handleSecurity(HttpServletRequest request,HttpServletResponse response) throws java.io.IOException { // Handle security for a request. return true; } }; HttpTestServlet1 servlet_aa = new HttpTestServlet1(); HttpTestServlet2 servlet_aabb = new HttpTestServlet2(); // register first servlet with path /aa _http.registerServlet("/aa", servlet_aa, null, httpContext); // register second servlet with overlapping path /aa/bb _http.registerServlet("/aa/bb", servlet_aabb, null, httpContext); // unregister servlet with path /aa/bb _http.unregister("/aa/bb"); }