当前位置: 首页>>代码示例>>Java>>正文


Java HttpFileService类代码示例

本文整理汇总了Java中com.linecorp.armeria.server.file.HttpFileService的典型用法代码示例。如果您正苦于以下问题:Java HttpFileService类的具体用法?Java HttpFileService怎么用?Java HttpFileService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HttpFileService类属于com.linecorp.armeria.server.file包,在下文中一共展示了HttpFileService类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DocService

import com.linecorp.armeria.server.file.HttpFileService; //导入依赖的package包/类
/**
 * Creates a new instance with example HTTP headers and example requests.
 */
DocService(Map<String, ListMultimap<String, HttpHeaders>> exampleHttpHeaders,
           Map<String, ListMultimap<String, String>> exampleRequests) {

    super(ofExact("/specification.json", HttpFileService.forVfs(new DocServiceVfs())),
          ofCatchAll(HttpFileService.forClassPath(DocService.class.getClassLoader(),
                                                  "com/linecorp/armeria/server/docs")));
    this.exampleHttpHeaders = immutableCopyOf(exampleHttpHeaders, "exampleHttpHeaders");
    this.exampleRequests = immutableCopyOf(exampleRequests, "exampleRequests");
}
 
开发者ID:line,项目名称:armeria,代码行数:13,代码来源:DocService.java

示例2: configureHttpApi

import com.linecorp.armeria.server.file.HttpFileService; //导入依赖的package包/类
private void configureHttpApi(ServerBuilder sb,
                              ProjectManager pm, CommandExecutor executor, WatchService watchService,
                              @Nullable CentralDogmaSecurityManager securityManager) {
    final String apiV0PathPrefix = "/api/v0/";

    final TokenService tokenService = new TokenService(pm, executor);
    final MetadataService mds = new MetadataService(pm, executor);

    final Function<Service<HttpRequest, HttpResponse>,
            ? extends Service<HttpRequest, HttpResponse>> decorator;
    if (cfg.isSecurityEnabled()) {
        requireNonNull(securityManager, "securityManager");
        sb.service(apiV0PathPrefix + "authenticate", new LoginService(securityManager, executor))
          .service(apiV0PathPrefix + "logout", new LogoutService(securityManager, executor));

        final ApplicationTokenAuthorizer ata = new ApplicationTokenAuthorizer(tokenService::findToken);
        final SessionTokenAuthorizer sta = new SessionTokenAuthorizer(securityManager);

        decorator = HttpAuthService.newDecorator(ata, sta);
    } else {
        decorator = HttpAuthService.newDecorator(new CsrfTokenAuthorizer());
    }

    final SafeProjectManager safePm = new SafeProjectManager(pm);

    final HttpApiRequestConverter v1RequestConverter = new HttpApiRequestConverter(safePm);
    final HttpApiResponseConverter v1ResponseConverter = new HttpApiResponseConverter();

    sb.annotatedService(API_V1_PATH_PREFIX,
                        new ProjectServiceV1(safePm, executor, mds), decorator,
                        v1RequestConverter, v1ResponseConverter);
    sb.annotatedService(API_V1_PATH_PREFIX,
                        new RepositoryServiceV1(safePm, executor, mds), decorator,
                        v1RequestConverter, v1ResponseConverter);
    sb.annotatedService(API_V1_PATH_PREFIX,
                        new ContentServiceV1(safePm, executor, watchService), decorator,
                        v1RequestConverter, v1ResponseConverter);

    if (cfg.isWebAppEnabled()) {
        final RestfulJsonResponseConverter httpApiV0Converter = new RestfulJsonResponseConverter();

        // TODO(hyangtack): Simplify this if https://github.com/line/armeria/issues/582 is resolved.
        sb.annotatedService(apiV0PathPrefix, new UserService(safePm, executor),
                            decorator, httpApiV0Converter)
          .annotatedService(apiV0PathPrefix, new ProjectService(safePm, executor),
                            decorator, httpApiV0Converter)
          .annotatedService(apiV0PathPrefix, new RepositoryService(safePm, executor),
                            decorator, httpApiV0Converter)
          .annotatedService(apiV0PathPrefix, tokenService, decorator, httpApiV0Converter);
    }

    sb.serviceUnder("/", HttpFileService.forClassPath("webapp"));
}
 
开发者ID:line,项目名称:centraldogma,代码行数:54,代码来源:CentralDogma.java

示例3: StaticSiteService

import com.linecorp.armeria.server.file.HttpFileService; //导入依赖的package包/类
private StaticSiteService(String staticPath, HttpFileService fileService) {
  super(
      CompositeServiceEntry.ofPrefix(staticPath, fileService),
      CompositeServiceEntry.ofExact("/sw.js", fileService),
      CompositeServiceEntry.ofCatchAll(fileService.decorate(IndexService::new)));
}
 
开发者ID:curioswitch,项目名称:curiostack,代码行数:7,代码来源:StaticSiteService.java

示例4: vfs

import com.linecorp.armeria.server.file.HttpFileService; //导入依赖的package包/类
DocServiceVfs vfs() {
    return (DocServiceVfs) ((HttpFileService) serviceAt(0)).config().vfs();
}
 
开发者ID:line,项目名称:armeria,代码行数:4,代码来源:DocService.java

示例5: of

import com.linecorp.armeria.server.file.HttpFileService; //导入依赖的package包/类
/**
 * Creates a new {@link StaticSiteService}.
 *
 * @param staticPath the URL path from which static resources will be served, e.g., "/static".
 * @param classpathRoot the root directory in the classpath to serve resources from.
 */
public static StaticSiteService of(String staticPath, String classpathRoot) {
  HttpFileService fileService =
      HttpFileServiceBuilder.forClassPath(classpathRoot).serveCompressedFiles(true).build();
  return new StaticSiteService(staticPath, fileService);
}
 
开发者ID:curioswitch,项目名称:curiostack,代码行数:12,代码来源:StaticSiteService.java


注:本文中的com.linecorp.armeria.server.file.HttpFileService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。