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


Java IPolicyContext.getLogger方法代碼示例

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


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

示例1: doApply

import io.apiman.gateway.engine.policy.IPolicyContext; //導入方法依賴的package包/類
/**
 * @see io.apiman.gateway.engine.policies.AbstractMappedPolicy#doApply(io.apiman.gateway.engine.beans.ApiResponse, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object, io.apiman.gateway.engine.policy.IPolicyChain)
 */
@Override
protected void doApply(ApiResponse response, IPolicyContext context, LogHeadersConfigBean config,
        IPolicyChain<ApiResponse> chain) {
    IApimanLogger logger = context.getLogger(getClass());
    if (config.getDirection() != LogHeadersDirectionType.request) {
        String endpoint = context.getAttribute(ENDPOINT_ATTRIBUTE, ""); //$NON-NLS-1$
        if (config.isLogStatusCode()) {
            logger.info(String.format("Status code %d for %s", response.getCode(), endpoint));
        }
        if (config.isLogHeaders()) {
            logHeaders(logger, response.getHeaders(), HttpDirection.RESPONSE, endpoint);
        }
    }
    chain.doApply(response);
}
 
開發者ID:apiman,項目名稱:apiman-plugins,代碼行數:19,代碼來源:LogHeadersPolicy.java

示例2: BatchedRep

import io.apiman.gateway.engine.policy.IPolicyContext; //導入方法依賴的package包/類
public BatchedRep(Auth3ScaleBean auth3ScaleBean,
        ApiRequest request,
        ApiResponse response,
        IPolicyContext context,
        ReporterImpl<BatchedReportData> reporter,
        StandardAuthCache authCache,
        BatchedAuthCache heuristicCache) {
    this.config = auth3ScaleBean.getThreescaleConfig().getProxyConfig().getBackendConfig();
    this.backendUri = auth3ScaleBean.getBackendEndpoint();
    this.request = request;
    this.context = context;
    this.reporter = reporter;
    this.authCache = authCache;
    this.heuristicCache = heuristicCache;
    this.httpClient = context.getComponent(IHttpClientComponent.class);
    this.failureFactory = context.getComponent(IPolicyFailureFactoryComponent.class);
    this.logger = context.getLogger(BatchedRep.class);
}
 
開發者ID:apiman,項目名稱:apiman-plugins,代碼行數:19,代碼來源:BatchedRep.java

示例3: BatchedAuth

import io.apiman.gateway.engine.policy.IPolicyContext; //導入方法依賴的package包/類
public BatchedAuth(Auth3ScaleBean auth3ScaleBean,
        ApiRequest request,
        IPolicyContext context,
        StandardAuthCache authCache,
        BatchedAuthCache heuristicCache) {
    this.backendUri = auth3ScaleBean.getBackendEndpoint();
    this.config = auth3ScaleBean.getThreescaleConfig().getProxyConfig().getBackendConfig();
    this.request = request;
    this.context = context;
    this.authCache = authCache;
    this.heuristicCache = heuristicCache;
    this.logger = context.getLogger(BatchedAuth.class);
    this.serviceId = config.getProxy().getServiceId();
    this.httpClient = context.getComponent(IHttpClientComponent.class);
    this.failureFactory = context.getComponent(IPolicyFailureFactoryComponent.class);
}
 
開發者ID:apiman,項目名稱:apiman-plugins,代碼行數:17,代碼來源:BatchedAuth.java

示例4: start

import io.apiman.gateway.engine.policy.IPolicyContext; //導入方法依賴的package包/類
public BatchedReporter start(IPolicyContext context, BatchedReporterOptions options) {
    if (started) {
        throw new IllegalStateException("Already started");
    }

    this.retryReporter = new RetryReporter(options.getRetryQueueMaxSize());
    reporters.add(retryReporter);

    this.httpClient = context.getComponent(IHttpClientComponent.class);
    this.periodic = context.getComponent(IPeriodicComponent.class);
    this.logger = context.getLogger(BatchedReporter.class);

    this.timerId = periodic.setPeriodicTimer(options.getReportingInterval(),
            options.getInitialWait(),
            id -> send());
    started = true;
    return this;
}
 
開發者ID:apiman,項目名稱:apiman-plugins,代碼行數:19,代碼來源:BatchedReporter.java

示例5: apply

import io.apiman.gateway.engine.policy.IPolicyContext; //導入方法依賴的package包/類
/**
 * @see io.apiman.gateway.engine.policy.IPolicy#apply(io.apiman.gateway.engine.beans.ApiRequest, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object, io.apiman.gateway.engine.policy.IPolicyChain)
 */
@Override
@SuppressWarnings("nls")
public void apply(final ApiRequest request, final IPolicyContext context, final Object config,
        final IPolicyChain<ApiRequest> chain) {
    // This is just for testing, don't do this at home, kids.
    TestLogger logger = (TestLogger) context.getLogger(getClass());
    logger.setHeaders(request.getHeaders());
    logger.info("Hello, I am an info message");
    logger.debug("Hello, I am a debug message");
    logger.warn("Hello, I am a warn message");
    logger.trace("Hello, I am a trace message");
    logger.error("Hello, I am an error message", new RuntimeException("An example of an error"));
    logger.error(new RuntimeException("Just the exception"));
    chain.doApply(request);
}
 
開發者ID:apiman,項目名稱:apiman,代碼行數:19,代碼來源:LoggingPolicy.java

示例6: StandardRep

import io.apiman.gateway.engine.policy.IPolicyContext; //導入方法依賴的package包/類
public StandardRep(Auth3ScaleBean auth3ScaleBean,
        ApiRequest request,
        ApiResponse response,
        IPolicyContext context,
        StandardAuthCache authCache) {
    this.backendUri = auth3ScaleBean.getBackendEndpoint();
    this.config = auth3ScaleBean.getThreescaleConfig().getProxyConfig().getBackendConfig();
    this.request = request;
    this.context = context;
    this.httpClient = context.getComponent(IHttpClientComponent.class);
    this.failureFactory = context.getComponent(IPolicyFailureFactoryComponent.class);
    this.logger = context.getLogger(StandardRep.class);
    this.authCache = authCache;
}
 
開發者ID:apiman,項目名稱:apiman-plugins,代碼行數:15,代碼來源:StandardRep.java

示例7: StandardAuth

import io.apiman.gateway.engine.policy.IPolicyContext; //導入方法依賴的package包/類
public StandardAuth(Auth3ScaleBean auth3ScaleBean,
        ApiRequest request,
        IPolicyContext context,
        StandardAuthCache authCache) {
    this.backendUri = auth3ScaleBean.getBackendEndpoint();
    this.config = auth3ScaleBean.getThreescaleConfig().getProxyConfig().getBackendConfig();
    this.request = request;
    this.context = context;
    this.httpClient = context.getComponent(IHttpClientComponent.class);
    this.failureFactory = context.getComponent(IPolicyFailureFactoryComponent.class);
    this.logger = context.getLogger(StandardAuth.class);
    this.serviceId = config.getProxy().getServiceId();
    this.authCache = authCache;
}
 
開發者ID:apiman,項目名稱:apiman-plugins,代碼行數:15,代碼來源:StandardAuth.java

示例8: init

import io.apiman.gateway.engine.policy.IPolicyContext; //導入方法依賴的package包/類
private void init(IPolicyContext context) {
    if (!init) {
        synchronized (this) {
            auth3scale = new AuthRep(context);
            logger = context.getLogger(Auth3Scale.class);
            init = true;
        }
    }
}
 
開發者ID:apiman,項目名稱:apiman-plugins,代碼行數:10,代碼來源:Auth3Scale.java


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