Exemplo n.º 1
0
 @GET
 @Path("/containers")
 @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
 public ContainersInfo getNodeContainers() {
   init();
   ContainersInfo allContainers = new ContainersInfo();
   for (Entry<ContainerId, Container> entry : this.nmContext.getContainers().entrySet()) {
     if (entry.getValue() == null) {
       // just skip it
       continue;
     }
     ContainerInfo info =
         new ContainerInfo(
             this.nmContext, entry.getValue(), uriInfo.getBaseUri().toString(), webapp.name());
     allContainers.add(info);
   }
   return allContainers;
 }
Exemplo n.º 2
0
  @GET
  @Path("/containers/{containerid}")
  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  public ContainerInfo getNodeContainer(@PathParam("containerid") String id) {
    ContainerId containerId = null;
    init();
    try {
      containerId = ConverterUtils.toContainerId(id);
    } catch (Exception e) {
      throw new BadRequestException("invalid container id, " + id);
    }

    Container container = nmContext.getContainers().get(containerId);
    if (container == null) {
      throw new NotFoundException("container with id, " + id + ", not found");
    }
    return new ContainerInfo(
        this.nmContext, container, uriInfo.getBaseUri().toString(), webapp.name());
  }