当前位置: 首页>>代码示例>>Java>>正文


Java AsyncResponse.resume方法代码示例

本文整理汇总了Java中javax.ws.rs.container.AsyncResponse.resume方法的典型用法代码示例。如果您正苦于以下问题:Java AsyncResponse.resume方法的具体用法?Java AsyncResponse.resume怎么用?Java AsyncResponse.resume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.ws.rs.container.AsyncResponse的用法示例。


在下文中一共展示了AsyncResponse.resume方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: groupFilterRemove

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的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);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:22,代码来源:GodEyeRestService.java

示例2: async

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的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();
    }
}
 
开发者ID:trajano,项目名称:app-ms,代码行数:19,代码来源:HelloResource.java

示例3: getDashboards

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的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);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:25,代码来源:GrafanaRestService.java

示例4: asyncLocalSpan

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
/**
 * Async endpoint which creates local span.
 * @param asyncResponse holds state of the asynchronous processing
 */
@GET
@Path(REST_ASYNC_LOCAL_SPAN)
@Produces(MediaType.TEXT_PLAIN)
public void asyncLocalSpan(@Suspended final AsyncResponse asyncResponse) {
    finishChildSpan(startChildSpan(REST_LOCAL_SPAN));
    asyncResponse.resume(Response.ok().build());
}
 
开发者ID:eclipse,项目名称:microprofile-opentracing,代码行数:12,代码来源:TestServerWebServices.java

示例5: groupFilterEdit

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@POST
@Path("filter/group/edit")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void groupFilterEdit(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) {
        Map<String, Object> old = JSONHelper.toObject(esistsMap.get(emailListStr), Map.class);

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String timeStr = simpleDateFormat.format(new Date());
        HttpSession session = request.getSession(false);
        String user = "";
        if (session != null) {
            user = String.valueOf(session.getAttribute("apphub.gui.session.login.user.id"));
        }

        Map<String, Object> saveInfo = new HashMap<String, Object>();
        saveInfo.put("emailListName", emailListStr);
        saveInfo.put("groupList", param.get("groupList"));
        saveInfo.put("createTime", old.get("createTime"));
        saveInfo.put("operationTime", timeStr);
        saveInfo.put("operationUser", user);
        saveInfo.put("state", old.get("state"));

        cm.delHash(godeyeFilterGroupCacheRegion, godeyeFilterGroupCacheRegionKey, emailListStr);
        cm.putHash(godeyeFilterGroupCacheRegion, godeyeFilterGroupCacheRegionKey, emailListStr,
                JSONHelper.toString(saveInfo));
    }

    response.resume(resultMsg);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:39,代码来源:GodEyeRestService.java

示例6: suspend

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
@ApiOperation(value = "displays hello world after 2 seconds")
@GET
@Path("/suspend")
@Produces(MediaType.TEXT_PLAIN)
public void suspend(@Suspended final AsyncResponse asyncResponse) throws InterruptedException {

    Thread.sleep(2000);
    asyncResponse.resume(Response.ok("hello").build());
}
 
开发者ID:trajano,项目名称:app-ms,代码行数:10,代码来源:HelloResource.java

示例7: upload

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
@ApiOperation(value = "upload a file")
@POST
@Path("/upload")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void upload(
    final MultipartFormDataInput input,
    @Suspended final AsyncResponse asyncResponse) throws IOException {

    final JsonObject json = new JsonObject();
    final Map<String, List<InputPart>> uploadForm = input.getFormDataMap();
    final List<InputPart> inputParts = uploadForm.get("uploadedFile");

    for (final InputPart inputPart : inputParts) {

        final MultivaluedMap<String, String> header = inputPart.getHeaders();
        final String fileName = getFileName(header);

        //fromJson the uploaded file to inputstream
        final InputStream inputStream = inputPart.getBody(InputStream.class, null);
        int c = 0;
        while (inputStream.read() != -1) {
            ++c;
        }

        json.add(fileName, new JsonPrimitive(c));
    }
    asyncResponse.resume(json);
}
 
开发者ID:trajano,项目名称:app-ms,代码行数:30,代码来源:HelloResource.java

示例8: suspend

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
@ApiOperation(value = "displays hello world after a given amount of seconds seconds")
@GET
@Path("/suspend/{seconds}")
@Produces(MediaType.TEXT_PLAIN)
public void suspend(@Suspended final AsyncResponse asyncResponse,
    @PathParam("seconds") final int seconds) throws InterruptedException {

    Thread.sleep(seconds * 1000L);
    asyncResponse.resume(Response.ok("hello").build());
}
 
开发者ID:trajano,项目名称:app-ms,代码行数:11,代码来源:SecureHelloResource.java

示例9: loadUserManageInfo

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
/**
 * 获取主页用户管理信息
 * 
 * @return
 */
@GET
@Path("loadUserManageInfo")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void loadUserManageInfo(@Suspended AsyncResponse response) {

    String result = "";
    String userGroup = String
            .valueOf(request.getSession(false).getAttribute("apphub.gui.session.login.user.group"));
    Map<String, String> manageGroup = cm.getHashAll("apphub.gui.cache", "manage.group");

    // 授权匹配
    if (manageGroup.containsKey(userGroup)) {
        Map<String, String> userManageInfo = new HashMap<String, String>();
        String[] userManAppids = manageGroup.get(userGroup).split(",");
        for (String appid : userManAppids) {
            Map<String, String> appinfo = cm.getHash("apphub.gui.cache", "manage.app", appid);
            userManageInfo.putAll(appinfo);
        }
        result = JSONHelper.toString(userManageInfo);
    }

    logger.info(this, "\r\nloadUserManageInfo\r\nuserGroup:" + userGroup + "\r\nmanageGroup:" + manageGroup
            + " \r\nresult:" + result);

    response.resume(result);

}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:33,代码来源:GUIService.java

示例10: createDashboards

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public void createDashboards(String configString, String contextPath, HttpServletRequest request, CacheManager cm,
        AsyncResponse response) {

    List<Map> configs = JSONHelper.toObjectArray(configString, Map.class);

    Map<String, Object> valueObjNewMap = getValueObjNewMap(configs);
    int countFailed = 0;
    List<String> listFailed = new ArrayList<String>();

    for (String appgroupName : valueObjNewMap.keySet()) {
        String orgId = getOrCreateOrgId(contextPath, appgroupName);

        Map<String, List> appidNewMap = (Map) valueObjNewMap.get(appgroupName);
        for (Map.Entry<String, List> entry : appidNewMap.entrySet()) {
            boolean createFd = callGrafanaDashBoardCreate(entry, request, contextPath, cm, appgroupName, orgId);
            if (createFd) {
                countFailed++;
                String strFailed = appgroupName + "___" + entry.getKey();
                listFailed.add(strFailed);
            }
        }
    }

    Map<String, String> resultMap = new HashMap<String, String>();
    String msgFailed = JSONHelper.toString(listFailed);
    String msgString = "有" + countFailed + "个dashboard创建失败";
    resultMap.put("code", "00");
    resultMap.put("msg", msgString);
    resultMap.put("data", msgFailed);
    String resultMsg = JSONHelper.toString(resultMap);
    response.resume(resultMsg);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:34,代码来源:DashboardManagement.java

示例11: deleteDashboard

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void deleteDashboard(String data, CacheManager cm, final AsyncResponse response) {

    Map<String, String> dataMap = JSONHelper.toObject(data, Map.class);
    String orgName = dataMap.get("appgroup");
    String dashboardName = dataMap.get("appid");
    String orgGroupKey = orgName + "___" + dashboardName;

    Map<String, String> orgIdMap = getRetCodeAndOrgId(orgName);
    String resultMsg = "{\"code\":\"00\",\"msg\":\"该dashboard所属的org不存在,仅删除配置信息\"}";
    if (orgIdMap.get("retCode").equals("404")) {
        cm.delHash(STORE_REGION_GODCOMPASSCACHE, STORE_KEY_GRAFANACONFIG, orgGroupKey);
        if (response != null) {
            response.resume(resultMsg);
        }
    }
    else if (orgIdMap.get("retCode").equals("200")) {
        Map<String, String> deleteHeader = new HashMap<String, String>();
        deleteHeader.put("X-Grafana-Org-Id", orgIdMap.get("orgId"));
        HttpResponse resDel = grafanaClient.doHttp("delete", "/api/dashboards/db/" + dashboardName.toLowerCase(),
                null, deleteHeader, null);

        if (resDel.getStatusLine().getStatusCode() == 200) {
            resultMsg = "{\"code\":\"00\",\"msg\":\"删除dashboard成功\"}";
            cm.delHash(STORE_REGION_GODCOMPASSCACHE, STORE_KEY_GRAFANACONFIG, orgGroupKey);
        }
        else if (resDel.getStatusLine().getStatusCode() == 404) {
            resultMsg = "{\"code\":\"00\",\"msg\":\"该dashboard不存在,仅删除配置信息\"}";
            cm.delHash(STORE_REGION_GODCOMPASSCACHE, STORE_KEY_GRAFANACONFIG, orgGroupKey);
        }
        if (response != null) {
            response.resume(resultMsg);
        }
    }

}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:37,代码来源:DashboardManagement.java

示例12: groupFilterQuery

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
@GET
@Path("filter/group/query")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void groupFilterQuery(@Suspended AsyncResponse response) {

    Map<String, String> resultMap = cm.getHashAll(godeyeFilterGroupCacheRegion, godeyeFilterGroupCacheRegionKey);
    response.resume(JSONHelper.toString(resultMap));
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:9,代码来源:GodEyeRestService.java

示例13: loadAppProfileList

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
/**
 * 应用服务监控:全网应用Profile SnapShot
 * 
 * @return
 */
@GET
@Path("profile/q/cache")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void loadAppProfileList(@QueryParam("fkey") String fkey, @QueryParam("fvalue") String fvalue,
        @Suspended AsyncResponse response) {

    UAVHttpMessage message = new UAVHttpMessage();
    message.setIntent("profile");
    if (StringHelper.isEmpty(fkey) || StringHelper.isEmpty(fvalue)) {
        String groups = getUserGroupsByFilter(request);
        if ("NOMAPPING".equals(groups)) {
            response.resume("{\"rs\":\"{}\"}");
        }
        else if ("ALL".equals(groups)) {
            loadAppProfileListFromHttp(message, response);
        }
        else {
            message.putRequest("fkey", "appgroup");
            message.putRequest("fvalue", groups);
            loadAppProfileListFromHttp(message, response);
        }
    }
    else {
        message.putRequest("fkey", fkey);
        message.putRequest("fvalue", fvalue);
        loadAppProfileListFromHttp(message, response);
    }

}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:35,代码来源:GodEyeRestService.java

示例14: loadUavNetworkInfo

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
/**
 * 应用容器监控+UAV节点信息
 * 
 * @return
 */
@GET
@Path("node/q/cache")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void loadUavNetworkInfo(@QueryParam("fkey") String fkey, @QueryParam("fvalue") String fvalue,
        @Suspended AsyncResponse response) {

    UAVHttpMessage message = new UAVHttpMessage();
    message.setIntent("node");

    if (StringHelper.isEmpty(fkey) || StringHelper.isEmpty(fvalue)) {
        String groups = getUserGroupsByFilter(request);
        if ("NOMAPPING".equals(groups)) {
            response.resume("{\"rs\":\"{}\"}");
        }
        else if ("ALL".equals(groups)) {
            loadUavNetworkInfoFromHttp(message, response);
        }
        else {
            message.putRequest("fkey", "group");
            message.putRequest("fvalue", groups);
            loadUavNetworkInfoFromHttp(message, response);
        }
    }
    else {
        message.putRequest("fkey", fkey);
        message.putRequest("fvalue", fvalue);
        loadUavNetworkInfoFromHttp(message, response);
    }

}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:36,代码来源:GodEyeRestService.java

示例15: ping

import javax.ws.rs.container.AsyncResponse; //导入方法依赖的package包/类
@GET
public void ping(@Suspended AsyncResponse response) {
    response.setTimeout(1, TimeUnit.NANOSECONDS);
    System.out.println(".");
    response.resume("Java EE 8 is crazy fast!");
}
 
开发者ID:AdamBien,项目名称:javaee-calculator,代码行数:7,代码来源:PingResource.java


注:本文中的javax.ws.rs.container.AsyncResponse.resume方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。