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


Java Fields.add方法代码示例

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


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

示例1: postRequest

import org.eclipse.jetty.util.Fields; //导入方法依赖的package包/类
private Request postRequest(ApiURL url, JsonObject r, Timeout timeout) {
	Fields fields = new Fields();
	fields.add("r", GsonUtil.gson.toJson(r));
	Request request = httpClient.newRequest(url.getUrl()).method(HttpMethod.POST).agent(ApiURL.USER_AGENT)
			.header("Origin", url.getOrigin()).content(new FormContentProvider(fields));
	if (url.getReferer() != null) {
		request.header(HttpHeader.REFERER, url.getReferer());
	}
	if (timeout != null) {
		request.timeout(timeout.getTime(), timeout.getUnit());
	}
	return request;
}
 
开发者ID:Xianguang-Zhou,项目名称:smartqq-client,代码行数:14,代码来源:SmartQQClient.java

示例2: createApp

import org.eclipse.jetty.util.Fields; //导入方法依赖的package包/类
public ContentResponse createApp(String gitUrl, String appName) throws Exception {
    Fields fields = new Fields();
    fields.add("gitUrl", gitUrl);
    if (appName != null) {
        fields.add("appName", appName);
    }
    return client.POST(routerUrl + "/api/v1/apps")
        .content(new FormContentProvider(fields)).send();
}
 
开发者ID:danielflower,项目名称:app-runner-router,代码行数:10,代码来源:RestClient.java

示例3: updateApp

import org.eclipse.jetty.util.Fields; //导入方法依赖的package包/类
public ContentResponse updateApp(String gitUrl, String appName) throws Exception {
    Fields fields = new Fields();
    fields.add("gitUrl", gitUrl);
    return client.newRequest(routerUrl + "/api/v1/apps/" + appName)
        .method("PUT")
        .content(new FormContentProvider(fields)).send();
}
 
开发者ID:danielflower,项目名称:app-runner-router,代码行数:8,代码来源:RestClient.java

示例4: registerRunner

import org.eclipse.jetty.util.Fields; //导入方法依赖的package包/类
public ContentResponse registerRunner(String id, URI url, int maxInstances) throws Exception {
    Fields fields = new Fields();
    fields.add("id", id);
    fields.add("url", url.toString());
    fields.add("maxApps", String.valueOf(maxInstances));
    return client.POST(routerUrl + "/api/v1/runners")
        .content(new FormContentProvider(fields)).send();
}
 
开发者ID:danielflower,项目名称:app-runner-router,代码行数:9,代码来源:RestClient.java

示例5: updateRunner

import org.eclipse.jetty.util.Fields; //导入方法依赖的package包/类
public ContentResponse updateRunner(String id, URI url, int maxInstances) throws Exception {
    Fields fields = new Fields();
    fields.add("url", url.toString());
    fields.add("maxApps", String.valueOf(maxInstances));
    return client.newRequest(routerUrl + "/api/v1/runners/" + id)
        .method("PUT")
        .content(new FormContentProvider(fields)).send();
}
 
开发者ID:danielflower,项目名称:app-runner-router,代码行数:9,代码来源:RestClient.java

示例6: createApp

import org.eclipse.jetty.util.Fields; //导入方法依赖的package包/类
public ContentResponse createApp(String gitUrl, String appName) throws Exception {
    Fields fields = new Fields();
    fields.add("gitUrl", gitUrl);
    if (appName != null) {
        fields.add("appName", appName);
    }
    return client.POST(appRunnerUrl + "/api/v1/apps")
        .content(new FormContentProvider(fields)).send();
}
 
开发者ID:danielflower,项目名称:app-runner,代码行数:10,代码来源:RestClient.java

示例7: updateApp

import org.eclipse.jetty.util.Fields; //导入方法依赖的package包/类
public ContentResponse updateApp(String gitUrl, String appName) throws Exception {
    Fields fields = new Fields();
    fields.add("gitUrl", gitUrl);
    return client.newRequest(appRunnerUrl + "/api/v1/apps/" + appName)
        .method("PUT")
        .content(new FormContentProvider(fields)).send();
}
 
开发者ID:danielflower,项目名称:app-runner,代码行数:8,代码来源:RestClient.java

示例8: getRecordWithTokenPagination

import org.eclipse.jetty.util.Fields; //导入方法依赖的package包/类
private <T> RecordPagingIterable<T> getRecordWithTokenPagination(final String endPoint, final Multimap<String, String> parameters, final Class<T> recordClass)
{
    return new RecordPagingIterable<>(new RecordPagingIterable.PagingFunction<RecordPagingIterable.TokenPage<T>>()
    {
        @Override
        public RecordPagingIterable.TokenPage<T> getNextPage(RecordPagingIterable.TokenPage<T> currentPage)
        {
            return getTokenPage(currentPage);
        }
        @Override
        public RecordPagingIterable.TokenPage<T> getFirstPage()
        {
            return getTokenPage(null);
        }

        @SuppressWarnings("unchecked")
        private RecordPagingIterable.TokenPage<T> getTokenPage(RecordPagingIterable.TokenPage page)
        {
            ImmutableListMultimap.Builder params = new ImmutableListMultimap.Builder<>();
            params.put("_method", "GET");
            Fields fields = new Fields();
            if (page != null) {
                fields.add(NEXT_PAGE_TOKEN, page.getNextPageToken());
            }
            fields.add(BATCH_SIZE, String.valueOf(batchSize));
            if (parameters != null) {
                for (String key : parameters.keySet()) {
                    //params that is passed in should overwrite default
                    fields.remove(key);
                    for (String value : parameters.get(key)) {
                        fields.add(key, value);
                    }
                }
            }
            //Let do GET Disguise in POST here to overcome Marketo URI Too long error
            FormContentProvider formContentProvider = new FormContentProvider(fields);
            MarketoResponse<T> marketoResponse = doPost(endPoint, null, params.build(), new MarketoResponseJetty92EntityReader<>(READ_TIMEOUT_MILLIS, recordClass), formContentProvider);
            return new RecordPagingIterable.TokenPage<>(marketoResponse.getResult(), marketoResponse.getNextPageToken(), marketoResponse.getNextPageToken() != null);
        }
    });
}
 
开发者ID:treasure-data,项目名称:embulk-input-marketo,代码行数:42,代码来源:MarketoRestClient.java


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