Class RepositoryFilter

  • All Implemented Interfaces:
    javax.servlet.Filter

    public class RepositoryFilter
    extends Object
    implements javax.servlet.Filter
    Open a repository named by the path info through RepositoryResolver.

    This filter assumes it is invoked by GitServlet and is likely to not work as expected if called from any other class. This filter assumes the path info of the current request is a repository name which can be used by the configured RepositoryResolver to open a Repository and attach it to the current request.

    This filter sets request attribute ServletUtils.ATTRIBUTE_REPOSITORY when it discovers the repository, and automatically closes and removes the attribute when the request is complete.

    • Constructor Detail

      • RepositoryFilter

        public RepositoryFilter​(RepositoryResolver<javax.servlet.http.HttpServletRequest> resolver)
        Create a new filter.
        Parameters:
        resolver - the resolver which will be used to translate the URL name component to the actual Repository instance for the current web request.
    • Method Detail

      • init

        public void init​(javax.servlet.FilterConfig config)
                  throws javax.servlet.ServletException
        Specified by:
        init in interface javax.servlet.Filter
        Throws:
        javax.servlet.ServletException
      • destroy

        public void destroy()
        Specified by:
        destroy in interface javax.servlet.Filter
      • doFilter

        public void doFilter​(javax.servlet.ServletRequest request,
                             javax.servlet.ServletResponse response,
                             javax.servlet.FilterChain chain)
                      throws IOException,
                             javax.servlet.ServletException
        Specified by:
        doFilter in interface javax.servlet.Filter
        Throws:
        IOException
        javax.servlet.ServletException