diff options
Diffstat (limited to 'org.eclipse.jgit.http.server/src/org')
23 files changed, 62 insertions, 0 deletions
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java index d33362b4b4..05391eb75d 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java @@ -70,14 +70,17 @@ class AsIsFileFilter implements Filter { this.asIs = getAnyFile; } + @Override public void init(FilterConfig config) throws ServletException { // Do nothing. } + @Override public void destroy() { // Do nothing. } + @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java index bca521025d..3a5edeebee 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java @@ -174,18 +174,22 @@ public class GitServlet extends MetaServlet { @Override public void init(final ServletConfig config) throws ServletException { gitFilter.init(new FilterConfig() { + @Override public String getFilterName() { return gitFilter.getClass().getName(); } + @Override public String getInitParameter(String name) { return config.getInitParameter(name); } + @Override public Enumeration<String> getInitParameterNames() { return config.getInitParameterNames(); } + @Override public ServletContext getServletContext() { return config.getServletContext(); } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoPacksServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoPacksServlet.java index bb6efb84b2..91c2f9fd9e 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoPacksServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoPacksServlet.java @@ -60,6 +60,7 @@ import org.eclipse.jgit.lib.ObjectDatabase; class InfoPacksServlet extends HttpServlet { private static final long serialVersionUID = 1L; + @Override public void doGet(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException { sendPlainText(packList(req), req, rsp); diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java index 446f6a2c8d..72c71369dc 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java @@ -64,6 +64,7 @@ import org.eclipse.jgit.util.HttpSupport; class InfoRefsServlet extends HttpServlet { private static final long serialVersionUID = 1L; + @Override public void doGet(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException { // Assume a dumb client and send back the dumb client diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/IsLocalFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/IsLocalFilter.java index 511cdf1935..223813feb3 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/IsLocalFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/IsLocalFilter.java @@ -66,14 +66,17 @@ import org.eclipse.jgit.lib.Repository; * downstream servlet can directly access its contents on disk. */ class IsLocalFilter implements Filter { + @Override public void init(FilterConfig config) throws ServletException { // Do nothing. } + @Override public void destroy() { // Do nothing. } + @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (isLocal(getRepository(request))) diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/NoCacheFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/NoCacheFilter.java index 6a23cb95f5..bdc3420aa9 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/NoCacheFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/NoCacheFilter.java @@ -59,14 +59,17 @@ import javax.servlet.http.HttpServletResponse; /** Adds HTTP response headers to prevent caching by proxies/browsers. */ class NoCacheFilter implements Filter { + @Override public void init(FilterConfig config) throws ServletException { // Do nothing. } + @Override public void destroy() { // Do nothing. } + @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletResponse rsp = (HttpServletResponse) response; diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java index c88670ec97..9d24bf7d07 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java @@ -130,6 +130,7 @@ class ReceivePackServlet extends HttpServlet { this.receivePackFactory = receivePackFactory; } + @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; @@ -153,10 +154,12 @@ class ReceivePackServlet extends HttpServlet { } } + @Override public void init(FilterConfig filterConfig) throws ServletException { // Nothing. } + @Override public void destroy() { // Nothing. } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java index b3fad3d959..de09c545e5 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java @@ -100,14 +100,17 @@ public class RepositoryFilter implements Filter { this.resolver = resolver; } + @Override public void init(final FilterConfig config) throws ServletException { context = config.getServletContext(); } + @Override public void destroy() { context = null; } + @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java index 145c63bcaf..08a5eba15f 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java @@ -95,6 +95,7 @@ class SmartOutputStream extends TemporaryBuffer { return out; } + @Override public void close() throws IOException { super.close(); diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java index a06bb1e9ed..fe34f6691f 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java @@ -80,14 +80,17 @@ abstract class SmartServiceInfoRefs implements Filter { this.filters = filters.toArray(new Filter[filters.size()]); } + @Override public void init(FilterConfig config) throws ServletException { // Do nothing. } + @Override public void destroy() { // Do nothing. } + @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final HttpServletRequest req = (HttpServletRequest) request; @@ -154,6 +157,7 @@ abstract class SmartServiceInfoRefs implements Filter { private class Chain implements FilterChain { private int filterIdx; + @Override public void doFilter(ServletRequest req, ServletResponse rsp) throws IOException, ServletException { if (filterIdx < filters.length) diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java index 650059bd38..28ee17dcd1 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java @@ -68,6 +68,7 @@ class TextFileServlet extends HttpServlet { this.fileName = name; } + @Override public void doGet(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException { try { diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java index a9a0c5b128..97d00c10a1 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java @@ -129,6 +129,7 @@ class UploadPackServlet extends HttpServlet { this.uploadPackFactory = uploadPackFactory; } + @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; @@ -152,10 +153,12 @@ class UploadPackServlet extends HttpServlet { } } + @Override public void init(FilterConfig filterConfig) throws ServletException { // Nothing. } + @Override public void destroy() { // Nothing. } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java index 2187cfaa42..800c5d4fee 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java @@ -128,10 +128,12 @@ public class MetaFilter implements Filter { return register(new RegexPipeline.Binder(pattern)); } + @Override public void init(FilterConfig filterConfig) throws ServletException { servletContext = filterConfig.getServletContext(); } + @Override public void destroy() { if (pipelines != null) { Set<Object> destroyed = newIdentitySet(); @@ -166,6 +168,7 @@ public class MetaFilter implements Filter { }; } + @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaServlet.java index 05060658d6..71365c8f44 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaServlet.java @@ -123,6 +123,7 @@ public class MetaServlet extends HttpServlet { filter.init(new NoParameterFilterConfig(name, ctx)); } + @Override public void destroy() { filter.destroy(); } @@ -131,6 +132,7 @@ public class MetaServlet extends HttpServlet { protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { filter.doFilter(req, res, new FilterChain() { + @Override public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException { diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java index 8dfcc4d149..961f88e4f8 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java @@ -59,26 +59,32 @@ final class NoParameterFilterConfig implements FilterConfig { this.context = context; } + @Override public String getInitParameter(String name) { return null; } + @Override public Enumeration<String> getInitParameterNames() { return new Enumeration<String>() { + @Override public boolean hasMoreElements() { return false; } + @Override public String nextElement() { throw new NoSuchElementException(); } }; } + @Override public ServletContext getServletContext() { return context; } + @Override public String getFilterName() { return filterName; } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java index 2414660a06..a402977ad1 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java @@ -79,14 +79,17 @@ public class RegexGroupFilter implements Filter { this.groupIdx = groupIdx - 1; } + @Override public void init(FilterConfig config) throws ServletException { // Do nothing. } + @Override public void destroy() { // Do nothing. } + @Override public void doFilter(final ServletRequest request, final ServletResponse rsp, final FilterChain chain) throws IOException, ServletException { diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java index 2ef71368d0..f33243b3b5 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java @@ -95,6 +95,7 @@ class RegexPipeline extends UrlPipeline { pattern = p; } + @Override UrlPipeline create() { return new RegexPipeline(pattern, getFilters(), getServlet()); } @@ -108,6 +109,7 @@ class RegexPipeline extends UrlPipeline { this.pattern = pattern; } + @Override boolean match(final HttpServletRequest req) { final String pathInfo = req.getPathInfo(); return pathInfo != null && pattern.matcher(pathInfo).matches(); diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java index e96fc59dc3..c2b0370977 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java @@ -61,6 +61,7 @@ abstract class ServletBinderImpl implements ServletBinder { this.filters = new ArrayList<Filter>(); } + @Override public ServletBinder through(Filter filter) { if (filter == null) throw new NullPointerException(HttpServerText.get().filterMustNotBeNull); @@ -68,6 +69,7 @@ abstract class ServletBinderImpl implements ServletBinder { return this; } + @Override public void with(HttpServlet servlet) { if (servlet == null) throw new NullPointerException(HttpServerText.get().servletMustNotBeNull); diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java index b942016259..903de63b8e 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java @@ -71,6 +71,7 @@ class SuffixPipeline extends UrlPipeline { this.suffix = suffix; } + @Override UrlPipeline create() { return new SuffixPipeline(suffix, getFilters(), getServlet()); } @@ -87,6 +88,7 @@ class SuffixPipeline extends UrlPipeline { this.suffixLen = suffix.length(); } + @Override boolean match(final HttpServletRequest req) { final String pathInfo = req.getPathInfo(); return pathInfo != null && pathInfo.endsWith(suffix); diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/UrlPipeline.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/UrlPipeline.java index 2d0b844072..56e4e22889 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/UrlPipeline.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/UrlPipeline.java @@ -121,26 +121,32 @@ abstract class UrlPipeline { throws ServletException { if (!inited.contains(ref)) { ref.init(new ServletConfig() { + @Override public String getInitParameter(String name) { return null; } + @Override public Enumeration<String> getInitParameterNames() { return new Enumeration<String>() { + @Override public boolean hasMoreElements() { return false; } + @Override public String nextElement() { throw new NoSuchElementException(); } }; } + @Override public ServletContext getServletContext() { return context; } + @Override public String getServletName() { return ref.getClass().getName(); } @@ -229,6 +235,7 @@ abstract class UrlPipeline { this.servlet = servlet; } + @Override public void doFilter(ServletRequest req, ServletResponse rsp) throws IOException, ServletException { if (filterIdx < filters.length) diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java index 4ef2a7c4cb..88ad472acb 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java @@ -72,6 +72,7 @@ public class AsIsFileService { }; private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() { + @Override public ServiceConfig parse(final Config cfg) { return new ServiceConfig(cfg); } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java index 8c39b7997b..04e192bcfb 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java @@ -69,6 +69,7 @@ import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; public class DefaultReceivePackFactory implements ReceivePackFactory<HttpServletRequest> { private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() { + @Override public ServiceConfig parse(final Config cfg) { return new ServiceConfig(cfg); } @@ -85,6 +86,7 @@ public class DefaultReceivePackFactory implements } } + @Override public ReceivePack create(final HttpServletRequest req, final Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { final ServiceConfig cfg = db.getConfig().get(CONFIG); diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java index 34c069e0e1..d01e2efca4 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java @@ -62,6 +62,7 @@ import org.eclipse.jgit.transport.resolver.UploadPackFactory; public class DefaultUploadPackFactory implements UploadPackFactory<HttpServletRequest> { private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() { + @Override public ServiceConfig parse(final Config cfg) { return new ServiceConfig(cfg); } @@ -75,6 +76,7 @@ public class DefaultUploadPackFactory implements } } + @Override public UploadPack create(final HttpServletRequest req, final Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { if (db.getConfig().get(CONFIG).enabled) |