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


Java ClientRequestContext.abortWith方法代碼示例

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


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

示例1: checkParams

import javax.ws.rs.client.ClientRequestContext; //導入方法依賴的package包/類
/**
 * Check parameters on request Context
 * @param requestContext
 */
private void checkParams(ClientRequestContext requestContext){
    if (key==null) {
        Object keyObject = requestContext.getProperty(JWS_FILTER_KEY);
        if (keyObject == null) {
            requestContext.abortWith(
                    Response.status(Response.Status.BAD_REQUEST).entity("Error " + JWS_FILTER_KEY + " param is required")
                            .build()
            );
        }else if (keyObject instanceof RSAPrivateKey) {
            key = (RSAPrivateKey)keyObject;

       }

    }
}
 
開發者ID:Appverse,項目名稱:appverse-server,代碼行數:20,代碼來源:JWSJerseyFilter.java

示例2: filter

import javax.ws.rs.client.ClientRequestContext; //導入方法依賴的package包/類
@Override
public void filter(ClientRequestContext clientRequestContext) throws IOException {
    String httpMethod = clientRequestContext.getMethod();
    if ("MYMETHOD".equals(httpMethod)) {
        clientRequestContext.abortWith(Response.ok(httpMethod).build());
    }
    else {
        clientRequestContext.abortWith(Response.status(405).entity(httpMethod).build());
    }
}
 
開發者ID:eclipse,項目名稱:microprofile-rest-client,代碼行數:11,代碼來源:CustomHttpMethodFilter.java

示例3: filter

import javax.ws.rs.client.ClientRequestContext; //導入方法依賴的package包/類
@Override
public void filter(ClientRequestContext clientRequestContext) throws IOException {
    String query = clientRequestContext.getUri().getQuery();
    Cookie cookie = clientRequestContext.getCookies().get("cookie");
    String cookieValue = cookie==null?"null":cookie.getValue();
    String header = clientRequestContext.getHeaderString("MyHeader");
    clientRequestContext.abortWith(Response.ok(query + " " + cookieValue + " " + header).build());
}
 
開發者ID:eclipse,項目名稱:microprofile-rest-client,代碼行數:9,代碼來源:BeanParamFilter.java

示例4: filter

import javax.ws.rs.client.ClientRequestContext; //導入方法依賴的package包/類
@Override
public void filter(ClientRequestContext clientRequestContext) throws IOException {
    logger.info("Client request called");
    final String methodName = clientRequestContext.getMethod();
    if (methodName.equals("PATCH")) {
        clientRequestContext.abortWith(
                Response.status(Response.Status.METHOD_NOT_ALLOWED)
                        .entity("HTTP Patch is NOT supported")
                        .build());
    }
}
 
開發者ID:cloudskol,項目名稱:restskol,代碼行數:12,代碼來源:RestSkolClientRequestFilter.java

示例5: filter

import javax.ws.rs.client.ClientRequestContext; //導入方法依賴的package包/類
@Override
public void filter(ClientRequestContext requestContext) throws IOException {
	ResponseBuilder responseBuilder = serverError();
	Response response = responseBuilder.status(BAD_REQUEST).build();
	requestContext.abortWith(response);
}
 
開發者ID:PacktPublishing,項目名稱:Mastering-Java-EE-Development-with-WildFly,代碼行數:7,代碼來源:BlockChainFilter.java

示例6: filter

import javax.ws.rs.client.ClientRequestContext; //導入方法依賴的package包/類
@Override
public void filter(ClientRequestContext clientRequestContext) throws IOException {
    clientRequestContext.abortWith(Response.ok(clientRequestContext.getMethod() + " " + clientRequestContext.getUri()).build());

}
 
開發者ID:eclipse,項目名稱:microprofile-rest-client,代碼行數:6,代碼來源:ReturnWithURLRequestFilter.java

示例7: filter

import javax.ws.rs.client.ClientRequestContext; //導入方法依賴的package包/類
@Override
public void filter(ClientRequestContext requestContext) throws IOException {
    if (!circuitBreaker.checkState()) {
        requestContext.abortWith(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(String.format("Service %s is currently unavilable.", serviceInterface)).build());
    }
}
 
開發者ID:Microbule,項目名稱:microbule,代碼行數:7,代碼來源:CircuitBreakerFilter.java


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