本文整理匯總了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;
}
}
}