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


Java ClientErrorException.getMessage方法代碼示例

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


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

示例1: toResponse

import javax.ws.rs.ClientErrorException; //導入方法依賴的package包/類
@Override
public Response toResponse(final ClientErrorException exception) {
    final Response response = exception.getResponse();

    final RestError error = new RestError(exception.getMessage(), "Given request is not acceptable", null,
        response.getStatus());

    return Response.fromResponse(response).type(MediaType.APPLICATION_JSON_TYPE).entity(error).build();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:10,代碼來源:ClientErrorExceptionMapper.java

示例2: executeRequest

import javax.ws.rs.ClientErrorException; //導入方法依賴的package包/類
/**
 * Execute a request for the given method using the given builder.
 * @param httpMethod The HTTP method to be used, as specified by one of the constants
 *                   in {@link HttpMethod}
 * @param builder	 The builder used to execute the request. Usually this builder is created
 *                   using {@link #getBaseResource()}.path(...).entity(...).accept(...)...
 * @param returnType The return type for the data returned by the request.
 * @return The result of executing the HTTP request.
 */
public <T> T executeRequest(String httpMethod, Builder builder, Entity<?> entity, Class<T> returnType) {
	Response response = null;
	try {
		initializeConnection(httpMethod);
		builder = updateBuilder(builder);
		response = builder.build(httpMethod, entity).invoke();
		return checkResponseAndGetOutput(httpMethod, builder, response, returnType);
	} catch ( ClientErrorException e ) {
		throw new RuntimeException("Error accessing remote system:\n"+e.getMessage(), e);
	} finally {
		if ( response != null ) { response.close(); }
	}
}
 
開發者ID:fod-dev,項目名稱:FoDBugTrackerUtility,代碼行數:23,代碼來源:RestConnection.java

示例3: PulsarAdminException

import javax.ws.rs.ClientErrorException; //導入方法依賴的package包/類
public PulsarAdminException(ClientErrorException e) {
    super(getReasonFromServer(e), e);
    this.httpError = e.getMessage();
    this.statusCode = e.getResponse().getStatus();
}
 
開發者ID:apache,項目名稱:incubator-pulsar,代碼行數:6,代碼來源:PulsarAdminException.java


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