org.glassfish.jersey.media.multipart.FormDataParam Java Examples

The following examples show how to use org.glassfish.jersey.media.multipart.FormDataParam. 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: FileAction.java    From o2oa with GNU Affero General Public License v3.0 7 votes vote down vote up
@JaxrsMethodDescribe(value = "创建Attachment的内容并返回回调.", action = ActionUploadCallback.class)
@POST
@Path("upload/referencetype/{referenceType}/reference/{reference}/scale/{scale}/callback/{callback}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.TEXT_HTML_UTF_8)
public void uploadCallback(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("文件类型") @PathParam("referenceType") String referenceType,
		@JaxrsParameterDescribe("关联id") @PathParam("reference") String reference,
		@JaxrsParameterDescribe("缩放") @PathParam("scale") Integer scale,
		@JaxrsParameterDescribe("回调函数名") @PathParam("callback") String callback,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("上传文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUploadCallback.Wo<ActionUploadCallback.WoObject>> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUploadCallback().execute(effectivePerson, referenceType, reference, scale, callback,
				bytes, disposition);
	} 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 vote down vote up
@JaxrsMethodDescribe(value = "上传附件.", action = ActionUploadCallback.class)
@POST
@Path("upload/work/{workId}/callback/{callback}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.TEXT_HTML_UTF_8)
public void uploadCallback(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId,
		@JaxrsParameterDescribe("回调函数名") @PathParam("callback") String callback,
		@JaxrsParameterDescribe("位置") @FormDataParam("site") String site,
		@JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUploadCallback.Wo<ActionUploadCallback.WoObject>> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUploadCallback().execute(effectivePerson, workId, callback, site, fileName, bytes,
				disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #3
Source File: OkrWorkImportAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "进行工作信息导入", action = ActionWorkImport.class)
@POST
@Path("center/{centerId}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void importWork(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("中心工作ID") @PathParam("centerId") String centerId,
		@JaxrsParameterDescribe("位置") @FormDataParam("site") String site,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	EffectivePerson effectivePerson = this.effectivePerson(request);
	ActionResult<Object> result = new ActionResult<>();
	try {
		result = new ActionWorkImport().execute(request, effectivePerson, centerId, site, bytes, disposition);
	} catch (Exception e) {
		result = new ActionResult<>();
		logger.warn("系统根据中心工作ID获取中心工作所有附件信息过程发生异常。");
		logger.error(e, effectivePerson, request, null);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #4
Source File: MindInfoAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "上传或者替换栏目的图标内容,可以指定压缩大小	.", action = ActionMindIconUpdate.class)
@POST
@Path("{mindId}/icon/size/{size}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void changeMindIcon(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("脑图信息ID") @PathParam("mindId") String mindId,
		@JaxrsParameterDescribe("最大宽度") @PathParam("size") Integer size,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionMindIconUpdate.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = ((ActionMindIconUpdate) proxy.getProxy(ActionMindIconUpdate.class)).execute(request,
				effectivePerson, mindId, size, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #5
Source File: AttachmentAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
/** callback方法与前台ie低版本兼容使用post方法 */
@JaxrsMethodDescribe(value = "更新会议附件内容", action = ActionUpdateCallback.class)
@POST
@Path("{id}/update/callback/{ballback}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.TEXT_HTML_UTF_8)
public void updateCallback(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("会议标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("回调函数名") @PathParam("callback") String callback,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUpdateCallback.Wo<ActionUpdateCallback.WoObject>> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpdateCallback().execute(effectivePerson, id, callback, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #6
Source File: RoomAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "设置会议室照片.", action = ActionSetPhoto.class)
@POST
@Path("{id}/photo")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void setPhoto(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("标识") @PathParam("id") String id, @FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("Excel文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionSetPhoto.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionSetPhoto().execute(effectivePerson, id, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #7
Source File: AttachmentAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "更新会议附件内容", action = ActionUpdate.class)
@PUT
@Path("{id}/update")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void update(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("会议标识") @PathParam("id") String id, @FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUpdate.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpdate().execute(effectivePerson, id, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #8
Source File: AttachmentAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
/** callback方法与前台ie低版本兼容使用post方法 */
@JaxrsMethodDescribe(value = "更新会议附件内容", action = ActionUpdateCallback.class)
@POST
@Path("{id}/update/callback/{ballback}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.TEXT_HTML_UTF_8)
public void updateCallback(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("会议标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("回调函数名") @PathParam("callback") String callback,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUpdateCallback.Wo<ActionUpdateCallback.WoObject>> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpdateCallback().execute(effectivePerson, id, callback, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #9
Source File: RoomAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "设置会议室照片.", action = ActionSetPhoto.class)
@POST
@Path("{id}/photo")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void setPhoto(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("标识") @PathParam("id") String id, @FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("Excel文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionSetPhoto.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionSetPhoto().execute(effectivePerson, id, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #10
Source File: ApplicationAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "更新应用图标.", action = ActionSetIcon.class)
@PUT
@Path("{id}/icon")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void setIcon(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("应用标识") @PathParam("id") String id, @FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("头像文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionSetIcon.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionSetIcon().execute(effectivePerson, id, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #11
Source File: FileAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "上传文件内容.", action = ActionUpload.class)
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Path("{id}/upload")
public void upload(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("文件内容") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUpload.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpload().execute(effectivePerson, id, fileName, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #12
Source File: PictureAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "将图片转为base64编码,并且进行尺寸转换.", action = ActionUploadAndEncode.class)
@POST
@Path("encode/base64/size/{size}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void pictureEncode(@Suspended final AsyncResponse asyncResponse, 
		@Context HttpServletRequest request, 
		@JaxrsParameterDescribe("尺寸大小") @PathParam("size") Integer size,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<WrapOutString> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUploadAndEncode().execute(request, effectivePerson, size, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #13
Source File: MindInfoAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "上传或者替换栏目的图标内容,可以指定压缩大小	.", action = ActionMindIconUpdate.class)
@POST
@Path("{mindId}/icon/size/{size}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void changeMindIcon(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("脑图信息ID") @PathParam("mindId") String mindId,
		@JaxrsParameterDescribe("最大宽度") @PathParam("size") Integer size,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionMindIconUpdate.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = ((ActionMindIconUpdate) proxy.getProxy(ActionMindIconUpdate.class)).execute(request,
				effectivePerson, mindId, size, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #14
Source File: OkrAttachmentFileInfoAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "上传附件.", action = ActionReportAttachmentUpload.class)
@POST
@Path("upload/report/{id}/site/{site}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void reportAttachmentUpload(@Suspended final AsyncResponse asyncResponse,
		@Context HttpServletRequest request, @JaxrsParameterDescribe("汇报ID") @PathParam("id") String id,
		@JaxrsParameterDescribe("位置") @FormDataParam("site") String site,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionReportAttachmentUpload.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionReportAttachmentUpload().execute(request, effectivePerson, id, site, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #15
Source File: TestAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "文字转换.", action = ActionExtract.class)
@POST
@Path("extract")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void extract(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionExtract.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionExtract().execute(effectivePerson, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));

}
 
Example #16
Source File: AttachmentAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "更新附件,使用callback方式,为了与前台兼容使用POST方法.", action = ActionUpdateCallback.class)
@POST
@Path("update/{id}/work/{workId}/callback/{callback}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.TEXT_HTML_UTF_8)
public void updateCallback(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("附件标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId,
		@JaxrsParameterDescribe("回调函数名") @PathParam("callback") String callback,
		@JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("附件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUpdateCallback.Wo<ActionUpdateCallback.WoObject>> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpdateCallback().execute(effectivePerson, id, workId, callback, fileName, bytes,
				disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #17
Source File: OkrAttachmentFileInfoAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "为具体工作信息上传附件.", action = ActionWorkAttachmentUpload.class)
@POST
@Path("upload/work/{id}/site/{site}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void workAttachmentUpload(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("工作ID") @PathParam("id") String id,
		@JaxrsParameterDescribe("位置") @FormDataParam("site") String site,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionWorkAttachmentUpload.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionWorkAttachmentUpload().execute(request, effectivePerson, id, site, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #18
Source File: PersonAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "设置个人的头像.", action = ActionSetIcon.class)
@PUT
@Path("icon")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void setIcon(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("头像文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionSetIcon.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionSetIcon().execute(effectivePerson, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #19
Source File: DocumentAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "从Excel文件导入文档数据.", action = ActionPersistImportDataExcel.class)
@POST
@Path("import/category/{categoryId}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void persist_importDocumentFormExcel(@Suspended final AsyncResponse asyncResponse, 
		@Context HttpServletRequest request, 
		@JaxrsParameterDescribe("分类ID") @PathParam("categoryId") String categoryId, 
		@JaxrsParameterDescribe("作为参数的JSON字符串") @FormDataParam("json_data") String json_data,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionPersistImportDataExcel.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = ((ActionPersistImportDataExcel)proxy.getProxy(ActionPersistImportDataExcel.class)).execute(request, effectivePerson, categoryId, bytes,  json_data, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #20
Source File: FileAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "上传文件内容.", action = ActionUpload.class)
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Path("{id}/upload")
public void upload(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("文件内容") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUpload.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpload().execute(effectivePerson, id, fileName, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #21
Source File: PortalAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "更新Portal图标.", action = ActionSetIcon.class)
@PUT
@Path("{id}/icon")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void setIcon(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("标识") @PathParam("id") String id, @FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("图标文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionSetIcon.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionSetIcon().execute(effectivePerson, id, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #22
Source File: FileAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "上传文件内容.", action = ActionUpload.class)
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Path("{id}/upload")
public void upload(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("文件内容") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUpload.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpload().execute(effectivePerson, id, fileName, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #23
Source File: PortalAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "更新Portal图标.", action = ActionSetIcon.class)
@PUT
@Path("{id}/icon")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void setIcon(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("标识") @PathParam("id") String id, @FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("图标文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionSetIcon.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionSetIcon().execute(effectivePerson, id, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #24
Source File: AttachmentAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "为工作信息上传附件.", action = ActionTaskAttachmentUpload.class)
@POST
@Path("upload/task/{id}/site/{site}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void taskAttachmentUpload(@Suspended final AsyncResponse asyncResponse, 
		@Context HttpServletRequest request, 
		@JaxrsParameterDescribe("工作任务ID") @PathParam("id") String id, 
		@JaxrsParameterDescribe("位置") @PathParam("site") String site, 
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionTaskAttachmentUpload.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionTaskAttachmentUpload().execute(request, effectivePerson, id, site, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #25
Source File: FileAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "上传文件,并进行压缩,如果文件大小小于指定宽度或者宽度<0,则不进行压缩.", action = ActionUpload.class)
@PUT
@Path("upload/referencetype/{referenceType}/reference/{reference}/scale/{scale}")
@Consumes({ MediaType.MULTIPART_FORM_DATA, MediaType.APPLICATION_OCTET_STREAM })
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void upload(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("文件类型") @PathParam("referenceType") String referenceType,
		@JaxrsParameterDescribe("关联id") @PathParam("reference") String reference,
		@JaxrsParameterDescribe("缩放") @PathParam("scale") Integer scale,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("上传文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUpload.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpload().execute(effectivePerson, referenceType, reference, scale, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #26
Source File: Attachment2Action.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "创建Attachment的内容并返回回调.", action = ActionUploadCallback.class)
@POST
@Path("upload/folder/{folderId}/callback/{callback}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.TEXT_HTML_UTF_8)
public void uploadCallback(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("目录") @PathParam("folderId") String folderId,
		@JaxrsParameterDescribe("回调函数名") @PathParam("callback") String callback,
		@JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName,
		@JaxrsParameterDescribe("附件md5值") @FormDataParam("fileMd5") String fileMd5,
		@JaxrsParameterDescribe("附件标识") @FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("上传文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUploadCallback.Wo<WoObject>> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUploadCallback().execute(effectivePerson, folderId, callback, fileName, fileMd5, bytes,
				disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #27
Source File: Attachment2Action.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "创建Attachment的内容", action = ActionUpload.class)
@POST
@Path("upload/folder/{folderId}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void upload(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("目录") @PathParam("folderId") String folderId,
		@JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName,
		@JaxrsParameterDescribe("附件md5值") @FormDataParam("fileMd5") String fileMd5,
		@JaxrsParameterDescribe("附件标识") @FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("上传文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUpload.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpload().execute(effectivePerson, folderId, fileName, fileMd5, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #28
Source File: AppStyleAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "设置图片:启动页的logo,195x195.", action = ActionImageLaunchLogo.class)
@PUT
@Path("image/launch/logo")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void imageLaunchLogo(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("图片文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionImageLaunchLogo.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionImageLaunchLogo().execute(effectivePerson, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #29
Source File: AttachmentAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "创建Attachment的内容", action = ActionUpload.class)
@POST
@Path("upload/folder/{folderId}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void upload(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("目录") @PathParam("folderId") String folderId,
		@JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName,
		@JaxrsParameterDescribe("附件标识") @FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("上传文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionUpload.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpload().execute(effectivePerson, folderId, fileName, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #30
Source File: AttachmentAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "更新Attachment的内容并返回回调.,使用callback方式,为了与前台兼容使用POST方法", action = ActionUpdateContentCallback.class)
@POST
@Path("{id}/update/callback/{callback}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(HttpMediaType.TEXT_HTML_UTF_8)
public void updateContentCallback(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("附件标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("回调函数名") @PathParam("callback") String callback,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@JaxrsParameterDescribe("上传文件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<Wo<ActionUpdateContentCallback.WoObject>> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpdateContentCallback().execute(effectivePerson, id, callback, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}