當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。