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


Java ViewFacet类代码示例

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


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

示例1: configure

import org.sonatype.nexus.repository.view.ViewFacet; //导入依赖的package包/类
private ViewFacet configure(final ConfigurableViewFacet facet) {
  Router.Builder builder = new Router.Builder();

  builder.route(new Route.Builder().matcher(new AlwaysMatcher())
      .handler(timingHandler)
      .handler(securityHandler)
      .handler(exceptionHandler)
      .handler(negativeCacheHandler)
      .handler(conditionalRequestHandler)
      .handler(partialFetchHandler)
      .handler(contentHeadersHandler)
      .handler(unitOfWorkHandler)
      .handler(snapshotHandler)
      .handler(proxyHandler).create());

  builder.defaultHandlers(notFound());
  facet.configure(builder.create());
  return facet;
}
 
开发者ID:sonatype-nexus-community,项目名称:nexus-repository-apt,代码行数:20,代码来源:AptProxyRecipe.java

示例2: configure

import org.sonatype.nexus.repository.view.ViewFacet; //导入依赖的package包/类
private ViewFacet configure(final ConfigurableViewFacet facet) {
  Router.Builder builder = new Router.Builder();

  builder.route(new Route.Builder().matcher(new AlwaysMatcher())
      .handler(timingHandler)
      .handler(securityHandler)
      .handler(exceptionHandler)
      .handler(conditionalRequestHandler)
      .handler(partialFetchHandler)
      .handler(contentHeadersHandler)
      .handler(unitOfWorkHandler)
      .handler(snapshotHandler)
      .handler(signingHandler)
      .handler(hostedHandler).create());

  builder.defaultHandlers(notFound());
  facet.configure(builder.create());
  return facet;
}
 
开发者ID:sonatype-nexus-community,项目名称:nexus-repository-apt,代码行数:20,代码来源:AptHostedRecipe.java

示例3: doService

import org.sonatype.nexus.repository.view.ViewFacet; //导入依赖的package包/类
protected void doService(final HttpServletRequest httpRequest, final HttpServletResponse httpResponse)
    throws Exception
{
  // resolve repository for request
  RepositoryPath path = RepositoryPath.parse(httpRequest.getPathInfo());
  log.debug("Parsed path: {}", path);

  Repository repo = repository(path.getRepositoryName());
  if (repo == null) {
    send(null, HttpResponses.notFound(REPOSITORY_NOT_FOUND_MESSAGE), httpResponse);
    return;
  }
  log.debug("Repository: {}", repo);

  if (!repo.getConfiguration().isOnline()) {
    send(null, HttpResponses.serviceUnavailable("Repository offline"), httpResponse);
    return;
  }

  ViewFacet facet = repo.facet(ViewFacet.class);
  log.debug("Dispatching to view facet: {}", facet);

  // Dispatch the request
  Request request = buildRequest(httpRequest, path.getRemainingPath());
  dispatchAndSend(request, facet, httpResponseSenderSelector.sender(repo), httpResponse);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:27,代码来源:ViewServlet.java

示例4: newRepository

import org.sonatype.nexus.repository.view.ViewFacet; //导入依赖的package包/类
/**
 * Construct a new repository from configuration.
 */
private Repository newRepository(final Configuration configuration) throws Exception {
  String recipeName = configuration.getRecipeName();
  Recipe recipe = recipe(recipeName);
  log.debug("Using recipe: [{}] {}", recipeName, recipe);

  Repository repository = factory.create(recipe.getType(), recipe.getFormat());

  // attach mandatory facets
  repository.attach(configFacet.get());

  // apply recipe to repository
  recipe.apply(repository);

  // verify required facets
  repository.facet(ViewFacet.class);

  // ensure configuration sanity, once all facets are attached
  repository.validate(configuration);

  // initialize repository
  repository.init(configuration);

  return repository;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:28,代码来源:RepositoryManagerImpl.java

示例5: getFirst

import org.sonatype.nexus.repository.view.ViewFacet; //导入依赖的package包/类
/**
 * Returns the first OK response from member repositories or {@link HttpResponses#notFound()} if none of the members
 * responded with OK.
 */
protected Response getFirst(@Nonnull final Context context,
                            @Nonnull final List<Repository> members,
                            @Nonnull final DispatchedRepositories dispatched)
    throws Exception
{
  final Request request = context.getRequest();
  for (Repository member : members) {
    log.trace("Trying member: {}", member);
    // track repositories we have dispatched to, prevent circular dispatch for nested groups
    if (dispatched.contains(member)) {
      log.trace("Skipping already dispatched member: {}", member);
      continue;
    }
    dispatched.add(member);

    final ViewFacet view = member.facet(ViewFacet.class);
    final Response response = view.dispatch(request, context);
    log.trace("Member {} response {}", member, response.getStatus());
    if (response.getStatus().isSuccessful()) {
      return response;
    }
  }
  return notFoundResponse(context);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:29,代码来源:GroupHandler.java

示例6: getAll

import org.sonatype.nexus.repository.view.ViewFacet; //导入依赖的package包/类
/**
 * Returns all responses from all members as a linked map, where order is group member order.
 */
protected LinkedHashMap<Repository, Response> getAll(@Nonnull final Context context,
                                                     @Nonnull final Iterable<Repository> members,
                                                     @Nonnull final DispatchedRepositories dispatched)
    throws Exception
{
  final Request request = context.getRequest();
  final LinkedHashMap<Repository, Response> responses = Maps.newLinkedHashMap();
  for (Repository member : members) {
    log.trace("Trying member: {}", member);
    // track repositories we have dispatched to, prevent circular dispatch for nested groups
    if (dispatched.contains(member)) {
      log.trace("Skipping already dispatched member: {}", member);
      continue;
    }
    dispatched.add(member);

    final ViewFacet view = member.facet(ViewFacet.class);
    final Response response = view.dispatch(request, context);
    log.trace("Member {} response {}", member, response.getStatus());

    responses.put(member, response);
  }
  return responses;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:28,代码来源:GroupHandler.java

示例7: setupRepository

import org.sonatype.nexus.repository.view.ViewFacet; //导入依赖的package包/类
private void setupRepository(final Repository repository) throws Exception {
  ViewFacet viewFacet = mock(ViewFacet.class);
  Response response = mock(Response.class);
  Payload payload = mock(Payload.class);
  GroupFacet groupFacet = mock(GroupFacet.class);
  when(groupFacet.members()).thenReturn(members);
  when(repository.facet(GroupFacet.class)).thenReturn(groupFacet);
  when(repository.facet(ViewFacet.class)).thenReturn(viewFacet);
  when(viewFacet.dispatch(any(), any())).thenReturn(response);
  when(response.getPayload()).thenReturn(payload);
  when(payload.openInputStream()).thenReturn(new FileInputStream(packages));
  when(response.getStatus()).thenReturn(new Status(true, 200));
}
 
开发者ID:sonatype-nexus-community,项目名称:nexus-repository-r,代码行数:14,代码来源:PackagesGroupHandlerTest.java

示例8: dispatchAndSend

import org.sonatype.nexus.repository.view.ViewFacet; //导入依赖的package包/类
@VisibleForTesting
void dispatchAndSend(final Request request,
                     final ViewFacet facet,
                     final HttpResponseSender sender,
                     final HttpServletResponse httpResponse)
    throws Exception
{
  Response response = null;
  Exception failure = null;
  try {
    response = facet.dispatch(request);
  }
  catch (Exception e) {
    failure = e;
  }

  String describeFlags = request.getParameters().get(P_DESCRIBE);
  log.trace("Describe flags: {}", describeFlags);
  if (describeFlags != null) {
    send(request, describe(request, response, failure, describeFlags), httpResponse);
  }
  else {
    if (failure != null) {
      throw failure;
    }
    log.debug("Request: {}", request);
    sender.send(request, response, httpResponse);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:30,代码来源:ViewServlet.java

示例9: mockRepository

import org.sonatype.nexus.repository.view.ViewFacet; //导入依赖的package包/类
private void mockRepository() {
  when(repositoryManager.get(REPOSITORY_NAME)).thenReturn(repository);
  when(repository.getConfiguration()).thenReturn(configuration);
  when(repository.facet(ViewFacet.class)).thenReturn(viewFacet);
  when(repository.getFormat()).thenReturn(new Format("maven") { });
  when(configuration.isOnline()).thenReturn(true);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:8,代码来源:LegacyViewServletTest.java

示例10: forward

import org.sonatype.nexus.repository.view.ViewFacet; //导入依赖的package包/类
private Response forward(final Context context, final String path) throws Exception {
  log.trace("Forwarding request to path: {}", path);

  Request request = new Request.Builder()
      .copy(context.getRequest())
      .path(path)
      .build();

  return context.getRepository()
      .facet(ViewFacet.class)
      .dispatch(request);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:13,代码来源:IndexHtmlForwardHandler.java


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