Java Code Examples for javax.ws.rs.container.AsyncResponse#resume()
The following examples show how to use
javax.ws.rs.container.AsyncResponse#resume() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppStyleAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "设置图片:登陆页面默认头像图片.", action = ActionImageLoginAvatarErase.class) @GET @Path("image/login/avatar/erase") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void imageLoginAvatarErase(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) { ActionResult<ActionImageLoginAvatarErase.Wo> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionImageLoginAvatarErase().execute(effectivePerson); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 2
Source File: AttachmentAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "根据ID删除附件信息对象", action = ActionDelete.class) @DELETE @Path( "{id}" ) @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void delete( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("附件ID") @PathParam( "id" ) String id) { EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult<ActionDelete.Wo> result = new ActionResult<>(); try { result = new ActionDelete().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); logger.warn( "系统根据ID删除附件信息对象过程发生异常。" ); logger.error( e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 3
Source File: CalendarAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "根据ID删除日历信息及所有事件", action = ActionDelete.class) @DELETE @Path("{id}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void destory(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("日历信息ID") @PathParam("id") String id) { ActionResult<ActionDelete.Wo> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); Boolean check = true; if (check) { try { result = ((ActionDelete) proxy.getProxy(ActionDelete.class)).execute(request, effectivePerson, id); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCalendarInfoProcess(e, "根据ID删除日历信息及所有事件时发生异常!"); result.error(exception); logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 4
Source File: BuildingAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "根据拼音或者首字母进行模糊查询.", action = ActionListLikePinyin.class) @GET @Path("/list/like/pinyin/{key}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void listLikePinyin(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @PathParam("key") String key) { ActionResult<List<ActionListLikePinyin.Wo>> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionListLikePinyin().execute(effectivePerson, key); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 5
Source File: CalendarAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "判断当前用户是否对指定的日历有管理员权限", action = ActionIsCalendarManager.class) @GET @Path("ismanager/calendar/{accountId}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void isCalendarManager(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("指定的日历ID") String accountId) { ActionResult<WrapOutBoolean> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); Boolean check = true; if (check) { try { result = ((ActionIsCalendarManager) proxy.getProxy(ActionIsCalendarManager.class)).execute(request, effectivePerson, accountId); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCalendarInfoProcess(e, "判断当前用户是否对指定的日历有管理员权限时发生异常!"); result.error(exception); logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 6
Source File: FileAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "下载文件,以附件方式,不输出contentType头.", action = ActionDownloadStream.class) @GET @Path("{id}/download/stream") @Consumes(MediaType.APPLICATION_JSON) public void downloadStream(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("文件标识") @PathParam("id") String id) { ActionResult<ActionDownloadStream.Wo> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionDownloadStream().execute(effectivePerson, id); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 7
Source File: UnitAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "根据身份获取递归上级组织中type为指定type的组织.", action = ActionGetWithIdentityWithType.class) @GET @Path("identity/{identityFlag}/type/{type}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) public void getWithIdentityWithType(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("组织标识") @PathParam("identityFlag") String identityFlag, @JaxrsParameterDescribe("组织类型") @PathParam("type") String type) { ActionResult<ActionGetWithIdentityWithType.Wo> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionGetWithIdentityWithType().execute(effectivePerson, identityFlag, type); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 8
Source File: RecordAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "根据工作或完成工作标识获取记录分页.", action = ActionListWithWorkOrWorkCompletedPaging.class) @GET @Path("list/workorworkcompleted/{workOrWorkCompleted}/paging/{page}/size/{size}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void listWithWorkOrWorkCompletedPaging(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("工作或完成工作标识") @PathParam("workOrWorkCompleted") String workOrWorkCompleted, @JaxrsParameterDescribe("分页") @PathParam("page") Integer page, @JaxrsParameterDescribe("数量") @PathParam("size") Integer size) { ActionResult<List<ActionListWithWorkOrWorkCompletedPaging.Wo>> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionListWithWorkOrWorkCompletedPaging().execute(effectivePerson, workOrWorkCompleted, page, size); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 9
Source File: ConsumeAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "获取消息.", action = ActionList.class) @GET @Path("list/{consume}/count/{count}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void list(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("消费者") @PathParam("consume") String consume, @JaxrsParameterDescribe("数量") @PathParam("count") Integer count) { ActionResult<List<ActionList.Wo>> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionList().execute(effectivePerson, consume, count); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 10
Source File: PageAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "列示属于指定Portal的Page,其中Portal可以用name,alias和id标识,Page为在此Portal下的页面Mobile.", action = ActionGetWithPortalMobile.class) @GET @Path("{flag}/portal/{portalFlag}/mobile") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void getWithPortalMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("flag") String flag, @JaxrsParameterDescribe("门户标识") @PathParam("portalFlag") String portalFlag) { ActionResult<ActionGetWithPortalMobile.Wo> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionGetWithPortalMobile().execute(effectivePerson, flag, portalFlag); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 11
Source File: PeriodAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "获取过去12个月中每月的Work创建量,统计work和workCompleted,按application分项统计,(0)作为占位符.", action = ActionListCountStartWorkByApplication.class) @GET @Path("list/count/start/work/unit/{unit}/person/{person}/by/application") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void listCountStartWorkByApplication(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("组织标识") @PathParam("unit") String unit, @JaxrsParameterDescribe("个人标识") @PathParam("person") String person) { ActionResult<ActionListCountStartWorkByApplication.Wo> result = new ActionResult<>(); try { result = new ActionListCountStartWorkByApplication().execute(unit, person); } catch (Exception e) { e.printStackTrace(); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 12
Source File: AttendanceSelfHolidaySimpleAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "根据流程文档ID删除员工休假申请数据对象", action = ActionDeleteByWfDocId.class) @DELETE @Path("docId/{docId}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void deleteByWfDocId(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @PathParam("docId") String docId) { ActionResult<ActionDeleteByWfDocId.Wo> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); Boolean check = true; if (check) { try { result = new ActionDeleteByWfDocId().execute(request, effectivePerson, docId); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAttendanceProcess(e, "根据流程文档ID删除员工休假申请信息时发生异常!"); result.error(exception); logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 13
Source File: Folder2Action.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "删除分类,同时删除所有下属的文件和文件夹.", action = ActionDelete.class) @DELETE @Path("{id}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id) { ActionResult<ActionDelete.Wo> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionDelete().execute(effectivePerson, id); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 14
Source File: FormAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "根据工作或完成工作标识获取表单.", action = ActionGetWithWorkOrWorkCompleted.class) @GET @Path("workorworkcompleted/{workOrWorkCompleted}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void getWithWorkOrWorkCompleted(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("工作或完成工作标识") @PathParam("workOrWorkCompleted") String workOrWorkCompleted) { ActionResult<JsonElement> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionGetWithWorkOrWorkCompleted().execute(effectivePerson, workOrWorkCompleted); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } /* 修改过的方法 */ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 15
Source File: OkrAttachmentFileInfoAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "根据ID下载指定附件", action = ActionReportAttachmentDownload.class) @GET @Path("download/report/{id}") @Consumes(MediaType.APPLICATION_JSON) public void reportAttachmentDownLoad(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("附件标识") @PathParam("id") String id) { ActionResult<ActionReportAttachmentDownload.Wo> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionReportAttachmentDownload().execute(request, effectivePerson, id); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 16
Source File: CategoryInfoAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "根据别名获取分类信息对象.", action = ActionGet.class) @GET @Path("alias/{alias}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void getByAlias( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("栏目别名") @PathParam("alias") String alias ) { EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult<ActionGetByAlias.Wo> result = null; try { result = ((ActionGetByAlias)proxy.getProxy(ActionGetByAlias.class)).execute( request, alias, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据标识查询分类信息对象时发生异常。ALIAS:"+ alias ); result.error( exception ); logger.error( e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 17
Source File: TableAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "列示表中的行对象,下一页.", action = ActionListRowNext.class) @GET @Path("list/{tableFlag}/row/{id}/next/{count}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void listRowNext(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("表标识") @PathParam("tableFlag") String tableFlag, @JaxrsParameterDescribe("标识") @PathParam("id") String id, @JaxrsParameterDescribe("数量") @PathParam("count") Integer count) { ActionResult<List<JsonObject>> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionListRowNext().execute(effectivePerson, tableFlag, id, count); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 18
Source File: OkrAttachmentFileInfoAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@JaxrsMethodDescribe(value = "根据ID获取工作附件信息对象", action = ActionGet.class) @GET @Path("{id}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("附件信息ID") @PathParam("id") String id) { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult<ActionGet.Wo> result = new ActionResult<>(); try { result = new ActionGet().execute(request, effectivePerson, id); } catch (Exception e) { result = new ActionResult<>(); logger.warn("系统附件信息ID查询附件信息过程发生异常。"); logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); }
Example 19
Source File: MyResource.java From training with MIT License | 5 votes |
@GET @Path("async") public void asyncInvokeServer(@Suspended final AsyncResponse response0) { log.debug("Start"); InvocationCallback<String> callback = new InvocationCallback<String>() { @Override public void completed(String response) { response0.resume(Response.ok("Received response from endpoint2: "+ response).build()); log.debug("Received response from 2nd endpoint. Resuming the original response which was previously suspended"); } @Override public void failed(Throwable throwable) { } }; log.debug("Sending async request to 2nd endpoint"); Client client = ClientBuilder.newClient(); URI uri = UriBuilder.fromUri(baseUrl + "/rest/endpoint2/{pathParam}") .queryParam("queryParam", "qp") .build("pp"); client.target(uri) .request() .async() .get(callback); log.debug("Exiting resource method (freeing thread). My current response will remain suspended until I get a response..."); }
Example 20
Source File: UsersResource.java From graviteeio-access-management with Apache License 2.0 | 4 votes |
@POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @ApiOperation(value = "Create a user on the specified security domain", notes = "User must have the DOMAIN_USER[CREATE] permission on the specified domain " + "or DOMAIN_USER[CREATE] permission on the specified environment " + "or DOMAIN_USER[CREATE] permission on the specified organization") @ApiResponses({ @ApiResponse(code = 201, message = "User successfully created"), @ApiResponse(code = 500, message = "Internal server error")}) public void create( @PathParam("organizationId") String organizationId, @PathParam("environmentId") String environmentId, @PathParam("domain") String domain, @ApiParam(name = "user", required = true) @Valid @NotNull final NewUser newUser, @Suspended final AsyncResponse response) { final io.gravitee.am.identityprovider.api.User authenticatedUser = getAuthenticatedUser(); // user must have a password in no pre registration mode if (!newUser.isPreRegistration() && newUser.getPassword() == null) { response.resume(new UserInvalidException(("Field [password] is required"))); return; } // check password policy if (newUser.getPassword() != null) { if (!passwordValidator.validate(newUser.getPassword())) { response.resume(new UserInvalidException(("Field [password] is invalid"))); return; } } checkAnyPermission(organizationId, environmentId, domain, Permission.DOMAIN_USER, Acl.CREATE) .andThen(domainService.findById(domain) .switchIfEmpty(Maybe.error(new DomainNotFoundException(domain))) .flatMapSingle(userProvider -> userService.create(domain, newUser, authenticatedUser)) .map(user -> Response .created(URI.create("/organizations/" + organizationId + "/environments/" + environmentId + "/domains/" + domain + "/users/" + user.getId())) .entity(user) .build())) .subscribe(response::resume, response::resume); }