本文整理汇总了Java中javax.ws.rs.container.Suspended类的典型用法代码示例。如果您正苦于以下问题:Java Suspended类的具体用法?Java Suspended怎么用?Java Suspended使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Suspended类属于javax.ws.rs.container包,在下文中一共展示了Suspended类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hello3
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@Path("3")
@GET
public void hello3(@Suspended final AsyncResponse asyncResponse,
// Inject the Vertx instance
@Context Vertx vertx){
System.err.println("Creating client");
HttpClientOptions options = new HttpClientOptions();
options.setSsl(true);
options.setTrustAll(true);
options.setVerifyHost(false);
HttpClient client = vertx.createHttpClient(options);
client.getNow(443,
"www.google.com",
"/robots.txt",
resp -> {
System.err.println("Got response");
resp.bodyHandler(body -> {
System.err.println("Got body");
asyncResponse.resume(Response.ok(body.toString()).build());
});
});
System.err.println("Created client");
}
示例2: asyncGet
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@GET
@Path("/simple")
public void asyncGet(@Suspended final AsyncResponse asyncResponse) {
new Thread(new Runnable() {
@Override
public void run() {
String result = veryExpensiveOperation();
asyncResponse.resume(result);
}
private String veryExpensiveOperation() {
return new MagicNumber(3) + "";
}
}).start();
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:17,代码来源:AsyncResource.java
示例3: hello6
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@Path("6")
@GET
public void hello6(@Suspended final AsyncResponse asyncResponse,
// Inject the Vertx instance
@Context Vertx vertx){
io.vertx.rxjava.core.Vertx rxVertx = io.vertx.rxjava.core.Vertx.newInstance(vertx);
System.err.println("Creating client");
WebClientOptions options = new WebClientOptions();
options.setSsl(true);
options.setTrustAll(true);
options.setVerifyHost(false);
WebClient client = WebClient.create(rxVertx, options);
Single<HttpResponse<io.vertx.rxjava.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
responseHandler.subscribe(body -> {
System.err.println("Got body");
asyncResponse.resume(Response.ok(body.body().toString()).build());
});
System.err.println("Created client");
}
示例4: async
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@ApiOperation(value = "displays openid config of google async",
hidden = true)
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/async")
public void async(@Suspended final AsyncResponse asyncResponse) throws InterruptedException,
ExecutionException {
final Future<Response> futureResponseFromClient = jaxrsClient.target("https://accounts.google.com/.well-known/openid-configuration").request().header(javax.ws.rs.core.HttpHeaders.USER_AGENT, "curl/7.55.1").async().get();
final Response responseFromClient = futureResponseFromClient.get();
try {
final String object = responseFromClient.readEntity(String.class);
asyncResponse.resume(object);
} finally {
responseFromClient.close();
}
}
示例5: getDashboards
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
/**
* 根据配置得到所有dashboards
*/
@GET
@Path("dashboard/getdashboards")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
@SuppressWarnings("unchecked")
public void getDashboards(@Suspended AsyncResponse response) {
CacheManager cacheManager = this.cm;
String result = dashboardManagement.getDashboards(cacheManager);
Map resultMap = new HashMap();
String codeString = "00";
String msgString = "获取配置信息成功";
if (StringHelper.isEmpty(result)) {
codeString = "01";
msgString = "获取配置信息失败或配置信息不存在";
}
resultMap.put("code", codeString);
resultMap.put("msg", msgString);
resultMap.put("data", result);
String resultMsg = JSONHelper.toString(resultMap);
response.resume(resultMsg);
}
示例6: loadAppIPLinkList
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
/**
* 应用监控:获取应用的IPLink
*
* @param data
* a json string ["[email protected]://127.0.0.1:8090/apphub","[email protected]://127.0.0.1:9090/testapp"]
* @param response
*/
@POST
@Path("profile/q/iplink")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void loadAppIPLinkList(String data, @Suspended AsyncResponse response) {
UAVHttpMessage message = new UAVHttpMessage();
message.setIntent("iplnk");
message.putRequest("appgpids", data);
LoadAppIPLinkListCB callback = new LoadAppIPLinkListCB();
callback.setResponse(response);
this.doHttpPost("uav.app.godeye.healthmanager.http.addr", "/hm/cache/q", message, callback);
}
示例7: loadMonitorDataFromCache
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
/**
*
* 从缓存查询最近1min的MonitorData
*
* @param data
* @param response
*/
private void loadMonitorDataFromCache(String data, @Suspended AsyncResponse response, String cacheKey) {
UAVHttpMessage message = new UAVHttpMessage();
message.setIntent("monitor");
message.putRequest("cache.query.json", data);
LoadMonitorDataFromCacheCB callback = new LoadMonitorDataFromCacheCB();
callback.setCacheKey(cacheKey);
callback.setData(data);
callback.setGodeyeCacheRegion(godeyeCacheRegion);
callback.setGodeyeFilterGroupCacheRegion(godeyeFilterGroupCacheRegion);
callback.setResponse(response);
this.doHttpPost("uav.app.godeye.healthmanager.http.addr", "/hm/cache/q", message, callback);
}
示例8: getAppLog
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
/**
* 显示当前app的最近实现的日志信息, 默认查询指定时间内的日志记录
*
* @return
*/
@GET
@Path("log/q/hm/{appid}")
@Deprecated
public void getAppLog(@PathParam("appid") String appid, @QueryParam("timespan") String timespan,
@QueryParam("psize") String pagesize, @Suspended AsyncResponse response) {
try {
// 默认:5分钟
long timeLength = DataConvertHelper.toLong(timespan, 1000 * 60 * 5);
// 默认不传limit
StringBuilder data = new StringBuilder("{\"appid\":\"").append(appid).append("\", \"endtime\":")
.append(System.currentTimeMillis() - timeLength);
if (pagesize != null && StringHelper.isNumeric(pagesize)) {
data.append(",\"psize\":").append(Long.parseLong(pagesize));
}
data.append("}");
queryAppLog(data.toString(), response);
}
catch (Exception e) {
logger.err(this, "Error:" + e.getMessage(), e);
}
}
示例9: noitifyStrategyQuery
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@SuppressWarnings({ "unchecked" })
@POST
@Path("notify/q/stgy/hm")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void noitifyStrategyQuery(String data, @Suspended AsyncResponse response) throws Exception {
Map<String, Object> params = JSONHelper.toObject(data, Map.class);
int pagesize = (int) params.get("pagesize");
int pageindex = (int) params.get("pageindex");
Map<String, String> strategyMap = new HashMap<String, String>();
strategyMap.put("keys", String.valueOf(params.get("inputValue")));
// 封装http请求数据
UAVHttpMessage message = new UAVHttpMessage();
message.putRequest("body", JSONHelper.toString(strategyMap));
message.setIntent("strategy.query");
NoitifyStrategyQuery callback = new NoitifyStrategyQuery();
callback.setResponse(response);
callback.setPageindex(pageindex);
callback.setPagesize(pagesize);
doHttpPost("uav.app.godeye.notify.strategy.http.addr", "/rtntf/oper", message, callback);
}
示例10: noitifyStrategyGet
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@POST
@Path("notify/get/stgy/hm")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void noitifyStrategyGet(String data, @Suspended AsyncResponse response) throws Exception {
Map<String, String> strategyMap = new HashMap<String, String>();
strategyMap.put("keys", data);
// 封装http请求数据
UAVHttpMessage message = new UAVHttpMessage();
message.putRequest("body", JSONHelper.toString(strategyMap));
message.setIntent("strategy.query");
NoitifyStrategyGetCB callback = new NoitifyStrategyGetCB();
callback.setResponse(response);
doHttpPost("uav.app.godeye.notify.strategy.http.addr", "/rtntf/oper", message, callback);
}
示例11: noitifyStrategyRemove
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@POST
@Path("notify/del/stgy/hm")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void noitifyStrategyRemove(String data, @Suspended AsyncResponse response) throws Exception {
// 封装http请求数据
UAVHttpMessage message = new UAVHttpMessage();
message.putRequest("body", data);
message.setIntent("strategy.remove");
NoitifyStrategyRemoveCB callback = new NoitifyStrategyRemoveCB();
callback.setResponse(response);
callback.setData(data);
doHttpPost("uav.app.godeye.notify.strategy.http.addr", "/rtntf/oper", message, callback);
}
示例12: groupFilterRemove
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@POST
@Path("filter/group/remove")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void groupFilterRemove(String data, @Suspended AsyncResponse response) {
Map<String, Object> param = JSONHelper.toObject(data, Map.class);
String emailListStr = String.valueOf(param.get("emailListName"));
String resultMsg = "{\"code\":\"00\",\"msg\":\"删除成功\"}";
Map<String, String> esistsMap = cm.getHash(godeyeFilterGroupCacheRegion, godeyeFilterGroupCacheRegionKey,
emailListStr);
if (esistsMap.get(emailListStr) != null) {
cm.delHash(godeyeFilterGroupCacheRegion, godeyeFilterGroupCacheRegionKey, emailListStr);
}
else {
resultMsg = "{\"code\":\"01\",\"msg\":\"邮箱组不存在\"}";
}
response.resume(resultMsg);
}
示例13: loadAllApps
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@POST
@Path("loadAllApps")
public void loadAllApps(@Suspended AsyncResponse response) {
Map<String, Object> data = new HashMap<String, Object>();
Map<String, Object> where = new HashMap<String, Object>();
data.put("where", where);
HashMap<String, Object> sort = new HashMap<String, Object>();
sort.put("values", "createtime");
sort.put("sortorder", "-1");
data.put("sort", sort);
Map<String, Object> jsonRequest = createHttpMapRequest(bussinessTypeQuery, data);
Map<String, String> callBackInput = createInput(null, null, "query");
manageHttpAsyncClientPost(manageTypeApp, jsonRequest, new AppHttpCallBack(response, callBackInput));
}
示例14: addApp
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@POST
@Path("addApp")
public void addApp(AppEntity appEntity, @Suspended AsyncResponse response) throws Exception {
Map<String, Object> data = new HashMap<String, Object>();
String appurl = XSSFilter(appEntity.getAppurl());
String id = XSSFilter(appEntity.getAppid());
String configpath = XSSFilter(appEntity.getConfigpath());
String ctime = df.format(new Date());
data.put("appid", id);
data.put("appurl", appurl);
data.put("configpath", configpath);
data.put("state", 1);
data.put("createtime", ctime);
data.put("operationtime", ctime);
data.put("operationuser", request.getSession(false).getAttribute("apphub.gui.session.login.user.id"));
Map<String, Object> jsonRequest = createHttpMapRequest(bussinessTypeCreate, data);
Map<String, String> callBackInput = createInput(id, appurl, "create");
callBackInput.put("configpath", configpath);
manageHttpAsyncClientPost(manageTypeApp, jsonRequest, new AppHttpCallBack(response, callBackInput));
}
示例15: addGroup
import javax.ws.rs.container.Suspended; //导入依赖的package包/类
@POST
@Path("addGroup")
public void addGroup(GroupEntity groupEntity, @Suspended AsyncResponse response) throws Exception {
String groupId = XSSFilter(groupEntity.getGroupid());
String appIds = XSSFilter(groupEntity.getAppids());
String time = df.format(new Date());
Map<String, Object> data = new HashMap<String, Object>();
data.put("groupid", groupId);
data.put("appids", appIds);
data.put("state", 1);
data.put("createtime", time);
data.put("operationtime", time);
data.put("operationuser", request.getSession(false).getAttribute("apphub.gui.session.login.user.id"));
Map<String, Object> jsonRequest = createHttpMapRequest(bussinessTypeCreate, data);
Map<String, String> callBackInput = createInput(groupId, appIds, "create");
manageHttpAsyncClientPost(manageTypeGroup, jsonRequest, new GroupHttpCallBack(response, callBackInput));
}