mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-01 11:05:56 +01:00
Add POC protocol servlet with delegate to svn and hg
This commit is contained in:
@@ -28,7 +28,8 @@ public abstract class InitializingHttpScmProtocolWrapper implements HttpScmProto
|
|||||||
if (!isInitialized) {
|
if (!isInitialized) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (!isInitialized) {
|
if (!isInitialized) {
|
||||||
delegateProvider.get().init(config);
|
HttpServlet httpServlet = delegateProvider.get();
|
||||||
|
httpServlet.init(config);
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ import sonia.scm.repository.HgRepositoryHandler;
|
|||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.api.Command;
|
import sonia.scm.repository.api.Command;
|
||||||
import sonia.scm.repository.api.ScmProtocol;
|
import sonia.scm.repository.api.ScmProtocol;
|
||||||
import sonia.scm.web.HgCGIServlet;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -87,16 +86,17 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
* @param handler
|
||||||
* @param hookManager
|
* @param hookManager
|
||||||
* @param handler
|
|
||||||
* @param repository
|
* @param repository
|
||||||
|
* @param httpScmProtocol
|
||||||
*/
|
*/
|
||||||
HgRepositoryServiceProvider(HgRepositoryHandler handler,
|
HgRepositoryServiceProvider(HgRepositoryHandler handler,
|
||||||
HgHookManager hookManager, Repository repository)
|
HgHookManager hookManager, Repository repository, HttpScmProtocol httpScmProtocol)
|
||||||
{
|
{
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
|
this.httpScmProtocol = httpScmProtocol;
|
||||||
this.repositoryDirectory = handler.getDirectory(repository);
|
this.repositoryDirectory = handler.getDirectory(repository);
|
||||||
this.context = new HgCommandContext(hookManager, handler, repository,
|
this.context = new HgCommandContext(hookManager, handler, repository,
|
||||||
repositoryDirectory);
|
repositoryDirectory);
|
||||||
@@ -276,7 +276,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<ScmProtocol> getSupportedProtocols() {
|
public Set<ScmProtocol> getSupportedProtocols() {
|
||||||
return Collections.singleton(new HgCGIServlet(null, null, null, null, null, null));
|
return Collections.singleton(httpScmProtocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
@@ -292,4 +292,6 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private File repositoryDirectory;
|
private File repositoryDirectory;
|
||||||
|
|
||||||
|
private final HttpScmProtocol httpScmProtocol;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ package sonia.scm.repository.spi;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import sonia.scm.plugin.Extension;
|
import sonia.scm.plugin.Extension;
|
||||||
import sonia.scm.repository.HgHookManager;
|
import sonia.scm.repository.HgHookManager;
|
||||||
import sonia.scm.repository.HgRepositoryHandler;
|
import sonia.scm.repository.HgRepositoryHandler;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
|
import sonia.scm.web.HgScmProtocolProviderWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -65,10 +65,11 @@ public class HgRepositoryServiceResolver implements RepositoryServiceResolver
|
|||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public HgRepositoryServiceResolver(HgRepositoryHandler handler,
|
public HgRepositoryServiceResolver(HgRepositoryHandler handler,
|
||||||
HgHookManager hookManager)
|
HgHookManager hookManager, HgScmProtocolProviderWrapper httpScmProtocol)
|
||||||
{
|
{
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
this.hookManager = hookManager;
|
this.hookManager = hookManager;
|
||||||
|
this.httpScmProtocol = httpScmProtocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
@@ -89,7 +90,7 @@ public class HgRepositoryServiceResolver implements RepositoryServiceResolver
|
|||||||
if (TYPE.equalsIgnoreCase(repository.getType()))
|
if (TYPE.equalsIgnoreCase(repository.getType()))
|
||||||
{
|
{
|
||||||
provider = new HgRepositoryServiceProvider(handler, hookManager,
|
provider = new HgRepositoryServiceProvider(handler, hookManager,
|
||||||
repository);
|
repository, httpScmProtocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
return provider;
|
return provider;
|
||||||
@@ -102,4 +103,6 @@ public class HgRepositoryServiceResolver implements RepositoryServiceResolver
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private HgHookManager hookManager;
|
private HgHookManager hookManager;
|
||||||
|
|
||||||
|
private final HttpScmProtocol httpScmProtocol;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,19 +135,6 @@ public class HgCGIServlet extends HttpServlet implements HttpScmProtocol
|
|||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ServletException
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void init() throws ServletException
|
|
||||||
{
|
|
||||||
|
|
||||||
super.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -37,27 +37,22 @@ package sonia.scm.web;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import sonia.scm.Priority;
|
|
||||||
import sonia.scm.config.ScmConfiguration;
|
import sonia.scm.config.ScmConfiguration;
|
||||||
import sonia.scm.filter.Filters;
|
|
||||||
import sonia.scm.filter.WebElement;
|
|
||||||
import sonia.scm.repository.RepositoryProvider;
|
import sonia.scm.repository.RepositoryProvider;
|
||||||
import sonia.scm.web.filter.ProviderPermissionFilter;
|
import sonia.scm.web.filter.ProviderPermissionFilter;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permission filter for mercurial repositories.
|
* Permission filter for mercurial repositories.
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Priority(Filters.PRIORITY_AUTHORIZATION)
|
//@Priority(Filters.PRIORITY_AUTHORIZATION)
|
||||||
@WebElement(value = HgServletModule.MAPPING_HG)
|
//@WebElement(value = HgServletModule.MAPPING_HG)
|
||||||
public class HgPermissionFilter extends ProviderPermissionFilter
|
public class HgPermissionFilter 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 HgScmProtocolProviderWrapper extends InitializingHttpScmProtocolWrapper {
|
||||||
|
@Inject
|
||||||
|
public HgScmProtocolProviderWrapper(Provider<HgCGIServlet> servletProvider) {
|
||||||
|
super(servletProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -81,8 +81,5 @@ public class HgServletModule extends ServletModule
|
|||||||
|
|
||||||
// bind servlets
|
// bind servlets
|
||||||
serve(MAPPING_HOOK).with(HgHookCallbackServlet.class);
|
serve(MAPPING_HOOK).with(HgHookCallbackServlet.class);
|
||||||
|
|
||||||
// register hg cgi servlet
|
|
||||||
serve(MAPPING_HG).with(HgCGIServlet.class);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import sonia.scm.repository.Repository;
|
|||||||
import sonia.scm.repository.SvnRepositoryHandler;
|
import sonia.scm.repository.SvnRepositoryHandler;
|
||||||
import sonia.scm.repository.api.Command;
|
import sonia.scm.repository.api.Command;
|
||||||
import sonia.scm.repository.api.ScmProtocol;
|
import sonia.scm.repository.api.ScmProtocol;
|
||||||
import sonia.scm.web.SvnDAVServlet;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -69,14 +68,15 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
|
|||||||
/**
|
/**
|
||||||
* Constructs ...
|
* Constructs ...
|
||||||
*
|
*
|
||||||
*
|
* @param handler
|
||||||
* @param handler
|
|
||||||
* @param repository
|
* @param repository
|
||||||
|
* @param httpScmProtocol
|
||||||
*/
|
*/
|
||||||
SvnRepositoryServiceProvider(SvnRepositoryHandler handler,
|
SvnRepositoryServiceProvider(SvnRepositoryHandler handler,
|
||||||
Repository repository)
|
Repository repository, HttpScmProtocol httpScmProtocol)
|
||||||
{
|
{
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
|
this.httpScmProtocol = httpScmProtocol;
|
||||||
this.context = new SvnContext(handler.getDirectory(repository));
|
this.context = new SvnContext(handler.getDirectory(repository));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<ScmProtocol> getSupportedProtocols() {
|
public Set<ScmProtocol> getSupportedProtocols() {
|
||||||
return Collections.singleton(new SvnDAVServlet(null, null, null, null));
|
return Collections.singleton(httpScmProtocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
@@ -204,4 +204,6 @@ public class SvnRepositoryServiceProvider extends RepositoryServiceProvider
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private final Repository repository;
|
private final Repository repository;
|
||||||
|
|
||||||
|
private final HttpScmProtocol httpScmProtocol;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ package sonia.scm.repository.spi;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import sonia.scm.plugin.Extension;
|
import sonia.scm.plugin.Extension;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.SvnRepositoryHandler;
|
import sonia.scm.repository.SvnRepositoryHandler;
|
||||||
|
import sonia.scm.web.SvnScmProtocolProviderWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -58,11 +58,13 @@ public class SvnRepositoryServiceResolver implements RepositoryServiceResolver
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param handler
|
* @param handler
|
||||||
|
* @param httpScmProtocol
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public SvnRepositoryServiceResolver(SvnRepositoryHandler handler)
|
public SvnRepositoryServiceResolver(SvnRepositoryHandler handler, SvnScmProtocolProviderWrapper httpScmProtocol)
|
||||||
{
|
{
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
|
this.httpScmProtocol = httpScmProtocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
@@ -82,7 +84,7 @@ public class SvnRepositoryServiceResolver implements RepositoryServiceResolver
|
|||||||
|
|
||||||
if (TYPE.equalsIgnoreCase(repository.getType()))
|
if (TYPE.equalsIgnoreCase(repository.getType()))
|
||||||
{
|
{
|
||||||
provider = new SvnRepositoryServiceProvider(handler, repository);
|
provider = new SvnRepositoryServiceProvider(handler, repository, httpScmProtocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
return provider;
|
return provider;
|
||||||
@@ -92,4 +94,6 @@ public class SvnRepositoryServiceResolver implements RepositoryServiceResolver
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private SvnRepositoryHandler handler;
|
private SvnRepositoryHandler handler;
|
||||||
|
|
||||||
|
private final HttpScmProtocol httpScmProtocol;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,30 +34,24 @@ package sonia.scm.web;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import sonia.scm.Priority;
|
|
||||||
import sonia.scm.config.ScmConfiguration;
|
import sonia.scm.config.ScmConfiguration;
|
||||||
import sonia.scm.filter.Filters;
|
|
||||||
import sonia.scm.filter.WebElement;
|
|
||||||
import sonia.scm.repository.SvnUtil;
|
import sonia.scm.repository.SvnUtil;
|
||||||
import sonia.scm.util.HttpUtil;
|
import sonia.scm.util.HttpUtil;
|
||||||
import sonia.scm.web.filter.AuthenticationFilter;
|
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.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Priority(Filters.PRIORITY_AUTHENTICATION)
|
//@Priority(Filters.PRIORITY_AUTHENTICATION)
|
||||||
@WebElement(value = SvnServletModule.PATTERN_SVN)
|
//@WebElement(value = SvnServletModule.PATTERN_SVN)
|
||||||
public class SvnBasicAuthenticationFilter extends AuthenticationFilter
|
public class SvnBasicAuthenticationFilter extends AuthenticationFilter
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -37,32 +37,26 @@ package sonia.scm.web;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import sonia.scm.ClientMessages;
|
import sonia.scm.ClientMessages;
|
||||||
import sonia.scm.Priority;
|
|
||||||
import sonia.scm.config.ScmConfiguration;
|
import sonia.scm.config.ScmConfiguration;
|
||||||
import sonia.scm.filter.Filters;
|
|
||||||
import sonia.scm.filter.WebElement;
|
|
||||||
import sonia.scm.repository.RepositoryProvider;
|
import sonia.scm.repository.RepositoryProvider;
|
||||||
import sonia.scm.repository.ScmSvnErrorCode;
|
import sonia.scm.repository.ScmSvnErrorCode;
|
||||||
import sonia.scm.repository.SvnUtil;
|
import sonia.scm.repository.SvnUtil;
|
||||||
import sonia.scm.web.filter.ProviderPermissionFilter;
|
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.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Priority(Filters.PRIORITY_AUTHORIZATION)
|
//@Priority(Filters.PRIORITY_AUTHORIZATION)
|
||||||
@WebElement(value = SvnServletModule.PATTERN_SVN)
|
//@WebElement(value = SvnServletModule.PATTERN_SVN)
|
||||||
public class SvnPermissionFilter extends ProviderPermissionFilter
|
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()
|
protected void configureServlets()
|
||||||
{
|
{
|
||||||
filter(PATTERN_SVN).through(SvnGZipFilter.class);
|
filter(PATTERN_SVN).through(SvnGZipFilter.class);
|
||||||
filter(PATTERN_SVN).through(SvnBasicAuthenticationFilter.class);
|
// filter(PATTERN_SVN).through(SvnBasicAuthenticationFilter.class);
|
||||||
filter(PATTERN_SVN).through(SvnPermissionFilter.class);
|
// filter(PATTERN_SVN).through(SvnPermissionFilter.class);
|
||||||
|
|
||||||
bind(SvnConfigDtoToSvnConfigMapper.class).to(Mappers.getMapper(SvnConfigDtoToSvnConfigMapper.class).getClass());
|
bind(SvnConfigDtoToSvnConfigMapper.class).to(Mappers.getMapper(SvnConfigDtoToSvnConfigMapper.class).getClass());
|
||||||
bind(SvnConfigToSvnConfigDtoMapper.class).to(Mappers.getMapper(SvnConfigToSvnConfigDtoMapper.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,
|
parameters.put(PARAMETER_SVN_PARENTPATH,
|
||||||
System.getProperty("java.io.tmpdir"));
|
System.getProperty("java.io.tmpdir"));
|
||||||
serve(PATTERN_SVN).with(SvnDAVServlet.class, parameters);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static java.lang.Math.max;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@WebElement(value = HttpProtocolServlet.PATTERN)
|
@WebElement(value = HttpProtocolServlet.PATTERN)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -79,7 +81,8 @@ public class HttpProtocolServlet extends HttpServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String namespace = uri.substring(0, uri.indexOf(HttpUtil.SEPARATOR_PATH));
|
String namespace = uri.substring(0, uri.indexOf(HttpUtil.SEPARATOR_PATH));
|
||||||
String name = uri.substring(uri.indexOf(HttpUtil.SEPARATOR_PATH) + 1, uri.indexOf(HttpUtil.SEPARATOR_PATH, uri.indexOf(HttpUtil.SEPARATOR_PATH) + 1));
|
int endIndex = uri.indexOf(HttpUtil.SEPARATOR_PATH, uri.indexOf(HttpUtil.SEPARATOR_PATH) + 1);
|
||||||
|
String name = uri.substring(uri.indexOf(HttpUtil.SEPARATOR_PATH) + 1, max(endIndex, uri.length()));
|
||||||
|
|
||||||
return new NamespaceAndName(namespace, name);
|
return new NamespaceAndName(namespace, name);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user