mirror of
				https://github.com/scm-manager/scm-manager.git
				synced 2025-10-31 10:35:56 +01:00 
			
		
		
		
	Add POC protocol servlet with delegate to svn and hg
This commit is contained in:
		| @@ -41,7 +41,6 @@ import sonia.scm.repository.Repository; | ||||
| import sonia.scm.repository.SvnRepositoryHandler; | ||||
| import sonia.scm.repository.api.Command; | ||||
| import sonia.scm.repository.api.ScmProtocol; | ||||
| import sonia.scm.web.SvnDAVServlet; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.util.Collections; | ||||
| @@ -69,14 +68,15 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider | ||||
|   /** | ||||
|    * Constructs ... | ||||
|    * | ||||
|    * | ||||
|    * @param handler | ||||
|    *  @param handler | ||||
|    * @param repository | ||||
|    * @param httpScmProtocol | ||||
|    */ | ||||
|   SvnRepositoryServiceProvider(SvnRepositoryHandler handler, | ||||
|     Repository repository) | ||||
|     Repository repository, HttpScmProtocol httpScmProtocol) | ||||
|   { | ||||
|     this.repository = repository; | ||||
|     this.httpScmProtocol = httpScmProtocol; | ||||
|     this.context = new SvnContext(handler.getDirectory(repository)); | ||||
|   } | ||||
|  | ||||
| @@ -194,7 +194,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider | ||||
|  | ||||
|   @Override | ||||
|   public Set<ScmProtocol> getSupportedProtocols() { | ||||
|     return Collections.singleton(new SvnDAVServlet(null, null, null, null)); | ||||
|     return Collections.singleton(httpScmProtocol); | ||||
|   } | ||||
|  | ||||
|   //~--- fields --------------------------------------------------------------- | ||||
| @@ -204,4 +204,6 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider | ||||
|  | ||||
|   /** Field description */ | ||||
|   private final Repository repository; | ||||
|  | ||||
|   private final HttpScmProtocol httpScmProtocol; | ||||
| } | ||||
|   | ||||
| @@ -35,10 +35,10 @@ package sonia.scm.repository.spi; | ||||
| //~--- non-JDK imports -------------------------------------------------------- | ||||
|  | ||||
| import com.google.inject.Inject; | ||||
|  | ||||
| import sonia.scm.plugin.Extension; | ||||
| import sonia.scm.repository.Repository; | ||||
| import sonia.scm.repository.SvnRepositoryHandler; | ||||
| import sonia.scm.web.SvnScmProtocolProviderWrapper; | ||||
|  | ||||
| /** | ||||
|  * | ||||
| @@ -58,11 +58,13 @@ public class SvnRepositoryServiceResolver implements RepositoryServiceResolver | ||||
|    * | ||||
|    * | ||||
|    * @param handler | ||||
|    * @param httpScmProtocol | ||||
|    */ | ||||
|   @Inject | ||||
|   public SvnRepositoryServiceResolver(SvnRepositoryHandler handler) | ||||
|   public SvnRepositoryServiceResolver(SvnRepositoryHandler handler, SvnScmProtocolProviderWrapper httpScmProtocol) | ||||
|   { | ||||
|     this.handler = handler; | ||||
|     this.httpScmProtocol = httpScmProtocol; | ||||
|   } | ||||
|  | ||||
|   //~--- methods -------------------------------------------------------------- | ||||
| @@ -82,7 +84,7 @@ public class SvnRepositoryServiceResolver implements RepositoryServiceResolver | ||||
|  | ||||
|     if (TYPE.equalsIgnoreCase(repository.getType())) | ||||
|     { | ||||
|       provider = new SvnRepositoryServiceProvider(handler, repository); | ||||
|       provider = new SvnRepositoryServiceProvider(handler, repository, httpScmProtocol); | ||||
|     } | ||||
|  | ||||
|     return provider; | ||||
| @@ -92,4 +94,6 @@ public class SvnRepositoryServiceResolver implements RepositoryServiceResolver | ||||
|  | ||||
|   /** Field description */ | ||||
|   private SvnRepositoryHandler handler; | ||||
|  | ||||
|   private final HttpScmProtocol httpScmProtocol; | ||||
| } | ||||
|   | ||||
| @@ -34,30 +34,24 @@ package sonia.scm.web; | ||||
| //~--- non-JDK imports -------------------------------------------------------- | ||||
|  | ||||
| import com.google.inject.Inject; | ||||
|  | ||||
| import sonia.scm.Priority; | ||||
| import sonia.scm.config.ScmConfiguration; | ||||
| import sonia.scm.filter.Filters; | ||||
| import sonia.scm.filter.WebElement; | ||||
| import sonia.scm.repository.SvnUtil; | ||||
| import sonia.scm.util.HttpUtil; | ||||
| import sonia.scm.web.filter.AuthenticationFilter; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| import java.util.Set; | ||||
|  | ||||
| import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.IOException; | ||||
| import java.util.Set; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
|  */ | ||||
| @Priority(Filters.PRIORITY_AUTHENTICATION) | ||||
| @WebElement(value = SvnServletModule.PATTERN_SVN) | ||||
| //@Priority(Filters.PRIORITY_AUTHENTICATION) | ||||
| //@WebElement(value = SvnServletModule.PATTERN_SVN) | ||||
| public class SvnBasicAuthenticationFilter extends AuthenticationFilter | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -37,32 +37,26 @@ package sonia.scm.web; | ||||
|  | ||||
| import com.google.common.collect.ImmutableSet; | ||||
| import com.google.inject.Inject; | ||||
|  | ||||
| import sonia.scm.ClientMessages; | ||||
| import sonia.scm.Priority; | ||||
| import sonia.scm.config.ScmConfiguration; | ||||
| import sonia.scm.filter.Filters; | ||||
| import sonia.scm.filter.WebElement; | ||||
| import sonia.scm.repository.RepositoryProvider; | ||||
| import sonia.scm.repository.ScmSvnErrorCode; | ||||
| import sonia.scm.repository.SvnUtil; | ||||
| import sonia.scm.web.filter.ProviderPermissionFilter; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| import java.util.Set; | ||||
|  | ||||
| import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.IOException; | ||||
| import java.util.Set; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
|  */ | ||||
| @Priority(Filters.PRIORITY_AUTHORIZATION) | ||||
| @WebElement(value = SvnServletModule.PATTERN_SVN) | ||||
| //@Priority(Filters.PRIORITY_AUTHORIZATION) | ||||
| //@WebElement(value = SvnServletModule.PATTERN_SVN) | ||||
| public class SvnPermissionFilter extends ProviderPermissionFilter | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -0,0 +1,15 @@ | ||||
| package sonia.scm.web; | ||||
|  | ||||
| import sonia.scm.repository.spi.InitializingHttpScmProtocolWrapper; | ||||
|  | ||||
| import javax.inject.Inject; | ||||
| import javax.inject.Provider; | ||||
| import javax.inject.Singleton; | ||||
|  | ||||
| @Singleton | ||||
| public class SvnScmProtocolProviderWrapper extends InitializingHttpScmProtocolWrapper { | ||||
|   @Inject | ||||
|   public SvnScmProtocolProviderWrapper(Provider<SvnDAVServlet> servletProvider) { | ||||
|     super(servletProvider); | ||||
|   } | ||||
| } | ||||
| @@ -70,8 +70,8 @@ public class SvnServletModule extends ServletModule | ||||
|   protected void configureServlets() | ||||
|   { | ||||
|     filter(PATTERN_SVN).through(SvnGZipFilter.class); | ||||
|     filter(PATTERN_SVN).through(SvnBasicAuthenticationFilter.class); | ||||
|     filter(PATTERN_SVN).through(SvnPermissionFilter.class); | ||||
| //    filter(PATTERN_SVN).through(SvnBasicAuthenticationFilter.class); | ||||
| //    filter(PATTERN_SVN).through(SvnPermissionFilter.class); | ||||
|  | ||||
|     bind(SvnConfigDtoToSvnConfigMapper.class).to(Mappers.getMapper(SvnConfigDtoToSvnConfigMapper.class).getClass()); | ||||
|     bind(SvnConfigToSvnConfigDtoMapper.class).to(Mappers.getMapper(SvnConfigToSvnConfigDtoMapper.class).getClass()); | ||||
| @@ -80,6 +80,5 @@ public class SvnServletModule extends ServletModule | ||||
|  | ||||
|     parameters.put(PARAMETER_SVN_PARENTPATH, | ||||
|       System.getProperty("java.io.tmpdir")); | ||||
|     serve(PATTERN_SVN).with(SvnDAVServlet.class, parameters); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user