當前位置: 首頁>>代碼示例>>Java>>正文


Java FormDataMultiPart.field方法代碼示例

本文整理匯總了Java中org.glassfish.jersey.media.multipart.FormDataMultiPart.field方法的典型用法代碼示例。如果您正苦於以下問題:Java FormDataMultiPart.field方法的具體用法?Java FormDataMultiPart.field怎麽用?Java FormDataMultiPart.field使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.glassfish.jersey.media.multipart.FormDataMultiPart的用法示例。


在下文中一共展示了FormDataMultiPart.field方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: submit

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
public PredictResponse submit() throws IOException {
  FormDataMultiPart formPart = new FormDataMultiPart();
  formPart.field("modelId", modelId);
  formPart.field("sampleLocation", sampleLocation);

  MediaType contentType = formPart.getMediaType();
  contentType = Boundary.addBoundary(contentType);
  Entity<FormDataMultiPart> entity = Entity.entity(formPart, contentType);

  Response response = client.target(EINSTEIN_VISION_URL + "/v1/vision/predict")
      .request()
      .header("Authorization", "Bearer " + getToken())
      .post(entity);

  if (!isSuccessful(response)) {
    throw new IOException("Error occurred while making prediction call " + response);
  }

  return readResponseAs(response, PredictResponse.class);
}
 
開發者ID:MetaMind,項目名稱:quickstart,代碼行數:21,代碼來源:PredictRequest.java

示例2: getMultiPartForm

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
/**
 * Creates a MultiPart Form object
 * 
 * @param entity
 *            expects TPASCreativeBatchApprove entity.
 * @param formDataMultiPart
 *            expects a FormDataMultiPart object.
 * @return
 */
public static FormDataMultiPart getMultiPartForm(TPASCreativeBatchApprove entity,
		FormDataMultiPart formDataMultiPart) {

	FormDataMultiPart formData = formDataMultiPart;

	formData = setMultipartAdvertiserID(entity, formData);

	if (entity.getBatch() != null) {
		for (TPASCreativeBatchIndex batchIndex : entity.getBatch()) {
			if (batchIndex.getBatchIndex() != null && !batchIndex.getBatchIndex().isEmpty()) {

				formData = formData.field("batch_index", batchIndex.getBatchIndex());

				formData = setMultipartConcept(formData, batchIndex);

				formData = setMultipartClickURL(formData, batchIndex);
			}
		}
	}

	return formData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:32,代碼來源:TPasCreativeUploadBatchHelper.java

示例3: setMultipartClickURL

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
private static FormDataMultiPart setMultipartClickURL(FormDataMultiPart formDataMultiPart,
		TPASCreativeBatchIndex batchIndex) {
	FormDataMultiPart formData = formDataMultiPart;
	if (batchIndex.getClickUrl() != null && !batchIndex.getClickUrl().isEmpty()) {
		formData = formData.field("click_url_" + batchIndex.getBatchIndex(), batchIndex.getClickUrl());
	}
	return formData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:9,代碼來源:TPasCreativeUploadBatchHelper.java

示例4: setMultipartConcept

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
private static FormDataMultiPart setMultipartConcept(FormDataMultiPart formDataMultiPart,
		TPASCreativeBatchIndex batchIndex) {
	FormDataMultiPart formData = formDataMultiPart;
	if (batchIndex.getConceptId() != null && !batchIndex.getConceptId().isEmpty()) {
		formData = formData.field("concept_" + batchIndex.getBatchIndex(), batchIndex.getConceptId());
	}
	return formData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:9,代碼來源:TPasCreativeUploadBatchHelper.java

示例5: setMultipartAdvertiserID

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
private static FormDataMultiPart setMultipartAdvertiserID(TPASCreativeBatchApprove entity,
		FormDataMultiPart formDataMultiPart) {
	FormDataMultiPart formData = formDataMultiPart;
	if (entity.getAdvertiserId() != null && !entity.getAdvertiserId().isEmpty()) {
		formData = formData.field("advertiser_id", entity.getAdvertiserId());
	}
	return formData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:9,代碼來源:TPasCreativeUploadBatchHelper.java

示例6: setConcept

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
private static FormDataMultiPart setConcept(FormDataMultiPart formData, int inc,
		TOneASCreativeAssetsApproveData data) {
	FormDataMultiPart localFormData = formData;
	if (data.getConcept() != null && !data.getConcept().isEmpty()) {
		localFormData = localFormData.field("concept." + inc, data.getConcept());
	}
	return localFormData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:9,代碼來源:TOneCreativeAssetsApproveHelper.java

示例7: setBackup

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
private static FormDataMultiPart setBackup(FormDataMultiPart formData, int inc,
		TOneASCreativeAssetsApproveData data) {
	FormDataMultiPart localFormData = formData;
	if (data.getBackup() != null && !data.getBackup().isEmpty()) {
		localFormData = localFormData.field("backup." + inc, data.getBackup());
	}
	return localFormData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:9,代碼來源:TOneCreativeAssetsApproveHelper.java

示例8: setPrimary

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
private static FormDataMultiPart setPrimary(FormDataMultiPart formData, int inc,
		TOneASCreativeAssetsApproveData data) {
	FormDataMultiPart localFormData = formData;
	if (data.getPrimary() != null && !data.getPrimary().isEmpty()) {
		localFormData = localFormData.field("primary." + inc, data.getPrimary());
	}
	return localFormData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:9,代碼來源:TOneCreativeAssetsApproveHelper.java

示例9: setClickURL

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
private static FormDataMultiPart setClickURL(FormDataMultiPart formData, int inc,
		TOneASCreativeAssetsApproveData data) {
	FormDataMultiPart localFormData = formData;
	if (data.getClickUrl() != null && !data.getClickUrl().isEmpty()) {
		localFormData = localFormData.field("click_url." + inc, data.getClickUrl());
	}
	return localFormData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:9,代碼來源:TOneCreativeAssetsApproveHelper.java

示例10: setLandingPage

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
private static FormDataMultiPart setLandingPage(FormDataMultiPart formData, int inc,
		TOneASCreativeAssetsApproveData data) {
	FormDataMultiPart localFormData = formData;
	if (data.getLandingPage() != null && !data.getLandingPage().isEmpty()) {
		localFormData = localFormData.field("landingPage." + inc, data.getLandingPage());
	}
	return localFormData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:9,代碼來源:TOneCreativeAssetsApproveHelper.java

示例11: setAdvertiserID

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
private static FormDataMultiPart setAdvertiserID(FormDataMultiPart formData, TOneASCreativeAssetsApproveData data) {
	FormDataMultiPart localFormData = formData;
	if (data.getAdvertiserid() != null && !data.getAdvertiserid().isEmpty()) {
		localFormData = localFormData.field("advertiserid", data.getAdvertiserid());
	}
	return localFormData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:8,代碼來源:TOneCreativeAssetsApproveHelper.java

示例12: setIsHttps

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
private static FormDataMultiPart setIsHttps(FormDataMultiPart formData, TOneASCreativeAssetsApproveData data) {
	FormDataMultiPart localFormData = formData;
	if (data.isHttps()) {
		localFormData = localFormData.field("is_https", Utility.getOneOrZero(data.isHttps()));
	}
	return localFormData;
}
 
開發者ID:MediaMath,項目名稱:t1-java,代碼行數:8,代碼來源:TOneCreativeAssetsApproveHelper.java

示例13: androidCreateTest

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
@Test
public void androidCreateTest() {

    FormDataMultiPart newAndroidFormData = new FormDataMultiPart();
    newAndroidFormData.field("shouldBeCustomer", "new one ma");
    newAndroidFormData.field("model", "Android N");

    Map<String, Object> newAndroid = new HashMap<>();
    newAndroid.putAll(newAndroidFormData.getFields());
    Response badRequestResponse = androidService.addOrEdit(newAndroid);

    /**
     * 400 response code test (null pointer exception)
     */
    assertEquals(badRequestResponse.getStatus(), 400);

    
    // OK I'm not finishing this, you get the idea ...
}
 
開發者ID:korena,項目名稱:service-base,代碼行數:20,代碼來源:AndroidServiceTest.java

示例14: testStartFrontendExecution

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
@Test
public void testStartFrontendExecution() throws Exception {
       Assume.assumeNotNull(System.getProperty("infolisRemoteTest"));

	FormDataMultiPart fdm = new FormDataMultiPart();
	fdm.field("algorithm", TextExtractor.class.getName());
	WebTarget target = jerseyClient
			.target(InfolisConfig.getFrontendURI())
			.path("/execute");
	log.debug("{}", target);
	Entity<FormDataMultiPart> entity = Entity.entity(fdm, fdm.getMediaType());
	log.debug("{}", entity);
	log.debug("{}", fdm.getField("algorithm").getValue());

	// Why TF does this hang???
	Response post = target
			.request(MediaType.APPLICATION_JSON)
			.post(entity);
	log.debug("{}", post.getHeaders());
	log.debug("{}", post.readEntity(String.class));
}
 
開發者ID:infolis,項目名稱:infoLink,代碼行數:22,代碼來源:ExecutorWebserviceTest.java

示例15: post

import org.glassfish.jersey.media.multipart.FormDataMultiPart; //導入方法依賴的package包/類
/**
 *
 * @param url
 * @return
 */
public Response post(final String url, final Map<String, String> values) throws RestClientException {

    final FormDataMultiPart multipart = new FormDataMultiPart();
    for(final Map.Entry<String,String> entry : values.entrySet()){
        multipart.field(entry.getKey(), entry.getValue());
    }

    return closeAndReturn(buildWebResource(url).post(Entity.entity(multipart, multipart.getMediaType())));
}
 
開發者ID:giovannicammarata,項目名稱:jflowlight,代碼行數:15,代碼來源:RestClient.java


注:本文中的org.glassfish.jersey.media.multipart.FormDataMultiPart.field方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。