当前位置: 首页>>代码示例>>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;未经允许,请勿转载。