• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JerseyInvocation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.glassfish.jersey.client.JerseyInvocation的典型用法代码示例。如果您正苦于以下问题:Java JerseyInvocation类的具体用法?Java JerseyInvocation怎么用?Java JerseyInvocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: buildAuthorisedClient

import org.glassfish.jersey.client.JerseyInvocation; //导入依赖的package包/类
private JerseyInvocation.Builder buildAuthorisedClient(String url) {
  final JerseyClient client = createClient();
  return client.target(url)
      .request()
      .property(HTTP_AUTHENTICATION_BASIC_USERNAME, authService + "/service")
      .property(HTTP_AUTHENTICATION_BASIC_PASSWORD, basicPassword);
}
 
开发者ID:dehora,项目名称:outland,代码行数:8,代码来源:GroupResourceTest.java


示例2: executeAsync

import org.glassfish.jersey.client.JerseyInvocation; //导入依赖的package包/类
public <T> CheckedFuture<T, UserException> executeAsync(final ElasticAction2<T> action){
  final ContextListenerImpl listener = new ContextListenerImpl();
  // need to cast to jersey since the core javax.ws.rs Invocation doesn't support a typed submission.
  final JerseyInvocation invocation = (JerseyInvocation) action.buildRequest(target, listener);
  final SettableFuture<T> future = SettableFuture.create();
  invocation.submit(new GenericType<T>(action.getResponseClass()), new AsyncCallback<T>(future));
  return Futures.makeChecked(future, new Function<Exception, UserException>(){
    @Override
    public UserException apply(Exception input) {
      if(input instanceof ExecutionException){
        input = (Exception) input.getCause();
      }
      return handleException(input, action, listener);
    }});
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:16,代码来源:ElasticConnectionPool.java


示例3: request

import org.glassfish.jersey.client.JerseyInvocation; //导入依赖的package包/类
@Override
public JerseyInvocation.Builder request() {
    checkNotClosed();
    //TODO
    //return new JerseyInvocation.Builder(getUri(), config.snapshot());
    throw new NotImplementedException();
}
 
开发者ID:martinjmares,项目名称:javaone2015-cloudone,代码行数:8,代码来源:C1WebTargetImpl.java


示例4: getThing

import org.glassfish.jersey.client.JerseyInvocation; //导入依赖的package包/类
private Response getThing(NewCookie sessionCookie) {
    JerseyInvocation.Builder request = getPath().request();
    if (sessionCookie != null) {
        request.cookie(sessionCookie);
    }
    return request.get();
}
 
开发者ID:martindow,项目名称:dropwizard-hazelcast-session,代码行数:8,代码来源:HazelcastSessionBundleTest.java


示例5: mockFeedClientRequest

import org.glassfish.jersey.client.JerseyInvocation; //导入依赖的package包/类
private FeedClient mockFeedClientRequest(String json) throws URISyntaxException {
    FlexCredentials flexCredentials = new FlexCredentials("appId", "appKey");
    JerseyClient jerseyClient = Mockito.mock(JerseyClient.class);
    JerseyWebTarget jerseyWebTarget = Mockito.mock(JerseyWebTarget.class);
    JerseyInvocation.Builder builder = Mockito.mock(JerseyInvocation.Builder.class);

    Mockito.when(jerseyClient.target(Matchers.any(URI.class))).thenReturn(jerseyWebTarget);
    Mockito.when(jerseyWebTarget.request(Matchers.any(MediaType.class))).thenReturn(builder);
    Mockito.when(builder.get(String.class)).thenReturn(json);

    return new FeedClient(flexCredentials, uri, jerseyClient);
}
 
开发者ID:flightstats,项目名称:flex-example-clients,代码行数:13,代码来源:FeedClientTest.java


示例6: setUp

import org.glassfish.jersey.client.JerseyInvocation; //导入依赖的package包/类
@Before
public void setUp() {
  configureBean();
  clientBuilder = spy(ClientBuilder.newBuilder());
  JerseyClient client = mock(JerseyClient.class);
  JerseyWebTarget listTarget = mock(JerseyWebTarget.class);
  JerseyInvocation.Builder builder = mock(JerseyInvocation.Builder.class);
  getInvocation = mock(JerseyInvocation.class);
  JerseyInvocation postInvocation = mock(JerseyInvocation.class);
  listResponse = mock(Response.class);
  runResponse = mock(Response.class);

  doReturn(listTarget).when(client).target(anyString());
  doReturn(listTarget).when(listTarget).queryParam("job_id", configBean.databricksConfigBean.jobId);
  doReturn(builder).when(listTarget).request(MediaType.APPLICATION_JSON_TYPE);
  doReturn(getInvocation).when(builder).buildGet();
  doReturn(listResponse).when(getInvocation).invoke();
  doReturn(postInvocation).when(builder).buildPost(any());
  doReturn(runResponse).when(postInvocation).invoke();

  doReturn(builder).when(listTarget).request();

  doReturn(postInvocation).when(builder)
      .buildPost(Entity.json((
          new RunJarJobJson(configBean.databricksConfigBean.jobId, configBean.databricksConfigBean.jarParams))));

  doReturn(client).when(clientBuilder).build();

}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:30,代码来源:TestSparkExecutor.java


示例7: method

import org.glassfish.jersey.client.JerseyInvocation; //导入依赖的package包/类
protected Response method(ApplicationFullName targetApplication, String name, Entity<?> entity) {
    int port = LoadBalancer.getInstance().getPort(targetApplication);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("method(" + targetApplication + ", " + name + "): port: " + port);
    }
    long startAt = -1;
    if (port > 0) {
        UriBuilder uriBuilder = targetUri
                .clone()
                .scheme("http")
                .host("localhost")
                .port(port);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("method(" + targetApplication + ", " + name + "): URI: " + uriBuilder.build());
        }
        try {
            JerseyInvocation.Builder request = client.target(uriBuilder.build()).request();
            for (MediaType accept : acceptMediaTypes) {
                request = request.accept(accept);
            }
            JerseyInvocation invocation;
            if (entity == null) {
                invocation = request.build(name);
            } else {
                invocation = request.build(name, entity);
            }
            startAt = System.currentTimeMillis();
            Response response = invocation.invoke();
            if (isResponseCodeAcceptable(response.getStatus())) {
                return response;
            }
        } catch (WebApplicationException wExc) {
            if (isResponseCodeAcceptable(wExc.getResponse().getStatus())) {
                throw wExc;
            }
        } catch (Exception e) {
            //TODO: Provide support for balancing to another endpoint (another endpoint of the same cluster).
            LOGGER.warn("Cannot reach application " + targetApplication + " on port " + port, e);
        } finally {
            if (startAt > 0) {
                LoadBalancer.getInstance().updateStats(targetApplication, port, System.currentTimeMillis() - startAt);
            }
        }
    }
    return null;
}
 
开发者ID:martinjmares,项目名称:javaone2015-cloudone,代码行数:47,代码来源:InvokerBase.java


示例8: invocation

import org.glassfish.jersey.client.JerseyInvocation; //导入依赖的package包/类
@Override
public JerseyInvocation.Builder invocation(Link link) {
    return client.invocation(link);
}
 
开发者ID:martinjmares,项目名称:javaone2015-cloudone,代码行数:5,代码来源:C1ClientImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TShortCharMap类代码示例发布时间:2022-05-23
下一篇:
Java RuntimeEvent类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap