本文整理汇总了Java中org.eclipse.jetty.http.HttpMethod.DELETE属性的典型用法代码示例。如果您正苦于以下问题:Java HttpMethod.DELETE属性的具体用法?Java HttpMethod.DELETE怎么用?Java HttpMethod.DELETE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jetty.http.HttpMethod
的用法示例。
在下文中一共展示了HttpMethod.DELETE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteJail
@Endpoint(method = HttpMethod.DELETE, path = "jail/:name", perm = "jail.delete")
public void deleteJail(IServletData data, String name) {
Optional<NucleusJailService> optSrv = NucleusAPI.getJailService();
if (!optSrv.isPresent()) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Nuclues jail service not available");
return;
}
NucleusJailService srv = optSrv.get();
Optional<CachedNamedLocation> optRes = WebAPIAPI.runOnMain(() -> {
Optional<NamedLocation> optJail = srv.getJail(name);
if (!optJail.isPresent()) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Jail not found");
return null;
}
srv.removeJail(name);
return new CachedNamedLocation(optJail.get());
});
data.addData("ok", optRes.isPresent(), false);
data.addData("jail", optRes.orElse(null), true);
}
示例2: deleteKit
@Endpoint(method = HttpMethod.DELETE, path = "kit/:name", perm = "kit.delete")
public void deleteKit(IServletData data, String name) {
Optional<NucleusKitService> optSrv = NucleusAPI.getKitService();
if (!optSrv.isPresent()) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Nuclues kit service not available");
return;
}
NucleusKitService srv = optSrv.get();
Optional<CachedKit> optRes = WebAPIAPI.runOnMain(() -> {
Optional<Kit> optKit = srv.getKit(name);
if (!optKit.isPresent()) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Kit not found");
return null;
}
srv.removeKit(name);
return new CachedKit(optKit.get());
});
data.addData("ok", optRes.isPresent(), false);
data.addData("kit", optRes.orElse(null), true);
}
示例3: removeEntity
@Endpoint(method = HttpMethod.DELETE, path = "/:entity", perm = "delete")
public void removeEntity(ServletData data, CachedEntity entity) {
Optional<Boolean> deleted = WebAPI.runOnMain(() -> {
Optional<Entity> live = entity.getLive();
if (!live.isPresent())
return false;
live.get().remove();
return true;
});
if (!deleted.isPresent() || !deleted.get()) {
data.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not delete entity " + entity.getUUID());
return;
}
cacheService.removeEntity(entity.getUUID());
data.addData("ok", true, false);
data.addData("entity", entity, true);
}
示例4: deleteCrate
@Endpoint(method = HttpMethod.DELETE, path = "crate/:id", perm = "crate.delete")
public void deleteCrate(IServletData data, String id) {
HuskyCrates plugin = getHuskyPlugin(data);
if (plugin == null) return;
Optional<CachedVirtualCrate> optCrate = WebAPIAPI.runOnMain(() -> {
VirtualCrate crate = plugin.crateUtilities.getVirtualCrate(id);
if (crate == null) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Crate not found");
return null;
}
try {
ConfigurationNode node = node = plugin.crateConfig.load();
node.getNode("crates").removeChild(crate.id);
plugin.crateConfig.save(node);
plugin.crateUtilities.generateVirtualCrates(plugin.crateConfig);
return new CachedVirtualCrate(crate);
} catch (IOException e) {
return null;
}
});
data.addData("ok", optCrate.isPresent(), false);
data.addData("crate", optCrate.orElse(null), true);
}
示例5: deleteWebBook
@Endpoint(method = HttpMethod.DELETE, path = "/book/:id", perm = "book.delete")
public void deleteWebBook(IServletData data, String id) {
WebBook book = books.get(id);
if (book == null) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Book not found");
return;
}
books.remove(book.getId());
saveBooks();
data.addData("ok", true, false);
data.addData("book", book, true);
}
示例6: deleteWorld
@Endpoint(method = HttpMethod.DELETE, path = "/:world", perm = "delete")
public void deleteWorld(ServletData data, CachedWorld world) {
Optional<Boolean> deleted = WebAPI.runOnMain(() -> {
Optional<WorldProperties> optLive = world.getLiveProps();
if (!optLive.isPresent())
return false;
WorldProperties live = optLive.get();
try {
return Sponge.getServer().deleteWorld(live).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
if (WebAPI.reportErrors()) WebAPI.sentryCapture(e);
}
return false;
});
if (!deleted.isPresent() || !deleted.get()) {
data.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not delete world " + world.getName());
return;
}
cacheService.removeWorld(world.getUUID());
data.addData("ok", true, false);
data.addData("world", world, true);
}
示例7: deleteBlockOperation
@Endpoint(method = HttpMethod.DELETE, path = "/op/:uuid", perm = "op.delete")
public void deleteBlockOperation(ServletData data, UUID uuid) {
// Check block op
Optional<IBlockOperation> op = blockService.getBlockOperation(uuid);
if (!op.isPresent()) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Block operation with UUID '" +
uuid + "' could not be found");
return;
}
op.get().stop(null);
data.addData("ok", true, false);
data.addData("operation", op.get(), true);
}