Java Code Examples for org.osgl.util.S#pathConcat()

The following examples show how to use org.osgl.util.S#pathConcat() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CliDispatcher.java    From actframework with Apache License 2.0 6 votes vote down vote up
private void resolveCommandPrefix() {
    Map<Keyword, CliHandler> temp = new HashMap<>(registry);
    registry.clear();
    App app = app();
    for (Map.Entry<Keyword, CliHandler> pair : temp.entrySet()) {
        Keyword keyword = pair.getKey();
        String name = rawNameRepo.get(keyword);
        CliHandler handler = pair.getValue();
        if (handler instanceof CliHandlerProxy) {
            CliHandlerProxy proxy = $.cast(handler);
            Class<?> type = app.classForName(proxy.classMetaInfo().className());
            CommandPrefix prefix = type.getAnnotation(CommandPrefix.class);
            if (null != prefix) {
                String pre = prefix.value();
                if (S.notBlank(pre)) {
                    name = S.pathConcat(pre, '.', rawNameRepo.get(keyword));
                }
            }
        }
        addToRegistry(name, handler);
    }
}
 
Example 2
Source File: HeaderTokenSessionMapper.java    From actframework with Apache License 2.0 5 votes vote down vote up
@Inject
public HeaderTokenSessionMapper(AppConfig config) {
    sessionHeader = config.sessionHeader();
    flashHeader = S.pathConcat(config.sessionHeaderPrefix(), '-', "Flash");
    sessionQueryParamName = config.getSessionQueryParamName();
    sessionPayloadPrefix = config.sessionHeaderPayloadPrefix();
    hasSessionPayloadPrefix = S.notBlank(sessionPayloadPrefix);
    expirationMapper = new ExpirationMapper(config);
}
 
Example 3
Source File: ActContext.java    From actframework with Apache License 2.0 5 votes vote down vote up
@Override
public String templatePath() {
    String path = templatePath;
    String context = templateContext;
    if (S.notBlank(path)) {
        return path.startsWith("/") || S.blank(context) ? path : S.pathConcat(context, '/', path);
    } else {
        if (S.blank(context)) {
            return methodPath().replace('.', '/');
        } else {
            return S.pathConcat(context, '/', S.afterLast(methodPath(), "."));
        }
    }
}
 
Example 4
Source File: CommanderByteCodeScanner.java    From actframework with Apache License 2.0 5 votes vote down vote up
@Override
public void visitEnd() {
    if (!classInfo.isAbstract()) {
        for (CommandMethodMetaInfo commandMethodMetaInfo : classInfo.commandList()) {
            String prefix = classInfo.contextPath();
            String commandName = commandMethodMetaInfo.commandName();
            if (S.notBlank(prefix)) {
                commandName = S.pathConcat(prefix, '.', commandName);
            }
            dispatcher.registerCommandHandler(commandName, commandMethodMetaInfo, classInfo);
        }
    }
    super.visitEnd();
}
 
Example 5
Source File: SimpleMetric.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
public Timer startTimer(String name) {
    return new SimpleTimer(S.pathConcat(this.name, ':', name), metricStore);
}
 
Example 6
Source File: UploadFileStorageService.java    From actframework with Apache License 2.0 4 votes vote down vote up
private String newKey(String filename) {
    if (S.blank(filename)) {
        return S.concat(Act.cuid(), "tmp");
    }
    return S.pathConcat(getKey(Act.cuid()), '/', filename);
}
 
Example 7
Source File: CookieStore.java    From actframework with Apache License 2.0 4 votes vote down vote up
private static String key(HttpUrl url) {
    String host = url.host();
    int port = url.port();
    return S.pathConcat(host, ':', S.string(port));
}