本文整理汇总了Java中org.eclipse.jetty.util.Fields类的典型用法代码示例。如果您正苦于以下问题:Java Fields类的具体用法?Java Fields怎么用?Java Fields使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Fields类属于org.eclipse.jetty.util包,在下文中一共展示了Fields类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: getLoginRequest
import org.eclipse.jetty.util.Fields; //导入依赖的package包/类
/**
* Creates login request, allows SalesforceSecurityHandler to create a login request for a failed authentication conversation
* @return login POST request.
*/
public Request getLoginRequest(HttpConversation conversation) {
final String loginUrl = (instanceUrl == null ? config.getLoginUrl() : instanceUrl) + OAUTH2_TOKEN_PATH;
LOG.info("Login user {} at Salesforce loginUrl: {}", config.getUserName(), loginUrl);
final Fields fields = new Fields(true);
fields.put("grant_type", "password");
fields.put("client_id", config.getClientId());
fields.put("client_secret", config.getClientSecret());
fields.put("username", config.getUserName());
fields.put("password", config.getPassword());
fields.put("format", "json");
final Request post;
if (conversation == null) {
post = httpClient.POST(loginUrl);
} else {
post = httpClient.newHttpRequest(conversation, URI.create(loginUrl))
.method(HttpMethod.POST);
}
return post.content(new FormContentProvider(fields))
.timeout(timeout, TimeUnit.MILLISECONDS);
}
开发者ID:HydAu,项目名称:Camel,代码行数:28,代码来源:SalesforceSession.java
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: 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
示例9: formFields
import org.eclipse.jetty.util.Fields; //导入依赖的package包/类
private static Fields formFields(ObjectNode content)
{
Fields fields = new Fields();
content.fields().forEachRemaining(f -> {
if (f.getValue().isContainerNode()) {
throw new ConfigException("Invalid form content field value: " + f.getValue().toString());
}
fields.add(f.getKey(), f.getValue().asText());
});
return fields;
}
开发者ID:treasure-data,项目名称:digdag,代码行数:12,代码来源:HttpOperatorFactory.java
示例10: 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
示例11: getParams
import org.eclipse.jetty.util.Fields; //导入依赖的package包/类
@Override
public Fields getParams() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
开发者ID:betfair,项目名称:cougar,代码行数:5,代码来源:CapturingRequest.java
注:本文中的org.eclipse.jetty.util.Fields类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论