public boolean accepts(SlingHttpServletRequest request) {
   for (DefaultServletDelegate delegate : delegates) {
     if (delegate.accepts(request)) {
       request.setAttribute(DefaultServletSwitch.class.getName(), delegate);
       return true;
     }
   }
   return false;
 }
 @Override
 protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
     throws ServletException, IOException {
   DefaultServletDelegate delegate =
       (DefaultServletDelegate) request.getAttribute(DefaultServletSwitch.class.getName());
   if (delegate != null) {
     delegate.doDelegateGet(request, response);
   } else {
     response.sendError(404);
   }
 }
 public void unbindDelegate(DefaultServletDelegate defaultServletDelegate) {
   if (defaultServletDelegate != null) {
     if (delegateStore.containsKey(defaultServletDelegate)) {
       defaultServletDelegate.destroy();
       delegateStore.remove(defaultServletDelegate);
       delegates =
           delegateStore.values().toArray(new DefaultServletDelegate[delegateStore.size()]);
     }
   }
 }
 public void bindDelegate(DefaultServletDelegate defaultServletDelegate) throws ServletException {
   if (defaultServletDelegate != null) {
     if (!delegateStore.containsKey(defaultServletDelegate)) {
       delegateStore.put(defaultServletDelegate, defaultServletDelegate);
       delegates =
           delegateStore.values().toArray(new DefaultServletDelegate[delegateStore.size()]);
       defaultServletDelegate.init(getServletConfig());
     }
   }
 }