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


Java Builder.post方法代码示例

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


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

示例1: createWorkFrom

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
/** Publishes the object (its MODS) as a new "work" in the ORCID profile */
MCRWork createWorkFrom(MCRObjectID objectID)
    throws IOException, JDOMException, SAXException {
    WebTarget target = orcid.getWebTarget().path("work");
    Builder builder = buildInvocation(target);

    Document workXML = buildWorkXMLFrom(objectID);
    Entity<InputStream> input = buildRequestEntity(workXML);

    LOGGER.info("post (create){} at {}", objectID, target.getUri());
    Response response = builder.post(input);
    expect(response, Response.Status.CREATED);

    String putCode = getPutCode(response);
    MCRWork work = new MCRWork(orcid, putCode);
    work.fetchDetails();
    return work;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:19,代码来源:MCRWorksPublisher.java

示例2: insertStatusReturn

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
@Override
public StatusResult insertStatusReturn(WebTarget webClient, final T object,
		final Map<String, Object> pathParams,
		final Map<String, Object> queryParams, final Map<String, Object> builderProperties) throws Exception {

	if (queryParams != null)
		webClient = applyQuery(webClient, queryParams);

	if (pathParams != null)
		webClient = webClient.resolveTemplates(pathParams);

	Builder builder = acceptMediaType(webClient.request());
       if (builderProperties != null){
           addBuilderProperties(builder, builderProperties);
       }
	Response resp = builder.post(Entity.entity(object, acceptMediaType()));
	return getStatusResult(resp);
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:19,代码来源:RestPersistenceService.java

示例3: insert

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
@Override
public Response insert(WebTarget webClient, final InputStream object,
		final Map<String, Object> pathParams,
		final Map<String, Object> queryParams, final Map<String, Object> builderProperties) throws Exception {
	if (queryParams != null)
		webClient = applyQuery(webClient, queryParams);

	if (pathParams != null)
		webClient = webClient.resolveTemplates(pathParams);

	Builder builder = acceptMediaType(webClient.request());
       if (builderProperties != null){
           addBuilderProperties(builder, builderProperties);
       }
	return builder.post(Entity.entity(object, MediaType.APPLICATION_OCTET_STREAM_TYPE));
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:17,代码来源:RestPersistenceService.java

示例4: evaluate

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
static ObjectNode evaluate(WebTarget endpoint,
                           QueryRequest request) throws QueryException {
    Builder invocationBuilder = endpoint.request(MediaType.APPLICATION_JSON_TYPE);

    ObjectNode result = invocationBuilder.post(Entity.entity(request,
                                                             MediaType.APPLICATION_JSON_TYPE),
                                               ObjectNode.class);
    ArrayNode errors = result.withArray("errors");
    if (errors.size() > 0) {
        throw new QueryException(errors);
    }
    return (ObjectNode) result.get("data");
}
 
开发者ID:ChiralBehaviors,项目名称:Kramer,代码行数:14,代码来源:GraphQlUtil.java

示例5: post

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
/**
 * Posts the request and returns the response.
 *
 * @throws MCRConfigurationException if request fails, e.g. because of misconfigured client ID and secret
 */
public MCRTokenResponse post() throws MCRConfigurationException, IOException {
    Entity<Form> formEntity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE);

    WebTarget target = baseTarget.path("token");
    Builder b = target.request().accept(MediaType.APPLICATION_JSON);
    Response r = b.post(formEntity);

    MCRTokenResponse response = new MCRTokenResponse(r);
    if (!response.wasSuccessful()) {
        throw new MCRConfigurationException(response.getStatusMessage());
    }
    return response;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:19,代码来源:MCRTokenRequest.java

示例6: will_fail_on_init

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
@Test
public void will_fail_on_init(@ArquillianResteasyResource("resources/webhook") WebTarget target) {
    String data = "This our important content to be sent";
    String secret = "password4tests";
    
    final Builder request = target.request(MediaType.TEXT_PLAIN);
    request.header("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA1, secret, data.getBytes()));
    
    Response resp = request.post(Entity.text(data));
    assertThat(resp, notNullValue());
    assertThat(resp.getStatus(), is(Status.INTERNAL_SERVER_ERROR.getStatusCode()));
    resp.close();
}
 
开发者ID:McFoggy,项目名称:xhub4j,代码行数:14,代码来源:ServletWithPredefinedFailingWebXmlIT.java

示例7: a_post_with_expected_signature_passes_the_filter

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
@Test
public void a_post_with_expected_signature_passes_the_filter(@ArquillianResteasyResource("resources/webhook") WebTarget target) {
    String data = "This our important content to be sent";
    String secret = "password4tests";
    
    final Builder request = target.request(MediaType.TEXT_PLAIN);
    request.header("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA1, secret, data.getBytes()));
    
    Response resp = request.post(Entity.text(data));
    assertThat(resp, notNullValue());
    assertThat(resp.getStatus(), is(Status.ACCEPTED.getStatusCode()));
    resp.close();
}
 
开发者ID:McFoggy,项目名称:xhub4j,代码行数:14,代码来源:BaseServletWebHookTester.java

示例8: a_post_with_missing_signature_fails

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
@Test
public void a_post_with_missing_signature_fails(@ArquillianResteasyResource("resources/webhook") WebTarget target) {
    String data = "This our important content to be sent";
    final Builder request = target.request(MediaType.TEXT_PLAIN);
    Response resp = request.post(Entity.text(data));
    assertThat(resp, notNullValue());
    assertThat(resp.getStatus(), is(Status.INTERNAL_SERVER_ERROR.getStatusCode()));
    resp.close();
}
 
开发者ID:McFoggy,项目名称:xhub4j,代码行数:10,代码来源:BaseServletWebHookTester.java

示例9: a_post_with_signature_with_wrong_password_fails

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
@Test
public void a_post_with_signature_with_wrong_password_fails(@ArquillianResteasyResource("resources/webhook") WebTarget target) {
    String data = "This our important content to be sent";
    String secret = "modified-password4tests";
    
    final Builder request = target.request(MediaType.TEXT_PLAIN);
    request.header("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA1, secret, data.getBytes()));
    
    Response resp = request.post(Entity.text(data));
    assertThat(resp, notNullValue());
    assertThat(resp.getStatus(), is(Status.INTERNAL_SERVER_ERROR.getStatusCode()));
    resp.close();
}
 
开发者ID:McFoggy,项目名称:xhub4j,代码行数:14,代码来源:BaseServletWebHookTester.java

示例10: a_post_with_signature_with_wrong_converter_fails

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
@Test
public void a_post_with_signature_with_wrong_converter_fails(@ArquillianResteasyResource("resources/webhook") WebTarget target) {
    String data = "This our important content to be sent";
    String secret = "password4tests";
    
    final Builder request = target.request(MediaType.TEXT_PLAIN);
    request.header("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA, XHubDigest.SHA1, secret, data.getBytes()));
    
    Response resp = request.post(Entity.text(data));
    assertThat(resp, notNullValue());
    assertThat(resp.getStatus(), is(Status.INTERNAL_SERVER_ERROR.getStatusCode()));
    resp.close();
}
 
开发者ID:McFoggy,项目名称:xhub4j,代码行数:14,代码来源:BaseServletWebHookTester.java

示例11: a_post_with_signature_with_SH256_digest_succeed

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
@Test
public void a_post_with_signature_with_SH256_digest_succeed(@ArquillianResteasyResource("resources/webhook") WebTarget target) {
    String data = "This our important content to be sent";
    String secret = "password4tests";
    
    final Builder request = target.request(MediaType.TEXT_PLAIN);
    request.header("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA256, secret, data.getBytes()));
    
    Response resp = request.post(Entity.text(data));
    assertThat(resp, notNullValue());
    assertThat(resp.getStatus(), is(Status.ACCEPTED.getStatusCode()));
    resp.close();
}
 
开发者ID:McFoggy,项目名称:xhub4j,代码行数:14,代码来源:BaseServletWebHookTester.java

示例12: a_post_with_signature_with_SHA512_digest_succeed

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
@Test
public void a_post_with_signature_with_SHA512_digest_succeed(@ArquillianResteasyResource("resources/webhook") WebTarget target) {
    String data = "This our important content to be sent";
    String secret = "password4tests";
    
    final Builder request = target.request(MediaType.TEXT_PLAIN);
    request.header("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA512, secret, data.getBytes()));
    
    Response resp = request.post(Entity.text(data));
    assertThat(resp, notNullValue());
    assertThat(resp.getStatus(), is(Status.ACCEPTED.getStatusCode()));
    resp.close();
}
 
开发者ID:McFoggy,项目名称:xhub4j,代码行数:14,代码来源:BaseServletWebHookTester.java

示例13: a_post_with_signature_with_MD5_digest_succeed

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
@Test
public void a_post_with_signature_with_MD5_digest_succeed(@ArquillianResteasyResource("resources/webhook") WebTarget target) {
    String data = "This our important content to be sent";
    String secret = "password4tests";
    
    final Builder request = target.request(MediaType.TEXT_PLAIN);
    request.header("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.MD5, secret, data.getBytes()));
    
    Response resp = request.post(Entity.text(data));
    assertThat(resp, notNullValue());
    assertThat(resp.getStatus(), is(Status.ACCEPTED.getStatusCode()));
    resp.close();
}
 
开发者ID:McFoggy,项目名称:xhub4j,代码行数:14,代码来源:BaseServletWebHookTester.java

示例14: post

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
public <T> T post(String url, Object payload, Class<T> type) {
    Client client = ClientBuilder.newClient();

    WebTarget resource = client.target(url);

    Builder request = resource.request();
    request.accept(MediaType.APPLICATION_JSON);

    return request.post(
        Entity.entity(JacksonUtil.serializeToJson(payload), MediaType.APPLICATION_JSON), type
    );
}
 
开发者ID:aol,项目名称:micro-server,代码行数:13,代码来源:RestAgent.java

示例15: post

import javax.ws.rs.client.Invocation.Builder; //导入方法依赖的package包/类
public<T> T post(String url, Object payload,Class<T> type) {
	Client client = ClientBuilder.newClient();

	WebTarget resource = client.target(url);

	Builder request = resource.request();
	request.accept(MediaType.APPLICATION_JSON);

	return request.post(Entity.entity(JacksonUtil.serializeToJson(payload),MediaType.APPLICATION_JSON), type);
}
 
开发者ID:aol,项目名称:micro-server,代码行数:11,代码来源:RestAgent.java


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