本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 ...
}
示例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));
}
示例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())));
}