本文整理匯總了Java中org.eclipse.jetty.http.HttpMethod.GET屬性的典型用法代碼示例。如果您正苦於以下問題:Java HttpMethod.GET屬性的具體用法?Java HttpMethod.GET怎麽用?Java HttpMethod.GET使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jetty.http.HttpMethod
的用法示例。
在下文中一共展示了HttpMethod.GET屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getJails
@Endpoint(method = HttpMethod.GET, path = "jail", perm = "jail.list")
public void getJails(IServletData data) {
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<List<CachedNamedLocation>> optRes = WebAPIAPI.runOnMain(
() -> srv.getJails().values().stream().map(CachedNamedLocation::new).collect(Collectors.toList())
);
data.addData("ok", optRes.isPresent(), false);
data.addData("jails", optRes.orElse(null), data.getQueryParam("details").isPresent());
}
示例2: getJail
@Endpoint(method = HttpMethod.GET, path = "jail/:name", perm = "jail.one")
public void getJail(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;
}
return new CachedNamedLocation(optJail.get());
});
data.addData("ok", optRes.isPresent(), false);
data.addData("jail", optRes.orElse(null), true);
}
示例3: getInfo
@Endpoint(method = HttpMethod.GET, path = "/", perm = "get")
public void getInfo(ServletData data) {
Optional<Boolean> optRes = WebAPI.runOnMain(() -> {
Server server = Sponge.getServer();
Platform platform = Sponge.getPlatform();
data.addData("motd", server.getMotd().toPlain(), false);
data.addData("players", server.getOnlinePlayers().size(), false);
data.addData("maxPlayers", server.getMaxPlayers(), false);
data.addData("address", server.getBoundAddress().map(Object::toString).orElse(null), false);
data.addData("onlineMode", server.getOnlineMode(), false);
data.addData("resourcePack", server.getDefaultResourcePack().orElse(null), false);
data.addData("hasWhitelist", server.hasWhitelist(), false);
data.addData("uptimeTicks", server.getRunningTimeTicks(), false);
data.addData("tps", server.getTicksPerSecond(), false);
data.addData("minecraftVersion", platform.getMinecraftVersion().getName(), false);
data.addData("game", platform.getContainer(Platform.Component.GAME), true);
data.addData("api", platform.getContainer(Platform.Component.API), true);
data.addData("implementation", platform.getContainer(Platform.Component.IMPLEMENTATION), true);
return true;
});
data.addData("ok", optRes.orElse(false), false);
}
示例4: getTileEntity
@Endpoint(method = HttpMethod.GET, path = "/:world/:x/:y/:z", perm = "one")
public void getTileEntity(ServletData data, CachedWorld world, int x, int y, int z) {
Optional<ICachedTileEntity> te = cacheService.getTileEntity(world, x, y, z);
if (!te.isPresent()) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Tile entity in world '" + world.getName() + "' at [" + x + "," + y + "," + z + "] could not be found");
return;
}
Optional<String> strFields = data.getQueryParam("fields");
Optional<String> strMethods = data.getQueryParam("methods");
if (strFields.isPresent() || strMethods.isPresent()) {
String[] fields = strFields.map(s -> s.split(",")).orElse(new String[]{});
String[] methods = strMethods.map(s -> s.split(",")).orElse(new String[]{});
Tuple extra = cacheService.getExtraData(te.get(), data.responseIsXml(), fields, methods);
data.addData("fields", extra.getFirst(), true);
data.addData("methods", extra.getSecond(), true);
}
data.addData("ok", true, false);
data.addData("tileEntity", te.get(), true);
}
示例5: getCrate
@Endpoint(method = HttpMethod.GET, path = "crate/:id", perm = "crate.one")
public void getCrate(IServletData data, String id) {
HuskyCrates plugin = getHuskyPlugin(data);
if (plugin == null) return;
Optional<CachedVirtualCrate> optRes = WebAPIAPI.runOnMain(() -> {
VirtualCrate crate = plugin.crateUtilities.getVirtualCrate(id);
if (crate == null) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Crate not found");
return null;
}
return new CachedVirtualCrate(crate);
});
data.addData("ok", optRes.isPresent(), false);
data.addData("crate", optRes.orElse(null), true);
}
示例6: getTickets
@Endpoint(method = HttpMethod.GET, path = "/ticket", perm = "list")
public void getTickets(IServletData data) {
Main plugin = getMMCTicketsPlugin(data);
if (plugin == null) return;
Optional<List<CachedTicketData>> optTickets = WebAPIAPI.runOnMain(() -> {
List<CachedTicketData> tickets = new ArrayList<>();
for (TicketData ticket : plugin.getTickets()) {
tickets.add(new CachedTicketData(ticket));
}
return tickets;
});
data.addData("ok", optTickets.isPresent(), false);
data.addData("tickets", optTickets.orElse(null), data.getQueryParam("details").isPresent());
}
示例7: getRegistry
@Endpoint(method = HttpMethod.GET, path = "/:class", perm = "one")
public void getRegistry(ServletData data, String className) {
try {
Class rawType = Class.forName(className);
if (!CatalogType.class.isAssignableFrom(rawType)) {
data.sendError(HttpServletResponse.SC_BAD_REQUEST, "Class must be a CatalogType");
return;
}
Class<? extends CatalogType> type = rawType;
if (registryCache.containsKey(type)) {
data.addData("ok", true, false);
data.addData("types", registryCache.get(type), false);
return;
}
Optional<Collection<? extends CatalogType>> optTypes = WebAPI.runOnMain(() -> Sponge.getRegistry().getAllOf(type));
optTypes.map(types -> registryCache.put(type, types));
data.addData("ok", optTypes.isPresent(), false);
data.addData("types", optTypes.orElse(null), false);
} catch (ClassNotFoundException e) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Class " + className + " could not be found");
}
}
示例8: getMessages
@Endpoint(method = HttpMethod.GET, path = "/", perm = "list")
public void getMessages(IServletData data) {
List<IMessage> msgs = messageService.getMessages();
data.addData("ok", true, false);
data.addData("messages", msgs, data.getQueryParam("details").isPresent());
}
示例9: getPlugin
@Endpoint(method = HttpMethod.GET, path = "/:plugin", perm = "one")
public void getPlugin(ServletData data, String pluginName) {
Optional<ICachedPluginContainer> optPlugin = cacheService.getPlugin(pluginName);
if (!optPlugin.isPresent()) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Plugin with id '" + pluginName + "' could not be found");
return;
}
data.addData("ok", true, false);
data.addData("plugin", optPlugin.get(), true);
}
示例10: getWebBook
@Endpoint(method = HttpMethod.GET, path = "/book/:id", perm = "book.one")
public void getWebBook(IServletData data, String id) {
WebBook book = books.get(id);
if (book == null) {
data.sendError(HttpServletResponse.SC_NOT_FOUND, "Book not found");
return;
}
data.addData("ok", true, false);
data.addData("book", book, true);
}
示例11: getStats
@Endpoint(method = HttpMethod.GET, path = "/stats", perm = "stats")
public void getStats(ServletData data) {
data.addData("ok", true, true);
data.addData("tps", serverService.getAverageTps(), false);
data.addData("players", serverService.getOnlinePlayers(), false);
data.addData("cpu", serverService.getCpuLoad(), false);
data.addData("memory", serverService.getMemoryLoad(), false);
data.addData("disk", serverService.getDiskUsage(), false);
}
示例12: getServlets
@Endpoint(method = HttpMethod.GET, path = "/", perm = "list")
public void getServlets(ServletData data) {
Map<String, Class<? extends BaseServlet>> servlets = servletService.getLoadedServlets();
data.addData("ok", true, false);
data.addData("servlets", servlets, false);
}
示例13: getEntity
@Endpoint(method = HttpMethod.GET, path = "/:entity", perm = "one")
public void getEntity(ServletData data, CachedEntity entity) {
Optional<String> strFields = data.getQueryParam("fields");
Optional<String> strMethods = data.getQueryParam("methods");
if (strFields.isPresent() || strMethods.isPresent()) {
String[] fields = strFields.map(s -> s.split(",")).orElse(new String[]{});
String[] methods = strMethods.map(s -> s.split(",")).orElse(new String[]{});
Tuple extra = cacheService.getExtraData(entity, data.responseIsXml(), fields, methods);
data.addData("fields", extra.getFirst(), true);
data.addData("methods", extra.getSecond(), true);
}
data.addData("ok", true, false);
data.addData("entity", entity, true);
}
示例14: getPlugins
@Endpoint(method = HttpMethod.GET, path = "/", perm = "list")
public void getPlugins(ServletData data) {
data.addData("ok", true, false);
data.addData("plugins", cacheService.getPlugins(), data.getQueryParam("details").isPresent());
}
示例15: listWebBooks
@Endpoint(method = HttpMethod.GET, path = "/book", perm = "book.list")
public void listWebBooks(IServletData data) {
data.addData("ok", true, false);
data.addData("books", books.values(), data.getQueryParam("details").isPresent());
}