コード例 #1
0
ファイル: IceRestClient.java プロジェクト: JBEI/ice
 // WOR
 public <T> T getWor(
     String url, String path, Class<T> clazz, Map<String, Object> queryParams, String token) {
   WebTarget target = client.target("https://" + url).path(path);
   if (queryParams != null) {
     for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
       target = target.queryParam(entry.getKey(), entry.getValue());
     }
   }
   Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE);
   setHeaders(invocationBuilder, token);
   return invocationBuilder.buildGet().invoke(clazz);
 }
コード例 #2
0
ファイル: BasicRESTClient.java プロジェクト: inbloom/java-sdk
 /*
  * (non-Javadoc)
  *
  * @see org.slc.sli.api.client.impl.IRESTClient#getRequestWithHeaders(java.net.URL,
  * java.util.Map)
  */
 @Override
 public Response getRequestWithHeaders(final URL url, final Map<String, Object> headers)
     throws URISyntaxException {
   if (sessionToken == null) {
     logger.log(
         Level.SEVERE,
         String.format("Token is null in call to RESTClient for url: %s", url.toString()));
     return null;
   }
   Invocation.Builder builder = client.target(url.toURI()).request(MediaType.APPLICATION_JSON);
   builder = getCommonRequestBuilder(sessionToken, builder, headers);
   Invocation i = builder.buildGet();
   return i.invoke();
 }