@Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws IOException, ServletException {
    
    // If the NamespaceManager state is already set up from the
    // context of the task creator the current namespace will not
    // be null.  It's important to check that the current namespace
    // has not been set before setting it for this request.
    if (NamespaceManager.get() == null) {
      switch (strategy) {
        case SERVER_NAME : {
          NamespaceManager.set(request.getServerName());
          break;
        }
        
        case GOOGLE_APPS_DOMAIN : {
          NamespaceManager.set(NamespaceManager.getGoogleAppsNamespace());
          break;
        }

        case EMPTY : {
          NamespaceManager.set("");
        }
      }
    }
    
    // chain into the next request
    chain.doFilter(request, response) ;
  }