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


Java HttpRequestWithBody.field方法代码示例

本文整理汇总了Java中com.mashape.unirest.request.HttpRequestWithBody.field方法的典型用法代码示例。如果您正苦于以下问题:Java HttpRequestWithBody.field方法的具体用法?Java HttpRequestWithBody.field怎么用?Java HttpRequestWithBody.field使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mashape.unirest.request.HttpRequestWithBody的用法示例。


在下文中一共展示了HttpRequestWithBody.field方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fieldFileOrElse

import com.mashape.unirest.request.HttpRequestWithBody; //导入方法依赖的package包/类
private MultipartBody fieldFileOrElse(HttpRequestWithBody post,
                                      MultipartBody field,
                                      Map.Entry<String, Object> entry,
                                      Object value) {
    if (value instanceof File) {
        if (field != null) field.field(entry.getKey(), (File) value);
        else field = post.field(entry.getKey(), (File) value);
    } else if (value instanceof MultipartFile) {
        if (field != null)
            field.field(entry.getKey(), (MultipartFile) value);
        else field = post.field(entry.getKey(), (MultipartFile) value);
    } else {
        if (field != null) field.field(entry.getKey(), value);
        else field = post.field(entry.getKey(), value);
    }

    return field;
}
 
开发者ID:bingoohuang,项目名称:spring-rest-client,代码行数:19,代码来源:RestReq.java

示例2: uploadOne

import com.mashape.unirest.request.HttpRequestWithBody; //导入方法依赖的package包/类
@Test
public void uploadOne() throws IOException {
    // Create temp file.
    File temp = File.createTempFile("myimage", ".image");
    Files.write("Hello world", temp, Charsets.UTF_8);


    try {
        HttpRequestWithBody post = Unirest.post("http://localhost:4849/upload/image");
        post.field("name", "bingoo.txt");
        post.field("file", temp);
        HttpResponse<String> file = post
            .asString();
        System.out.println(file.getStatus());

    } catch (Exception e) {
        e.printStackTrace();
    }


    temp.delete();
}
 
开发者ID:bingoohuang,项目名称:spring-rest-client,代码行数:23,代码来源:PostTest.java

示例3: uploadFiles

import com.mashape.unirest.request.HttpRequestWithBody; //导入方法依赖的package包/类
public void uploadFiles(List<File> filepaths, String uploaddir) throws AptlyRestException
{
    mLogger.println("upload dir name: " + uploaddir);
    try {
        HttpRequestWithBody req = Unirest.post(mSite.getUrl() +
                                     "/api/files/" + uploaddir);
        req.field("file", filepaths);
        JSONObject res = sendRequest(req);
    }
    catch (AptlyRestException ex) {
        mLogger.printf("Failed to upload the packages: %s\n", ex.toString());
        throw ex;
    }
}
 
开发者ID:zgyarmati,项目名称:aptly-plugin,代码行数:15,代码来源:AptlyRestClient.java

示例4: applyFields

import com.mashape.unirest.request.HttpRequestWithBody; //导入方法依赖的package包/类
@Override
public void applyFields(HttpRequestWithBody request) {
    request.field("sessionId", this.sessionId);
}
 
开发者ID:LeonHartley,项目名称:OpenHabbo,代码行数:5,代码来源:MasterSessionUnregisterMessage.java

示例5: applyFields

import com.mashape.unirest.request.HttpRequestWithBody; //导入方法依赖的package包/类
@Override
public void applyFields(HttpRequestWithBody request) {
    request.field("roomId", this.roomId);
}
 
开发者ID:LeonHartley,项目名称:OpenHabbo,代码行数:5,代码来源:FindRoomMessage.java

示例6: applyFields

import com.mashape.unirest.request.HttpRequestWithBody; //导入方法依赖的package包/类
@Override
public void applyFields(HttpRequestWithBody request) {
    request.field("playerId", this.playerId);
}
 
开发者ID:LeonHartley,项目名称:OpenHabbo,代码行数:5,代码来源:FindOwnRoomsMessage.java

示例7: applyFields

import com.mashape.unirest.request.HttpRequestWithBody; //导入方法依赖的package包/类
@Override
public void applyFields(HttpRequestWithBody request) {
    request.field("authenticationTicket", authenticationTicket);
}
 
开发者ID:LeonHartley,项目名称:OpenHabbo,代码行数:5,代码来源:AuthenticateSessionMessage.java


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