本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
}
}