本文整理汇总了Java中ch.qos.logback.access.spi.IAccessEvent.getRequestHeader方法的典型用法代码示例。如果您正苦于以下问题:Java IAccessEvent.getRequestHeader方法的具体用法?Java IAccessEvent.getRequestHeader怎么用?Java IAccessEvent.getRequestHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.access.spi.IAccessEvent
的用法示例。
在下文中一共展示了IAccessEvent.getRequestHeader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import ch.qos.logback.access.spi.IAccessEvent; //导入方法依赖的package包/类
@Override
public String convert(IAccessEvent accessEvent) {
if(!isStarted()) {
return "INACTIVE_HEADER_CONV";
}
if(key != null) {
return accessEvent.getRequestHeader(key);
} else {
return accessEvent.getRequestHeaderMap().toString();
}
}
示例2: addRequestHeaders
import ch.qos.logback.access.spi.IAccessEvent; //导入方法依赖的package包/类
void addRequestHeaders(IAccessEvent event,
Connection connection, long eventId) throws SQLException {
Enumeration names = event.getRequestHeaderNames();
if (names.hasMoreElements()) {
PreparedStatement insertHeaderStatement = connection
.prepareStatement(insertHeaderSQL);
while (names.hasMoreElements()) {
String key = (String) names.nextElement();
String value = (String) event.getRequestHeader(key);
insertHeaderStatement.setLong(1, eventId);
insertHeaderStatement.setString(2, key);
insertHeaderStatement.setString(3, value);
if (cnxSupportsBatchUpdates) {
insertHeaderStatement.addBatch();
} else {
insertHeaderStatement.execute();
}
}
if (cnxSupportsBatchUpdates) {
insertHeaderStatement.executeBatch();
}
insertHeaderStatement.close();
}
}
示例3: decide
import ch.qos.logback.access.spi.IAccessEvent; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public FilterReply decide(IAccessEvent event) {
String filterReply = event.getRequestHeader(headerName);
return Stream.of(FilterReply.values())
.filter(value -> value.name().equalsIgnoreCase(filterReply))
.findFirst()
.orElse(FilterReply.NEUTRAL);
}
开发者ID:akihyro,项目名称:logback-access-spring-boot-starter,代码行数:10,代码来源:LogbackAccessRequestHeaderDrivenFilter.java