mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
feat: suit path
This commit is contained in:
parent
94a0e2fa42
commit
d73b8e21e6
@ -61,8 +61,8 @@ class ActorFactory {
|
||||
}
|
||||
|
||||
HandlerLocation handlerLocation = new HandlerLocation()
|
||||
.setRootPath(rootPath)
|
||||
.setMethodPath(handlerMethodAnnotation.path());
|
||||
.setRootPath(suitPath(rootPath))
|
||||
.setMethodPath(suitPath(handlerMethodAnnotation.path()));
|
||||
|
||||
HandlerInfo handlerInfo = new HandlerInfo()
|
||||
.setAnno(handlerMethodAnnotation)
|
||||
@ -72,4 +72,11 @@ class ActorFactory {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static String suitPath(String path) {
|
||||
if (path.startsWith("/")) {
|
||||
return path.replaceFirst("/", "");
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
@ -24,4 +24,12 @@ class ActorFactoryTest {
|
||||
ActorFactory.load(Lists.newArrayList(new TestActor()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuitPath() {
|
||||
final String testPath1 = ActorFactory.suitPath("/test");
|
||||
final String testPath2 = ActorFactory.suitPath("test");
|
||||
log.info("[ActorFactoryTest] testPath1: {}, testPath2: {}", testPath1, testPath2);
|
||||
assert testPath1.equals(testPath2);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user