Browse Source

Fix javadoc in org.eclipse.jgit.http.server

Change-Id: I732d773b21bbf64285493070964dd9e442eab5d8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.10
Matthias Sohn 7 years ago
parent
commit
3b00041caf
  1. 3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java
  2. 10
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java
  3. 43
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java
  4. 39
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java
  5. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java
  6. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/HttpServerText.java
  7. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoPacksServlet.java
  8. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java
  9. 3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/IsLocalFilter.java
  10. 5
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/NoCacheFilter.java
  11. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java
  12. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
  13. 25
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java
  14. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java
  15. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java
  16. 24
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java
  17. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java
  18. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
  19. 5
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ErrorServlet.java
  20. 7
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java
  21. 13
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaServlet.java
  22. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java
  23. 14
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java
  24. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java
  25. 8
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinder.java
  26. 14
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java
  27. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java
  28. 7
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/WrappedRequest.java
  29. 12
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java
  30. 7
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java
  31. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java

3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java

@ -70,16 +70,19 @@ class AsIsFileFilter implements Filter {
this.asIs = getAnyFile; this.asIs = getAnyFile;
} }
/** {@inheritDoc} */
@Override @Override
public void init(FilterConfig config) throws ServletException { public void init(FilterConfig config) throws ServletException {
// Do nothing. // Do nothing.
} }
/** {@inheritDoc} */
@Override @Override
public void destroy() { public void destroy() {
// Do nothing. // Do nothing.
} }
/** {@inheritDoc} */
@Override @Override
public void doFilter(ServletRequest request, ServletResponse response, public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException { FilterChain chain) throws IOException, ServletException {

10
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java

@ -47,13 +47,19 @@ import static org.eclipse.jgit.http.server.ServletUtils.isChunked;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** Parses Git client User-Agent strings. */ /**
* Parses Git client User-Agent strings.
*/
public class ClientVersionUtil { public class ClientVersionUtil {
private static final int[] v1_7_5 = { 1, 7, 5 }; private static final int[] v1_7_5 = { 1, 7, 5 };
private static final int[] v1_7_8_6 = { 1, 7, 8, 6 }; private static final int[] v1_7_8_6 = { 1, 7, 8, 6 };
private static final int[] v1_7_9 = { 1, 7, 9 }; private static final int[] v1_7_9 = { 1, 7, 9 };
/** @return maximum version array, indicating an invalid version of Git. */ /**
* An invalid version of Git
*
* @return maximum version array, indicating an invalid version of Git.
*/
public static int[] invalidVersion() { public static int[] invalidVersion() {
return new int[] { Integer.MAX_VALUE }; return new int[] { Integer.MAX_VALUE };
} }

43
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java

@ -62,8 +62,6 @@ import org.eclipse.jgit.http.server.resolver.AsIsFileService;
import org.eclipse.jgit.http.server.resolver.DefaultReceivePackFactory; import org.eclipse.jgit.http.server.resolver.DefaultReceivePackFactory;
import org.eclipse.jgit.http.server.resolver.DefaultUploadPackFactory; import org.eclipse.jgit.http.server.resolver.DefaultUploadPackFactory;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.UploadPack;
import org.eclipse.jgit.transport.resolver.FileResolver; import org.eclipse.jgit.transport.resolver.FileResolver;
import org.eclipse.jgit.transport.resolver.ReceivePackFactory; import org.eclipse.jgit.transport.resolver.ReceivePackFactory;
import org.eclipse.jgit.transport.resolver.RepositoryResolver; import org.eclipse.jgit.transport.resolver.RepositoryResolver;
@ -74,15 +72,16 @@ import org.eclipse.jgit.util.StringUtils;
* Handles Git repository access over HTTP. * Handles Git repository access over HTTP.
* <p> * <p>
* Applications embedding this filter should map a directory path within the * Applications embedding this filter should map a directory path within the
* application to this filter. For a servlet version, see {@link GitServlet}. * application to this filter. For a servlet version, see
* {@link org.eclipse.jgit.http.server.GitServlet}.
* <p> * <p>
* Applications may wish to add additional repository action URLs to this * Applications may wish to add additional repository action URLs to this
* servlet by taking advantage of its extension from {@link MetaFilter}. * servlet by taking advantage of its extension from
* Callers may register their own URL suffix translations through * {@link org.eclipse.jgit.http.server.glue.MetaFilter}. Callers may register
* {@link #serve(String)}, or their regex translations through * their own URL suffix translations through {@link #serve(String)}, or their
* {@link #serveRegex(String)}. Each translation should contain a complete * regex translations through {@link #serveRegex(String)}. Each translation
* filter pipeline which ends with the HttpServlet that should handle the * should contain a complete filter pipeline which ends with the HttpServlet
* requested action. * that should handle the requested action.
*/ */
public class GitFilter extends MetaFilter { public class GitFilter extends MetaFilter {
private volatile boolean initialized; private volatile boolean initialized;
@ -124,6 +123,8 @@ public class GitFilter extends MetaFilter {
} }
/** /**
* Set AsIsFileService
*
* @param f * @param f
* the filter to validate direct access to repository files * the filter to validate direct access to repository files
* through a dumb client. If {@code null} then dumb client * through a dumb client. If {@code null} then dumb client
@ -135,9 +136,12 @@ public class GitFilter extends MetaFilter {
} }
/** /**
* Set upload-pack factory
*
* @param f * @param f
* the factory to construct and configure an {@link UploadPack} * the factory to construct and configure an
* session when a fetch or clone is requested by a client. * {@link org.eclipse.jgit.transport.UploadPack} session when a
* fetch or clone is requested by a client.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void setUploadPackFactory(UploadPackFactory<HttpServletRequest> f) { public void setUploadPackFactory(UploadPackFactory<HttpServletRequest> f) {
@ -146,10 +150,12 @@ public class GitFilter extends MetaFilter {
} }
/** /**
* Add upload-pack filter
*
* @param filter * @param filter
* filter to apply before any of the UploadPack operations. The * filter to apply before any of the UploadPack operations. The
* UploadPack instance is available in the request attribute * UploadPack instance is available in the request attribute
* {@link ServletUtils#ATTRIBUTE_HANDLER}. * {@link org.eclipse.jgit.http.server.ServletUtils#ATTRIBUTE_HANDLER}.
*/ */
public void addUploadPackFilter(Filter filter) { public void addUploadPackFilter(Filter filter) {
assertNotInitialized(); assertNotInitialized();
@ -157,9 +163,12 @@ public class GitFilter extends MetaFilter {
} }
/** /**
* Set the receive-pack factory
*
* @param f * @param f
* the factory to construct and configure a {@link ReceivePack} * the factory to construct and configure a
* session when a push is requested by a client. * {@link org.eclipse.jgit.transport.ReceivePack} session when a
* push is requested by a client.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void setReceivePackFactory(ReceivePackFactory<HttpServletRequest> f) { public void setReceivePackFactory(ReceivePackFactory<HttpServletRequest> f) {
@ -168,10 +177,12 @@ public class GitFilter extends MetaFilter {
} }
/** /**
* Add receive-pack filter
*
* @param filter * @param filter
* filter to apply before any of the ReceivePack operations. The * filter to apply before any of the ReceivePack operations. The
* ReceivePack instance is available in the request attribute * ReceivePack instance is available in the request attribute
* {@link ServletUtils#ATTRIBUTE_HANDLER}. * {@link org.eclipse.jgit.http.server.ServletUtils#ATTRIBUTE_HANDLER}.
*/ */
public void addReceivePackFilter(Filter filter) { public void addReceivePackFilter(Filter filter) {
assertNotInitialized(); assertNotInitialized();
@ -183,6 +194,7 @@ public class GitFilter extends MetaFilter {
throw new IllegalStateException(HttpServerText.get().alreadyInitializedByContainer); throw new IllegalStateException(HttpServerText.get().alreadyInitializedByContainer);
} }
/** {@inheritDoc} */
@Override @Override
public void init(FilterConfig filterConfig) throws ServletException { public void init(FilterConfig filterConfig) throws ServletException {
super.init(filterConfig); super.init(filterConfig);
@ -297,6 +309,7 @@ public class GitFilter extends MetaFilter {
} }
} }
/** {@inheritDoc} */
@Override @Override
protected ServletBinder register(ServletBinder binder) { protected ServletBinder register(ServletBinder binder) {
if (resolver == null) if (resolver == null)

39
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java

@ -54,8 +54,6 @@ import javax.servlet.http.HttpServletRequest;
import org.eclipse.jgit.http.server.glue.MetaServlet; import org.eclipse.jgit.http.server.glue.MetaServlet;
import org.eclipse.jgit.http.server.resolver.AsIsFileService; import org.eclipse.jgit.http.server.resolver.AsIsFileService;
import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.UploadPack;
import org.eclipse.jgit.transport.resolver.ReceivePackFactory; import org.eclipse.jgit.transport.resolver.ReceivePackFactory;
import org.eclipse.jgit.transport.resolver.RepositoryResolver; import org.eclipse.jgit.transport.resolver.RepositoryResolver;
import org.eclipse.jgit.transport.resolver.UploadPackFactory; import org.eclipse.jgit.transport.resolver.UploadPackFactory;
@ -87,12 +85,12 @@ import org.eclipse.jgit.transport.resolver.UploadPackFactory;
* *
* <p> * <p>
* Applications may wish to add additional repository action URLs to this * Applications may wish to add additional repository action URLs to this
* servlet by taking advantage of its extension from {@link MetaServlet}. * servlet by taking advantage of its extension from
* Callers may register their own URL suffix translations through * {@link org.eclipse.jgit.http.server.glue.MetaServlet}. Callers may register
* {@link #serve(String)}, or their regex translations through * their own URL suffix translations through {@link #serve(String)}, or their
* {@link #serveRegex(String)}. Each translation should contain a complete * regex translations through {@link #serveRegex(String)}. Each translation
* filter pipeline which ends with the HttpServlet that should handle the * should contain a complete filter pipeline which ends with the HttpServlet
* requested action. * that should handle the requested action.
*/ */
public class GitServlet extends MetaServlet { public class GitServlet extends MetaServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -124,6 +122,8 @@ public class GitServlet extends MetaServlet {
} }
/** /**
* Set AsIsFileService
*
* @param f * @param f
* the filter to validate direct access to repository files * the filter to validate direct access to repository files
* through a dumb client. If {@code null} then dumb client * through a dumb client. If {@code null} then dumb client
@ -134,43 +134,54 @@ public class GitServlet extends MetaServlet {
} }
/** /**
* Set upload-pack factory
*
* @param f * @param f
* the factory to construct and configure an {@link UploadPack} * the factory to construct and configure an
* session when a fetch or clone is requested by a client. * {@link org.eclipse.jgit.transport.UploadPack} session when a
* fetch or clone is requested by a client.
*/ */
public void setUploadPackFactory(UploadPackFactory<HttpServletRequest> f) { public void setUploadPackFactory(UploadPackFactory<HttpServletRequest> f) {
gitFilter.setUploadPackFactory(f); gitFilter.setUploadPackFactory(f);
} }
/** /**
* Add upload-pack filter
*
* @param filter * @param filter
* filter to apply before any of the UploadPack operations. The * filter to apply before any of the UploadPack operations. The
* UploadPack instance is available in the request attribute * UploadPack instance is available in the request attribute
* {@link ServletUtils#ATTRIBUTE_HANDLER}. * {@link org.eclipse.jgit.http.server.ServletUtils#ATTRIBUTE_HANDLER}.
*/ */
public void addUploadPackFilter(Filter filter) { public void addUploadPackFilter(Filter filter) {
gitFilter.addUploadPackFilter(filter); gitFilter.addUploadPackFilter(filter);
} }
/** /**
* Set receive-pack factory
*
* @param f * @param f
* the factory to construct and configure a {@link ReceivePack} * the factory to construct and configure a
* session when a push is requested by a client. * {@link org.eclipse.jgit.transport.ReceivePack} session when a
* push is requested by a client.
*/ */
public void setReceivePackFactory(ReceivePackFactory<HttpServletRequest> f) { public void setReceivePackFactory(ReceivePackFactory<HttpServletRequest> f) {
gitFilter.setReceivePackFactory(f); gitFilter.setReceivePackFactory(f);
} }
/** /**
* Add receive-pack filter
*
* @param filter * @param filter
* filter to apply before any of the ReceivePack operations. The * filter to apply before any of the ReceivePack operations. The
* ReceivePack instance is available in the request attribute * ReceivePack instance is available in the request attribute
* {@link ServletUtils#ATTRIBUTE_HANDLER}. * {@link org.eclipse.jgit.http.server.ServletUtils#ATTRIBUTE_HANDLER}.
*/ */
public void addReceivePackFilter(Filter filter) { public void addReceivePackFilter(Filter filter) {
gitFilter.addReceivePackFilter(filter); gitFilter.addReceivePackFilter(filter);
} }
/** {@inheritDoc} */
@Override @Override
public void init(final ServletConfig config) throws ServletException { public void init(final ServletConfig config) throws ServletException {
gitFilter.init(new FilterConfig() { gitFilter.init(new FilterConfig() {

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java

@ -154,9 +154,9 @@ public class GitSmartHttpTools {
* an HTTP response code is returned instead. * an HTTP response code is returned instead.
* <p> * <p>
* This method may only be called before handing off the request to * This method may only be called before handing off the request to
* {@link UploadPack#upload(java.io.InputStream, OutputStream, OutputStream)} * {@link org.eclipse.jgit.transport.UploadPack#upload(java.io.InputStream, OutputStream, OutputStream)}
* or * or
* {@link ReceivePack#receive(java.io.InputStream, OutputStream, OutputStream)}. * {@link org.eclipse.jgit.transport.ReceivePack#receive(java.io.InputStream, OutputStream, OutputStream)}.
* *
* @param req * @param req
* current request. * current request.

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/HttpServerText.java

@ -52,6 +52,8 @@ import org.eclipse.jgit.nls.TranslationBundle;
public class HttpServerText extends TranslationBundle { public class HttpServerText extends TranslationBundle {
/** /**
* Get an instance of this translation bundle
*
* @return an instance of this translation bundle * @return an instance of this translation bundle
*/ */
public static HttpServerText get() { public static HttpServerText get() {

1
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 { class InfoPacksServlet extends HttpServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** {@inheritDoc} */
@Override @Override
public void doGet(final HttpServletRequest req, public void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException { final HttpServletResponse rsp) throws IOException {

1
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 { class InfoRefsServlet extends HttpServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** {@inheritDoc} */
@Override @Override
public void doGet(final HttpServletRequest req, public void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException { final HttpServletResponse rsp) throws IOException {

3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/IsLocalFilter.java

@ -66,16 +66,19 @@ import org.eclipse.jgit.lib.Repository;
* downstream servlet can directly access its contents on disk. * downstream servlet can directly access its contents on disk.
*/ */
class IsLocalFilter implements Filter { class IsLocalFilter implements Filter {
/** {@inheritDoc} */
@Override @Override
public void init(FilterConfig config) throws ServletException { public void init(FilterConfig config) throws ServletException {
// Do nothing. // Do nothing.
} }
/** {@inheritDoc} */
@Override @Override
public void destroy() { public void destroy() {
// Do nothing. // Do nothing.
} }
/** {@inheritDoc} */
@Override @Override
public void doFilter(ServletRequest request, ServletResponse response, public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException { FilterChain chain) throws IOException, ServletException {

5
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/NoCacheFilter.java

@ -57,18 +57,21 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/** Adds HTTP response headers to prevent caching by proxies/browsers. */ /** Add HTTP response headers to prevent caching by proxies/browsers. */
class NoCacheFilter implements Filter { class NoCacheFilter implements Filter {
/** {@inheritDoc} */
@Override @Override
public void init(FilterConfig config) throws ServletException { public void init(FilterConfig config) throws ServletException {
// Do nothing. // Do nothing.
} }
/** {@inheritDoc} */
@Override @Override
public void destroy() { public void destroy() {
// Do nothing. // Do nothing.
} }
/** {@inheritDoc} */
@Override @Override
public void doFilter(ServletRequest request, ServletResponse response, public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException { FilterChain chain) throws IOException, ServletException {

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java

@ -117,12 +117,14 @@ abstract class ObjectFileServlet extends HttpServlet {
abstract String etag(FileSender sender) throws IOException; abstract String etag(FileSender sender) throws IOException;
/** {@inheritDoc} */
@Override @Override
public void doGet(final HttpServletRequest req, public void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException { final HttpServletResponse rsp) throws IOException {
serve(req, rsp, true); serve(req, rsp, true);
} }
/** {@inheritDoc} */
@Override @Override
protected void doHead(final HttpServletRequest req, protected void doHead(final HttpServletRequest req,
final HttpServletResponse rsp) throws ServletException, IOException { final HttpServletResponse rsp) throws ServletException, IOException {

1
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java

@ -165,6 +165,7 @@ class ReceivePackServlet extends HttpServlet {
} }
} }
/** {@inheritDoc} */
@Override @Override
public void doPost(final HttpServletRequest req, public void doPost(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException { final HttpServletResponse rsp) throws IOException {

25
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java

@ -71,16 +71,19 @@ import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
/** /**
* Opens a repository named by the path info through {@link RepositoryResolver}. * Open a repository named by the path info through
* {@link org.eclipse.jgit.transport.resolver.RepositoryResolver}.
* <p> * <p>
* This filter assumes it is invoked by {@link GitServlet} and is likely to not * This filter assumes it is invoked by
* work as expected if called from any other class. This filter assumes the path * {@link org.eclipse.jgit.http.server.GitServlet} and is likely to not work as
* info of the current request is a repository name which can be used by the * expected if called from any other class. This filter assumes the path info of
* configured {@link RepositoryResolver} to open a {@link Repository} and attach * the current request is a repository name which can be used by the configured
* it to the current request. * {@link org.eclipse.jgit.transport.resolver.RepositoryResolver} to open a
* {@link org.eclipse.jgit.lib.Repository} and attach it to the current request.
* <p> * <p>
* This filter sets request attribute {@link ServletUtils#ATTRIBUTE_REPOSITORY} * This filter sets request attribute
* when it discovers the repository, and automatically closes and removes the * {@link org.eclipse.jgit.http.server.ServletUtils#ATTRIBUTE_REPOSITORY} when
* it discovers the repository, and automatically closes and removes the
* attribute when the request is complete. * attribute when the request is complete.
*/ */
public class RepositoryFilter implements Filter { public class RepositoryFilter implements Filter {
@ -93,23 +96,27 @@ public class RepositoryFilter implements Filter {
* *
* @param resolver * @param resolver
* the resolver which will be used to translate the URL name * the resolver which will be used to translate the URL name
* component to the actual {@link Repository} instance for the * component to the actual
* {@link org.eclipse.jgit.lib.Repository} instance for the
* current web request. * current web request.
*/ */
public RepositoryFilter(final RepositoryResolver<HttpServletRequest> resolver) { public RepositoryFilter(final RepositoryResolver<HttpServletRequest> resolver) {
this.resolver = resolver; this.resolver = resolver;
} }
/** {@inheritDoc} */
@Override @Override
public void init(final FilterConfig config) throws ServletException { public void init(final FilterConfig config) throws ServletException {
context = config.getServletContext(); context = config.getServletContext();
} }
/** {@inheritDoc} */
@Override @Override
public void destroy() { public void destroy() {
context = null; context = null;
} }
/** {@inheritDoc} */
@Override @Override
public void doFilter(final ServletRequest request, public void doFilter(final ServletRequest request,
final ServletResponse response, final FilterChain chain) final ServletResponse response, final FilterChain chain)

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java

@ -68,7 +68,9 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
/** Common utility functions for servlets. */ /**
* Common utility functions for servlets.
*/
public final class ServletUtils { public final class ServletUtils {
/** Request attribute which stores the {@link Repository} instance. */ /** Request attribute which stores the {@link Repository} instance. */
public static final String ATTRIBUTE_REPOSITORY = "org.eclipse.jgit.Repository"; public static final String ATTRIBUTE_REPOSITORY = "org.eclipse.jgit.Repository";

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java

@ -83,6 +83,7 @@ class SmartOutputStream extends TemporaryBuffer {
this.compressStream = compressStream; this.compressStream = compressStream;
} }
/** {@inheritDoc} */
@Override @Override
protected OutputStream overflow() throws IOException { protected OutputStream overflow() throws IOException {
startedOutput = true; startedOutput = true;
@ -95,6 +96,7 @@ class SmartOutputStream extends TemporaryBuffer {
return out; return out;
} }
/** {@inheritDoc} */
@Override @Override
public void close() throws IOException { public void close() throws IOException {
super.close(); super.close();

24
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java

@ -80,16 +80,19 @@ abstract class SmartServiceInfoRefs implements Filter {
this.filters = filters.toArray(new Filter[filters.size()]); this.filters = filters.toArray(new Filter[filters.size()]);
} }
/** {@inheritDoc} */
@Override @Override
public void init(FilterConfig config) throws ServletException { public void init(FilterConfig config) throws ServletException {
// Do nothing. // Do nothing.
} }
/** {@inheritDoc} */
@Override @Override
public void destroy() { public void destroy() {
// Do nothing. // Do nothing.
} }
/** {@inheritDoc} */
@Override @Override
public void doFilter(ServletRequest request, ServletResponse response, public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException { FilterChain chain) throws IOException, ServletException {
@ -146,10 +149,31 @@ abstract class SmartServiceInfoRefs implements Filter {
} }
} }
/**
* Begin service.
*
* @param req
* request
* @param db
* repository
* @throws IOException
* @throws ServiceNotEnabledException
* @throws ServiceNotAuthorizedException
*/
protected abstract void begin(HttpServletRequest req, Repository db) protected abstract void begin(HttpServletRequest req, Repository db)
throws IOException, ServiceNotEnabledException, throws IOException, ServiceNotEnabledException,
ServiceNotAuthorizedException; ServiceNotAuthorizedException;
/**
* Advertise.
*
* @param req
* request
* @param pck
* @throws IOException
* @throws ServiceNotEnabledException
* @throws ServiceNotAuthorizedException
*/
protected abstract void advertise(HttpServletRequest req, protected abstract void advertise(HttpServletRequest req,
PacketLineOutRefAdvertiser pck) throws IOException, PacketLineOutRefAdvertiser pck) throws IOException,
ServiceNotEnabledException, ServiceNotAuthorizedException; ServiceNotEnabledException, ServiceNotAuthorizedException;

1
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java

@ -68,6 +68,7 @@ class TextFileServlet extends HttpServlet {
this.fileName = name; this.fileName = name;
} }
/** {@inheritDoc} */
@Override @Override
public void doGet(final HttpServletRequest req, public void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException { final HttpServletResponse rsp) throws IOException {

1
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java

@ -164,6 +164,7 @@ class UploadPackServlet extends HttpServlet {
} }
} }
/** {@inheritDoc} */
@Override @Override
public void doPost(final HttpServletRequest req, public void doPost(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException { final HttpServletResponse rsp) throws IOException {

5
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ErrorServlet.java

@ -50,7 +50,9 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/** Sends a fixed status code to the client. */ /**
* Send a fixed status code to the client.
*/
public class ErrorServlet extends HttpServlet { public class ErrorServlet extends HttpServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -66,6 +68,7 @@ public class ErrorServlet extends HttpServlet {
this.status = status; this.status = status;
} }
/** {@inheritDoc} */
@Override @Override
protected void doGet(HttpServletRequest req, HttpServletResponse rsp) protected void doGet(HttpServletRequest req, HttpServletResponse rsp)
throws ServletException, IOException { throws ServletException, IOException {

7
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java

@ -87,7 +87,9 @@ public class MetaFilter implements Filter {
private volatile UrlPipeline[] pipelines; private volatile UrlPipeline[] pipelines;
/** Empty filter with no bindings. */ /**
* Empty filter with no bindings.
*/
public MetaFilter() { public MetaFilter() {
this.bindings = new ArrayList<>(); this.bindings = new ArrayList<>();
} }
@ -128,11 +130,13 @@ public class MetaFilter implements Filter {
return register(new RegexPipeline.Binder(pattern)); return register(new RegexPipeline.Binder(pattern));
} }
/** {@inheritDoc} */
@Override @Override
public void init(FilterConfig filterConfig) throws ServletException { public void init(FilterConfig filterConfig) throws ServletException {
servletContext = filterConfig.getServletContext(); servletContext = filterConfig.getServletContext();
} }
/** {@inheritDoc} */
@Override @Override
public void destroy() { public void destroy() {
if (pipelines != null) { if (pipelines != null) {
@ -168,6 +172,7 @@ public class MetaFilter implements Filter {
}; };
} }
/** {@inheritDoc} */
@Override @Override
public void doFilter(ServletRequest request, ServletResponse response, public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException { FilterChain chain) throws IOException, ServletException {

13
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaServlet.java

@ -74,7 +74,9 @@ public class MetaServlet extends HttpServlet {
private final MetaFilter filter; private final MetaFilter filter;
/** Empty servlet with no bindings. */ /**
* Empty servlet with no bindings.
*/
public MetaServlet() { public MetaServlet() {
this(new MetaFilter()); this(new MetaFilter());
} }
@ -89,7 +91,11 @@ public class MetaServlet extends HttpServlet {
filter = delegateFilter; filter = delegateFilter;
} }
/** @return filter this servlet delegates all routing logic to. */ /**
* Get delegate filter
*
* @return filter this servlet delegates all routing logic to.
*/
protected MetaFilter getDelegateFilter() { protected MetaFilter getDelegateFilter() {
return filter; return filter;
} }
@ -116,6 +122,7 @@ public class MetaServlet extends HttpServlet {
return filter.serveRegex(expression); return filter.serveRegex(expression);
} }
/** {@inheritDoc} */
@Override @Override
public void init(ServletConfig config) throws ServletException { public void init(ServletConfig config) throws ServletException {
String name = filter.getClass().getName(); String name = filter.getClass().getName();
@ -123,11 +130,13 @@ public class MetaServlet extends HttpServlet {
filter.init(new NoParameterFilterConfig(name, ctx)); filter.init(new NoParameterFilterConfig(name, ctx));
} }
/** {@inheritDoc} */
@Override @Override
public void destroy() { public void destroy() {
filter.destroy(); filter.destroy();
} }
/** {@inheritDoc} */
@Override @Override
protected void service(HttpServletRequest req, HttpServletResponse res) protected void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException { throws ServletException, IOException {

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java

@ -59,11 +59,13 @@ final class NoParameterFilterConfig implements FilterConfig {
this.context = context; this.context = context;
} }
/** {@inheritDoc} */
@Override @Override
public String getInitParameter(String name) { public String getInitParameter(String name) {
return null; return null;
} }
/** {@inheritDoc} */
@Override @Override
public Enumeration<String> getInitParameterNames() { public Enumeration<String> getInitParameterNames() {
return new Enumeration<String>() { return new Enumeration<String>() {
@ -79,11 +81,13 @@ final class NoParameterFilterConfig implements FilterConfig {
}; };
} }
/** {@inheritDoc} */
@Override @Override
public ServletContext getServletContext() { public ServletContext getServletContext() {
return context; return context;
} }
/** {@inheritDoc} */
@Override @Override
public String getFilterName() { public String getFilterName() {
return filterName; return filterName;

14
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java

@ -61,14 +61,17 @@ import org.eclipse.jgit.http.server.HttpServerText;
* Switch servlet path and path info to use another regex match group. * Switch servlet path and path info to use another regex match group.
* <p> * <p>
* This filter is meant to be installed in the middle of a pipeline created by * This filter is meant to be installed in the middle of a pipeline created by
* {@link MetaServlet#serveRegex(String)}. The passed request's servlet path is * {@link org.eclipse.jgit.http.server.glue.MetaServlet#serveRegex(String)}. The
* updated to be all text up to the start of the designated capture group, and * passed request's servlet path is updated to be all text up to the start of
* the path info is changed to the contents of the capture group. * the designated capture group, and the path info is changed to the contents of
**/ * the capture group.
*/
public class RegexGroupFilter implements Filter { public class RegexGroupFilter implements Filter {
private final int groupIdx; private final int groupIdx;
/** /**
* Constructor for RegexGroupFilter
*
* @param groupIdx * @param groupIdx
* capture group number, 1 through the number of groups. * capture group number, 1 through the number of groups.
*/ */
@ -79,16 +82,19 @@ public class RegexGroupFilter implements Filter {
this.groupIdx = groupIdx - 1; this.groupIdx = groupIdx - 1;
} }
/** {@inheritDoc} */
@Override @Override
public void init(FilterConfig config) throws ServletException { public void init(FilterConfig config) throws ServletException {
// Do nothing. // Do nothing.
} }
/** {@inheritDoc} */
@Override @Override
public void destroy() { public void destroy() {
// Do nothing. // Do nothing.
} }
/** {@inheritDoc} */
@Override @Override
public void doFilter(final ServletRequest request, public void doFilter(final ServletRequest request,
final ServletResponse rsp, final FilterChain chain) final ServletResponse rsp, final FilterChain chain)

1
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java

@ -164,6 +164,7 @@ class RegexPipeline extends UrlPipeline {
} }
} }
/** {@inheritDoc} */
@Override @Override
public String toString() { public String toString() {
return "Pipeline[regex: " + pattern + " ]"; return "Pipeline[regex: " + pattern + " ]";

8
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinder.java

@ -46,9 +46,13 @@ package org.eclipse.jgit.http.server.glue;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
/** Binds a servlet to a URL. */ /**
* Binds a servlet to a URL.
*/
public interface ServletBinder { public interface ServletBinder {
/** /**
* Set the filter to trigger while processing the path.
*
* @param filter * @param filter
* the filter to trigger while processing the path. * the filter to trigger while processing the path.
* @return {@code this}. * @return {@code this}.
@ -56,6 +60,8 @@ public interface ServletBinder {
public ServletBinder through(Filter filter); public ServletBinder through(Filter filter);
/** /**
* Set the servlet to execute on this path
*
* @param servlet * @param servlet
* the servlet to execute on this path. * the servlet to execute on this path.
*/ */

14
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<>(); this.filters = new ArrayList<>();
} }
/** {@inheritDoc} */
@Override @Override
public ServletBinder through(Filter filter) { public ServletBinder through(Filter filter) {
if (filter == null) if (filter == null)
@ -69,6 +70,7 @@ abstract class ServletBinderImpl implements ServletBinder {
return this; return this;
} }
/** {@inheritDoc} */
@Override @Override
public void with(HttpServlet servlet) { public void with(HttpServlet servlet) {
if (servlet == null) if (servlet == null)
@ -78,7 +80,11 @@ abstract class ServletBinderImpl implements ServletBinder {
httpServlet = servlet; httpServlet = servlet;
} }
/** @return the configured servlet, or singleton returning 404 if none. */ /**
* Get the servlet
*
* @return the configured servlet, or singleton returning 404 if none.
*/
protected HttpServlet getServlet() { protected HttpServlet getServlet() {
if (httpServlet != null) if (httpServlet != null)
return httpServlet; return httpServlet;
@ -86,7 +92,11 @@ abstract class ServletBinderImpl implements ServletBinder {
return new ErrorServlet(HttpServletResponse.SC_NOT_FOUND); return new ErrorServlet(HttpServletResponse.SC_NOT_FOUND);
} }
/** @return the configured filters; zero-length array if none. */ /**
* Get filters
*
* @return the configured filters; zero-length array if none.
*/
protected Filter[] getFilters() { protected Filter[] getFilters() {
return filters.toArray(new Filter[filters.size()]); return filters.toArray(new Filter[filters.size()]);
} }

1
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java

@ -103,6 +103,7 @@ class SuffixPipeline extends UrlPipeline {
super.service(new WrappedRequest(req, newPath, newInfo), rsp); super.service(new WrappedRequest(req, newPath, newInfo), rsp);
} }
/** {@inheritDoc} */
@Override @Override
public String toString() { public String toString() {
return "Pipeline[ *" + suffix + " ]"; return "Pipeline[ *" + suffix + " ]";

7
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/WrappedRequest.java

@ -46,7 +46,9 @@ package org.eclipse.jgit.http.server.glue;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletRequestWrapper;
/** Overrides the path and path info. */ /**
* Overrides the path and path info.
*/
public class WrappedRequest extends HttpServletRequestWrapper { public class WrappedRequest extends HttpServletRequestWrapper {
private final String path; private final String path;
@ -69,17 +71,20 @@ public class WrappedRequest extends HttpServletRequestWrapper {
this.pathInfo = pathInfo; this.pathInfo = pathInfo;
} }
/** {@inheritDoc} */
@Override @Override
public String getPathTranslated() { public String getPathTranslated() {
final String p = getPathInfo(); final String p = getPathInfo();
return p != null ? getSession().getServletContext().getRealPath(p) : null; return p != null ? getSession().getServletContext().getRealPath(p) : null;
} }
/** {@inheritDoc} */
@Override @Override
public String getPathInfo() { public String getPathInfo() {
return pathInfo; return pathInfo;
} }
/** {@inheritDoc} */
@Override @Override
public String getServletPath() { public String getServletPath() {
return path; return path;

12
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java

@ -45,7 +45,6 @@ package org.eclipse.jgit.http.server.resolver;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
@ -57,8 +56,9 @@ import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
* Older HTTP clients which do not speak the smart HTTP variant of the Git * Older HTTP clients which do not speak the smart HTTP variant of the Git
* protocol fetch from a repository by directly getting its objects and pack * protocol fetch from a repository by directly getting its objects and pack
* files. This class, along with the {@code http.getanyfile} per-repository * files. This class, along with the {@code http.getanyfile} per-repository
* configuration setting, can be used by {@link GitServlet} to control whether * configuration setting, can be used by
* or not these older clients are permitted to read these direct files. * {@link org.eclipse.jgit.http.server.GitServlet} to control whether or not
* these older clients are permitted to read these direct files.
*/ */
public class AsIsFileService { public class AsIsFileService {
/** Always throws {@link ServiceNotEnabledException}. */ /** Always throws {@link ServiceNotEnabledException}. */
@ -98,8 +98,10 @@ public class AsIsFileService {
* throwing a checked exception if access should be denied. * throwing a checked exception if access should be denied.
* <p> * <p>
* The default implementation of this method checks {@code http.getanyfile}, * The default implementation of this method checks {@code http.getanyfile},
* throwing {@link ServiceNotEnabledException} if it was explicitly set to * throwing
* {@code false}, and otherwise succeeding silently. * {@link org.eclipse.jgit.transport.resolver.ServiceNotEnabledException} if
* it was explicitly set to {@code false}, and otherwise succeeding
* silently.
* *
* @param req * @param req
* current HTTP request, in case information from the request may * current HTTP request, in case information from the request may

7
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java

@ -54,12 +54,14 @@ import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
/** /**
* Create and configure {@link ReceivePack} service instance. * Create and configure {@link org.eclipse.jgit.transport.ReceivePack} service
* instance.
* <p> * <p>
* Writing by receive-pack is permitted if any of the following is true: * Writing by receive-pack is permitted if any of the following is true:
* <ul> * <ul>
* <li>The container has authenticated the user and set * <li>The container has authenticated the user and set
* {@link HttpServletRequest#getRemoteUser()} to the authenticated name. * {@link javax.servlet.http.HttpServletRequest#getRemoteUser()} to the
* authenticated name.
* <li>The repository configuration file has {@code http.receivepack} explicitly * <li>The repository configuration file has {@code http.receivepack} explicitly
* set to true. * set to true.
* </ul> * </ul>
@ -78,6 +80,7 @@ public class DefaultReceivePackFactory implements
} }
} }
/** {@inheritDoc} */
@Override @Override
public ReceivePack create(final HttpServletRequest req, final Repository db) public ReceivePack create(final HttpServletRequest req, final Repository db)
throws ServiceNotEnabledException, ServiceNotAuthorizedException { throws ServiceNotEnabledException, ServiceNotAuthorizedException {

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java

@ -53,7 +53,8 @@ import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.eclipse.jgit.transport.resolver.UploadPackFactory; import org.eclipse.jgit.transport.resolver.UploadPackFactory;
/** /**
* Create and configure {@link UploadPack} service instance. * Create and configure {@link org.eclipse.jgit.transport.UploadPack} service
* instance.
* <p> * <p>
* Reading by upload-pack is permitted unless {@code http.uploadpack} is * Reading by upload-pack is permitted unless {@code http.uploadpack} is
* explicitly set to false. * explicitly set to false.
@ -68,6 +69,7 @@ public class DefaultUploadPackFactory implements
} }
} }
/** {@inheritDoc} */
@Override @Override
public UploadPack create(final HttpServletRequest req, final Repository db) public UploadPack create(final HttpServletRequest req, final Repository db)
throws ServiceNotEnabledException, ServiceNotAuthorizedException { throws ServiceNotEnabledException, ServiceNotAuthorizedException {

Loading…
Cancel
Save