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


Java Multipart类代码示例

本文整理汇总了Java中org.apache.cxf.jaxrs.ext.multipart.Multipart的典型用法代码示例。如果您正苦于以下问题:Java Multipart类的具体用法?Java Multipart怎么用?Java Multipart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: upload

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
/**
 * Upload a file of quote in add mode.
 * 
 * @param subscription
 *            The subscription identifier, will be used to filter the locations
 *            from the associated provider.
 * @param uploadedFile
 *            Instance entries files to import. Currently support only CSV
 *            format.
 * @param columns
 *            the CSV header names.
 * @param term
 *            The default {@link ProvInstancePriceTerm} used when no one is
 *            defined in the CSV line
 * @param ramMultiplier
 *            The multiplier for imported RAM values. Default is 1.
 * @param encoding
 *            CSV encoding. Default is UTF-8.
 * @throws IOException
 *             When the CSV stream cannot be written.
 */
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Path("{subscription:\\d+}/upload")
public void upload(@PathParam("subscription") final int subscription, @Multipart(value = "csv-file") final InputStream uploadedFile,
		@Multipart(value = "columns", required = false) final String[] columns,
		@Multipart(value = "term", required = false) final String term,
		@Multipart(value = "memoryUnit", required = false) final Integer ramMultiplier,
		@Multipart(value = "encoding", required = false) final String encoding) throws IOException {
	subscriptionResource.checkVisibleSubscription(subscription).getNode().getId();

	// Check column's name validity
	final String[] sanitizeColumns = ArrayUtils.isEmpty(columns) ? DEFAULT_COLUMNS : columns;
	checkHeaders(ACCEPTED_COLUMNS, sanitizeColumns);

	// Build CSV header from array
	final String csvHeaders = StringUtils.chop(ArrayUtils.toString(sanitizeColumns)).substring(1).replace(',', ';') + "\n";

	// Build entries
	final String safeEncoding = ObjectUtils.defaultIfNull(encoding, StandardCharsets.UTF_8.name());
	csvForBean
			.toBean(InstanceUpload.class, new InputStreamReader(
					new SequenceInputStream(new ByteArrayInputStream(csvHeaders.getBytes(safeEncoding)), uploadedFile), safeEncoding))
			.stream().filter(Objects::nonNull).forEach(i -> persist(i, subscription, term, ramMultiplier));
}
 
开发者ID:ligoj,项目名称:plugin-prov,代码行数:46,代码来源:ProvQuoteInstanceResource.java

示例2: addFileTemplateToServiceInfo

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@POST
@Path("/{id}/filetemplates")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Add FileTempate to ServiceInfo)", response = FileTemplateModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the FileTemplate was updated", response = FileTemplateModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response addFileTemplateToServiceInfo(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "Attachment files", required = true) @Multipart("file") Attachment file,
		@ApiParam(value = "id of ServiceInfo that need to be upload file to", required = true) @PathParam("id") String id,
		@ApiParam(value = "Metadata of FileTemplate", required = true) @Multipart("fileTemplateNo") String fileTemplateNo,
		@ApiParam(value = "Metadata of FileTemplate") @Multipart("templateName") String templateName,
		@ApiParam(value = "Metadata of FileType") @Multipart("fileType") String fileType,
		@ApiParam(value = "Metadata of FileSize") @Multipart("fileSize") int fileSize, @Multipart("fileName") String fileName);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:20,代码来源:ServiceInfoManagement.java

示例3: addRegistrationByRegistrationId

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@POST
@Path("/registrations/{id}/logs")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "addRegistrationByRegistrationId)", response = RegistrationLogModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the RegistrationgModel was updated", response = RegistrationResultsModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response addRegistrationByRegistrationId(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "id of registration", required = true) @PathParam("id") long id,
		@ApiParam(value = "Metadata of RegistrationLog") @Multipart("author") String author,
		@ApiParam(value = "Metadata of RegistrationLog") @Multipart("payload") String payload,
		@ApiParam(value = "Metadata of RegistrationLog") @Multipart("content") String content);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:18,代码来源:RegistrationLogManagement.java

示例4: updatePaymentFileConfirm

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@PUT
@Path("/{id}/payments/{referenceUid}/confirm")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "upload PaymentFile")
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updatePaymentFileConfirm(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, 
		@ApiParam(value = "id of payments", required = true) @PathParam("id") String id,
		@ApiParam(value = "reference of paymentFile", required = true) @PathParam("referenceUid") String referenceUid,
		@ApiParam(value = "Attachment files") @Multipart("file") Attachment file,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("confirmNote") String confirmNote,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("paymentMethod") String paymentMethod,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("confirmPayload") String confirmPayload);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:20,代码来源:PaymentFileManagement.java

示例5: updatePaymentFileApproval

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@PUT
@Path("/{id}/payments/{referenceUid}/approval")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "update DossierFile")
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updatePaymentFileApproval(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, 
		@ApiParam(value = "id of dossier", required = true) @PathParam("id") String id,
		@ApiParam(value = "reference of paymentFile", required = true) @PathParam("referenceUid") String referenceUid,
		@ApiParam(value = "Attachment files") @Multipart("file") Attachment file,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("approveDatetime") String approveDatetime,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("accountUserName") String accountUserName,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("govAgencyTaxNo") String govAgencyTaxNo,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("invoiceTemplateNo") String invoiceTemplateNo,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("invoiceIssueNo") String invoiceIssueNo,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("invoiceNo") String invoiceNo);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:23,代码来源:PaymentFileManagement.java

示例6: addDossierFileByDossierId

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@POST
@Path("/{id}/files")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "addDossierFileByDossierId)", response = DossierFileModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierFileModel was updated", response = DossierFileResultsModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response addDossierFileByDossierId(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "Attachment files", required = true) @Multipart("file") Attachment file,
		@ApiParam(value = "id of dossier", required = true) @PathParam("id") String id,
		@ApiParam(value = "Metadata of DossierFile", required = true) @Multipart("referenceUid") String referenceUid,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("dossierTemplateNo") String dossierTemplateNo,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("dossierPartNo") String dossierPartNo,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("fileTemplateNo") String fileTemplateNo,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("displayName") String displayName,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("fileType") String fileType,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("isSync") String isSync,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("formData") @Nullable String formData);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:24,代码来源:DossierFileManagement.java

示例7: updateDossierFile

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@POST
@Path("/{id}/files/{referenceUid}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "update DossierFile", response = String.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierFileModel was updated", response = DossierFileResultsModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updateDossierFile(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "id of dossier", required = true) @PathParam("id") long id,
		@ApiParam(value = "reference of dossierfile", required = true) @PathParam("referenceUid") String referenceUid,
		@ApiParam(value = "Attachment files", required = true) @Multipart("file") Attachment file);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:17,代码来源:DossierFileManagement.java

示例8: prepareData

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
/**
 * Initialize data for next bench tests.
 * 
 * @param blob
 *            the BLOB file to attach.
 * @param nb
 *            the amount of data to persist.
 * @return the the bench result. The return type is text/html for IE7 support.
 */
@POST
@Produces(MediaType.TEXT_HTML)
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED, MediaType.MULTIPART_FORM_DATA })
public String prepareData(@Multipart(value = "blob", required = false) final InputStream blob, @Multipart("nb") final int nb) throws IOException {
	final long start = System.currentTimeMillis();
	final byte[] lobData = blob == null ? new byte[0] : IOUtils.toByteArray(blob);
	log.info("Content size :" + lobData.length);
	final BenchResult result = jpaDao.initialize(nb, lobData);
	result.setDuration(System.currentTimeMillis() - start);
	return new org.ligoj.bootstrap.core.json.ObjectMapperTrim().writeValueAsString(result);
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:21,代码来源:JpaBenchResource.java

示例9: load

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@POST 
@Path("/load")
@Consumes("multipart/form-data")
public boolean load( @Multipart(value = "stream")  InputStream stream ){
	log.info("load");
	boolean boolOK=false;	
	QuestionnaireMngServer server = null;
	
	server = new QuestionnaireMngServer ();	
	boolOK=server.loadfileDataStream(stream);
	if (boolOK)
		log.info("load OK" );
	else 
		log.info("load ERROR");				
			
	return boolOK;
}
 
开发者ID:ik4tekniker,项目名称:FISTAR-Health-Questionnaire-SE,代码行数:18,代码来源:QuestionnaireMngWSImpl.java

示例10: importQuestionnairDefinition

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@POST
@Path("/import")
@Consumes("multipart/form-data")
@ApiOperation(value = "Import questionnaire definition", notes = "Only xml format supported", response = QuestionnaireDefinitionDTO.class)
@ApiResponses(value = { @ApiResponse(code = 415, message = "Unsupported format"),
        @ApiResponse(code = 200, message = "Imported questionnaire definition") })
@ApiImplicitParams(@ApiImplicitParam(dataType = "file", name = "content", paramType = "body"))
@Produces(MediaType.APPLICATION_JSON)
public QuestionnaireDefinitionDTO importQuestionnairDefinition(
        @Multipart(value = "content", type = "text/xml") @ApiParam(access = "internal") InputStream content)
        throws Exception {
    logger.info("New import QuestionnaireDefinition petition received");
    QuestionnaireDefinitionDTO imported = questionnaireDefinitionAccessorFacade
            .importQuestionnaireDefinition(content);
    logger.info("QuestionnaireDefinition imported with id = {}", imported.getId());
    return imported;
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:18,代码来源:QuestionnaireDefinitionResource.java

示例11: uploadEmployeePhoto

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@PUT
@Path("/{id}/photo")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response uploadEmployeePhoto(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @Multipart("file") Attachment attachment,
		@Multipart("fileName") String fileName, @Multipart("fileType") String fileType,
		@Multipart("fileSize") long fileSize);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:10,代码来源:EmployeeManagement.java

示例12: addCommentAttachment

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@POST
@Path("/uploads")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response addCommentAttachment(@Multipart("file") Attachment attachment,
		@Context HttpServletRequest request, @Context HttpHeaders header, @Context ServiceContext serviceContext,
		@Multipart("className") String className, @Multipart("classPK") String classPK,
		@Multipart("parent") long parent, @Multipart("fileName") String fileName,
		@Multipart("fileType") String fileType, @Multipart("fileSize") long fileSize,
		@Multipart("pings") String pings, @Multipart("email") String email, @Multipart("fullname") String fullname);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:11,代码来源:CommentManagement.java

示例13: addDossierLogByDossierId

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@POST
@Path("log/{id}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "addDossierLogByDossierId)", response = DossierLogModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierLogModel was updated", response = DossierLogResultsModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response addDossierLogByDossierId(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "id of dossier", required = true) @PathParam("id") long id,
		@ApiParam(value = "NotificationType", required = true) @Multipart("notificationType") String notificationType,
		@ApiParam(value = "Metadata of DossierLog") @Multipart("author") String author,
		@ApiParam(value = "Metadata of DossierLog") @Multipart("payload") String payload,
		@ApiParam(value = "Metadata of DossierLog") @Multipart("content") String content);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:19,代码来源:DossierLogManagement.java

示例14: upload

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@POST
@Path("/upload")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response upload(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company,
		@Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
		@Multipart("className") String className, @Multipart("classPK") String classPK, 
		@Multipart("file") Attachment attachment, @Multipart("fileName") String fileName,
		@Multipart("fileType") String fileType, @Multipart("fileSize") long fileSize);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:10,代码来源:FileAttachManagement.java

示例15: update

import org.apache.cxf.jaxrs.ext.multipart.Multipart; //导入依赖的package包/类
@PUT
@Path("/{id}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response update(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company,
		@Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
		@DefaultValue("0") @PathParam("id") long id, @Multipart("file") Attachment attachment, @Multipart("fileName") String fileName,
		@Multipart("fileType") String fileType, @Multipart("fileSize") long fileSize);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:9,代码来源:FileAttachManagement.java


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