예제 #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
 /*
  * (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();
 }