當前位置: 首頁>>代碼示例>>Java>>正文


Java ProcessingException.getMessage方法代碼示例

本文整理匯總了Java中javax.ws.rs.ProcessingException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java ProcessingException.getMessage方法的具體用法?Java ProcessingException.getMessage怎麽用?Java ProcessingException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.ws.rs.ProcessingException的用法示例。


在下文中一共展示了ProcessingException.getMessage方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getResponse

import javax.ws.rs.ProcessingException; //導入方法依賴的package包/類
private T getResponse(Response response) {
  Family statusFamily = response.getStatusInfo().getFamily();
  if (response.getMediaType().getSubtype().equals(MediaType.APPLICATION_JSON_TYPE.getSubtype())) {
    try {
      if (statusFamily == Family.INFORMATIONAL || statusFamily == Family.SUCCESSFUL) {
        T content = response.readEntity(respContentClass);
        return content;
      } else {
        JsonResponse jsonRes = response.readEntity(JsonResponse.class);
        throw new IllegalStateException(jsonRes.getErrorMsg());
      }
    } catch (ProcessingException e) {
      throw new IllegalStateException(e.getMessage());
    }
  } else {
    throw new IllegalStateException("Cannot Connect To Server.");
  }

}
 
開發者ID:hopshadoop,項目名稱:hopsworks,代碼行數:20,代碼來源:ClientWrapper.java

示例2: post

import javax.ws.rs.ProcessingException; //導入方法依賴的package包/類
public Response post(String path, MultivaluedMap<String, String> queryParams, Object object, String type) {
    try {
        Response response = get(path, queryParams).post(Entity.entity(object, type));
        if (response.getStatus() != Response.Status.OK.getStatusCode()) {
            throw getException("Scylla API server HTTP POST to URL '" + path + "' failed",
                    response.readEntity(String.class));
        }
        return response;
    } catch (ProcessingException e) {
        throw new IllegalStateException("Unable to connect to Scylla API server: " + e.getMessage());
    }
}
 
開發者ID:scylladb,項目名稱:scylla-jmx,代碼行數:13,代碼來源:APIClient.java

示例3: getRawValue

import javax.ws.rs.ProcessingException; //導入方法依賴的package包/類
public String getRawValue(String string, MultivaluedMap<String, String> queryParams, long duration) {
    try {
        if (string.equals("")) {
            return "";
        }
        String key = getCacheKey(string, queryParams, duration);
        String res = getStringFromCache(key, duration);
        if (res != null) {
            return res;
        }
        Response response = get(string, queryParams).get(Response.class);

        if (response.getStatus() != Response.Status.OK.getStatusCode()) {
            // TBD
            // We are currently not caching errors,
            // it should be reconsider.
            throw getException("Scylla API server HTTP GET to URL '" + string + "' failed",
                    response.readEntity(String.class));
        }
        res = response.readEntity(String.class);
        if (duration > 0) {
            cache.put(key, new CacheEntry(res));
        }
        return res;
    } catch (ProcessingException e) {
        throw new IllegalStateException("Unable to connect to Scylla API server: " + e.getMessage());
    }
}
 
開發者ID:scylladb,項目名稱:scylla-jmx,代碼行數:29,代碼來源:APIClient.java

示例4: doGet

import javax.ws.rs.ProcessingException; //導入方法依賴的package包/類
public T doGet() {
  performSanityCheck();
  try {
    WebTarget webTarget = client.target(target).path(path);
    Response response = webTarget.request(mediaType).get();
    return getResponse(response);
  } catch (ProcessingException ex) {
    throw new IllegalStateException(ex.getMessage());
  } finally {
    if (client != null) {
      client.close();
      client = null;
    }
  }
}
 
開發者ID:hopshadoop,項目名稱:hopsworks,代碼行數:16,代碼來源:ClientWrapper.java

示例5: doPost

import javax.ws.rs.ProcessingException; //導入方法依賴的package包/類
public T doPost() {
  performSanityCheck();
  try {
    WebTarget webTarget = client.target(target).path(path);
    Response response = webTarget.request(mediaType).post(payload);
    return getResponse(response);
  } catch (ProcessingException ex) {
    throw new IllegalStateException(ex.getMessage());
  } finally {
    if (client != null) {
      client.close();
      client = null;
    }
  }
}
 
開發者ID:hopshadoop,項目名稱:hopsworks,代碼行數:16,代碼來源:ClientWrapper.java

示例6: doPut

import javax.ws.rs.ProcessingException; //導入方法依賴的package包/類
public T doPut() {
  performSanityCheck();
  try {
    WebTarget webTarget = client.target(target).path(path);
    Response response = webTarget.request(mediaType).put(payload);
    return getResponse(response);
  } catch (ProcessingException ex) {
    throw new IllegalStateException(ex.getMessage());
  } finally {
    if (client != null) {
      client.close();
      client = null;
    }
  }
}
 
開發者ID:hopshadoop,項目名稱:hopsworks,代碼行數:16,代碼來源:ClientWrapper.java

示例7: doDelete

import javax.ws.rs.ProcessingException; //導入方法依賴的package包/類
public T doDelete() {
  performSanityCheck();
  try {
    WebTarget webTarget = client.target(target).path(path);
    Response response = webTarget.request(mediaType).delete();
    return getResponse(response);
  } catch (ProcessingException ex) {
    throw new IllegalStateException(ex.getMessage());
  } finally {
    if (client != null) {
      client.close();
      client = null;
    }
  }
}
 
開發者ID:hopshadoop,項目名稱:hopsworks,代碼行數:16,代碼來源:ClientWrapper.java

示例8: rewrapIoExceptions

import javax.ws.rs.ProcessingException; //導入方法依賴的package包/類
/**
 * Performs a call and rewraps JAX-RS IOExceptions into {@link ServiceUnavailableException}.
 * @throws WebApplicationException all IOExceptions are wrapped in
 */
public static <T> T rewrapIoExceptions(Supplier<T> call) throws WebApplicationException {
  try {
    return call.get();
  } catch (ProcessingException e) {
    Throwable cause = e.getCause();
    if (cause == null) {
      throw e;
    }
    if (!(cause instanceof IOException)) {
      throw e;
    }
    throw new ServiceUnavailableException(e.getMessage());
  }
}
 
開發者ID:OsuCelebrity,項目名稱:OsuCelebrity,代碼行數:19,代碼來源:TwitchApiImpl.java

示例9: doGetGenericType

import javax.ws.rs.ProcessingException; //導入方法依賴的package包/類
public List<T> doGetGenericType() {
  performSanityCheck();
  try {
    WebTarget webTarget = client.target(target).path(path);
    Response response = webTarget.request(mediaType).get();
    ParameterizedType parameterizedGenericType = new ParameterizedType() {
      @Override
      public Type[] getActualTypeArguments() {
        return new Type[]{respContentClass};
      }

      @Override
      public Type getRawType() {
        return List.class;
      }

      @Override
      public Type getOwnerType() {
        return List.class;
      }
    };
    GenericType<List<T>> type = new GenericType<List<T>>(parameterizedGenericType) {
    };
    Family status = response.getStatusInfo().getFamily();
    try {
      if (status == Family.INFORMATIONAL || status == Family.SUCCESSFUL) {
        List<T> content = response.readEntity(type);
        return content;
      } else {
        JsonResponse jsonRes = response.readEntity(JsonResponse.class);
        throw new IllegalStateException(jsonRes.getErrorMsg());
      }
    } catch (ProcessingException e) {
      throw new IllegalStateException(e.getMessage());
    }
  } finally {
    if (client != null) {
      client.close();
      client = null;
    }
  }
}
 
開發者ID:hopshadoop,項目名稱:hopsworks,代碼行數:43,代碼來源:ClientWrapper.java


注:本文中的javax.ws.rs.ProcessingException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。