本文整理匯總了Java中org.onosproject.vtnweb.web.SubnetCodec類的典型用法代碼示例。如果您正苦於以下問題:Java SubnetCodec類的具體用法?Java SubnetCodec怎麽用?Java SubnetCodec使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SubnetCodec類屬於org.onosproject.vtnweb.web包,在下文中一共展示了SubnetCodec類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSubnet
import org.onosproject.vtnweb.web.SubnetCodec; //導入依賴的package包/類
@GET
@Path("{subnetUUID}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response getSubnet(@PathParam("subnetUUID") String id) {
if (!get(SubnetService.class).exists(SubnetId.subnetId(id))) {
return Response.status(NOT_FOUND)
.entity(SUBNET_NOT_FOUND).build();
}
Subnet sub = nullIsNotFound(get(SubnetService.class)
.getSubnet(SubnetId.subnetId(id)),
SUBNET_NOT_FOUND);
ObjectNode result = new ObjectMapper().createObjectNode();
result.set("subnet", new SubnetCodec().encode(sub, this));
return ok(result.toString()).build();
}
示例2: listSubnets
import org.onosproject.vtnweb.web.SubnetCodec; //導入依賴的package包/類
@GET
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response listSubnets() {
Iterable<Subnet> subnets = get(SubnetService.class).getSubnets();
ObjectNode result = new ObjectMapper().createObjectNode();
result.set("subnets", new SubnetCodec().encode(subnets, this));
return ok(result.toString()).build();
}