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


Java JerseyInvocation类代码示例

本文整理汇总了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;未经允许,请勿转载。