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