Top Inners Fields Constructors Methods
io.undertow.server.handlers

public Class JDBCLogHandler

extends Object
implements HttpHandler, Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable, io.undertow.server.HttpHandler
Imports
io.undertow.UndertowLogger, .UndertowMessages, io.undertow.security.api.SecurityContext, io.undertow.server.ExchangeCompletionListener, .HandlerWrapper, .HttpHandler, .HttpServerExchange, io.undertow.server.handlers.builder.HandlerBuilder, io.undertow.util.Headers, java.net.InetSocketAddress, java.sql.Connection, .PreparedStatement, .SQLException, .Timestamp, java.util.ArrayList, .Collections, .Deque, .HashMap, .List, .Map, .Set, java.util.concurrent.ConcurrentLinkedDeque, .Executor, java.util.concurrent.atomic.AtomicIntegerFieldUpdater, javax.naming.InitialContext, .NamingException, javax.sql.DataSource

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static class
private class
private static class

Field Summary

Modifier and TypeField and Description
private String
private final DataSource
private final ExchangeCompletionListener
private volatile Executor
private final String
private String
private final HttpHandler
private final Deque<JDBCLogHandler.JDBCLogAttribute>
private String
private String
private String
private volatile int
private static final AtomicIntegerFieldUpdater<JDBCLogHandler>
private String
private String
private String
protected boolean
private String
private String
private String

Constructor Summary

AccessConstructor and Description
public
JDBCLogHandler(final HttpHandler next, final Executor logWriteExecutor, final String formatString, DataSource dataSource)
Deprecated

public
JDBCLogHandler(final HttpHandler next, final String formatString, DataSource dataSource)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
awaitWrittenForTest()

For tests only.

public String
public String
public String
public String
public String
public String
public String
public String
public String
public String
public String
public void
handleRequest(HttpServerExchange
the HTTP request/response exchange
exchange
)

Implements io.undertow.server.HttpHandler.handleRequest.

Handle the request.

public boolean
public void
private PreparedStatement
public void
run()

Implements java.lang.Runnable.run.

insert the log record to database

public void
setBytesField(String bytesField)

public void
setMethodField(String methodField)

public void
setQueryField(String queryField)

public void
setRefererField(String refererField)

public void
setRemoteHostField(String remoteHostField)

public void
setStatusField(String statusField)

public void
setTableName(String tableName)

public void
setTimestampField(String timestampField)

public void
setUseLongContentLength(boolean useLongContentLength)

public void
setUserAgentField(String userAgentField)

public void
setUserField(String userField)

public void
setVirtualHostField(String virtualHostField)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bytesFieldback to summary
private String bytesField
dataSourceback to summary
private final DataSource dataSource
exchangeCompletionListenerback to summary
private final ExchangeCompletionListener exchangeCompletionListener
executorback to summary
private volatile Executor executor
Annotations
@SuppressWarnings:unused
formatStringback to summary
private final String formatString
methodFieldback to summary
private String methodField
nextback to summary
private final HttpHandler next
pendingMessagesback to summary
private final Deque<JDBCLogHandler.JDBCLogAttribute> pendingMessages
queryFieldback to summary
private String queryField
refererFieldback to summary
private String refererField
remoteHostFieldback to summary
private String remoteHostField
stateback to summary
private volatile int state
Annotations
@SuppressWarnings:unused
stateUpdaterback to summary
private static final AtomicIntegerFieldUpdater<JDBCLogHandler> stateUpdater
statusFieldback to summary
private String statusField
tableNameback to summary
private String tableName
timestampFieldback to summary
private String timestampField
useLongContentLengthback to summary
protected boolean useLongContentLength
userAgentFieldback to summary
private String userAgentField
userFieldback to summary
private String userField
virtualHostFieldback to summary
private String virtualHostField

Constructor Detail

JDBCLogHandlerback to summary
public JDBCLogHandler(final HttpHandler next, final Executor logWriteExecutor, final String formatString, DataSource dataSource)

Deprecated

Annotations
@Deprecated
JDBCLogHandlerback to summary
public JDBCLogHandler(final HttpHandler next, final String formatString, DataSource dataSource)

Method Detail

awaitWrittenForTestback to summary
pack-priv void awaitWrittenForTest() throws InterruptedException

For tests only. Blocks the current thread until all messages are written Just does a busy wait.

DO NOT USE THIS OUTSIDE OF A TEST

getBytesFieldback to summary
public String getBytesField()
getMethodFieldback to summary
public String getMethodField()
getQueryFieldback to summary
public String getQueryField()
getRefererFieldback to summary
public String getRefererField()
getRemoteHostFieldback to summary
public String getRemoteHostField()
getStatusFieldback to summary
public String getStatusField()
getTableNameback to summary
public String getTableName()
getTimestampFieldback to summary
public String getTimestampField()
getUserAgentFieldback to summary
public String getUserAgentField()
getUserFieldback to summary
public String getUserField()
getVirtualHostFieldback to summary
public String getVirtualHostField()
handleRequestback to summary
public void handleRequest(HttpServerExchange exchange) throws Exception

Implements io.undertow.server.HttpHandler.handleRequest.

Doc from io.undertow.server.HttpHandler.handleRequest.

Handle the request.

Parameters
exchange:HttpServerExchange

the HTTP request/response exchange

Annotations
@Override
isUseLongContentLengthback to summary
public boolean isUseLongContentLength()
logMessageback to summary
public void logMessage(String pattern, HttpServerExchange exchange)
prepareStatementback to summary
private PreparedStatement prepareStatement(Connection conn) throws SQLException
runback to summary
public void run()

Implements java.lang.Runnable.run.

insert the log record to database

Annotations
@Override
setBytesFieldback to summary
public void setBytesField(String bytesField)
setMethodFieldback to summary
public void setMethodField(String methodField)
setQueryFieldback to summary
public void setQueryField(String queryField)
setRefererFieldback to summary
public void setRefererField(String refererField)
setRemoteHostFieldback to summary
public void setRemoteHostField(String remoteHostField)
setStatusFieldback to summary
public void setStatusField(String statusField)
setTableNameback to summary
public void setTableName(String tableName)
setTimestampFieldback to summary
public void setTimestampField(String timestampField)
setUseLongContentLengthback to summary
public void setUseLongContentLength(boolean useLongContentLength)
setUserAgentFieldback to summary
public void setUserAgentField(String userAgentField)
setUserFieldback to summary
public void setUserField(String userField)
setVirtualHostFieldback to summary
public void setVirtualHostField(String virtualHostField)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
writeMessageback to summary
private void writeMessage(List<JDBCLogHandler.JDBCLogAttribute> messages)
io.undertow.server.handlers back to summary

public Class JDBCLogHandler.Builder

extends Object
implements HandlerBuilder
Class Inheritance
All Implemented Interfaces
io.undertow.server.handlers.builder.HandlerBuilder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public HandlerWrapper
build(Map<String, Object>
The handler config
config
)

Implements io.undertow.server.handlers.builder.HandlerBuilder.build.

Creates the handler

public String
public String
name()

Implements io.undertow.server.handlers.builder.HandlerBuilder.name.

The string representation of the handler name.

public Map<String, Class<?>>
parameters()

Implements io.undertow.server.handlers.builder.HandlerBuilder.parameters.

Returns a map of parameters and their types.

public Set<String>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Builderback to summary
public Builder()

Method Detail

buildback to summary
public HandlerWrapper build(Map<String, Object> config)

Implements io.undertow.server.handlers.builder.HandlerBuilder.build.

Doc from io.undertow.server.handlers.builder.HandlerBuilder.build.

Creates the handler

Parameters
config:Map<String, Object>

The handler config

Returns:HandlerWrapper

The new predicate

Annotations
@Override
defaultParameterback to summary
public String defaultParameter()

Implements io.undertow.server.handlers.builder.HandlerBuilder.defaultParameter.

Returns:String

Doc from io.undertow.server.handlers.builder.HandlerBuilder.defaultParameter.

The default parameter name, or null if it does not have a default parameter

Annotations
@Override
nameback to summary
public String name()

Implements io.undertow.server.handlers.builder.HandlerBuilder.name.

Doc from io.undertow.server.handlers.builder.HandlerBuilder.name.

The string representation of the handler name.

Returns:String

The handler name

Annotations
@Override
parametersback to summary
public Map<String, Class<?>> parameters()

Implements io.undertow.server.handlers.builder.HandlerBuilder.parameters.

Doc from io.undertow.server.handlers.builder.HandlerBuilder.parameters.

Returns a map of parameters and their types.

Annotations
@Override
requiredParametersback to summary
public Set<String> requiredParameters()

Implements io.undertow.server.handlers.builder.HandlerBuilder.requiredParameters.

Returns:Set<String>

Doc from io.undertow.server.handlers.builder.HandlerBuilder.requiredParameters.

The required parameters

Annotations
@Override
io.undertow.server.handlers back to summary

private Class JDBCLogHandler.JDBCLogAttribute

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
protected long
protected String
protected String
protected String
protected String
protected String
protected int
protected Timestamp
protected String
protected String
protected String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bytesback to summary
protected long bytes
methodback to summary
protected String method
patternback to summary
protected String pattern
queryback to summary
protected String query
refererback to summary
protected String referer
remoteHostback to summary
protected String remoteHost
statusback to summary
protected int status
timestampback to summary
protected Timestamp timestamp
userback to summary
protected String user
userAgentback to summary
protected String userAgent
virtualHostback to summary
protected String virtualHost

Constructor Detail

JDBCLogAttributeback to summary
private JDBCLogAttribute()
io.undertow.server.handlers back to summary

private Class JDBCLogHandler.JDBCLogCompletionListener

extends Object
implements ExchangeCompletionListener
Class Inheritance
  • java.lang.Object
  • io.undertow.server.handlers.JDBCLogHandler.JDBCLogCompletionListener
All Implemented Interfaces
io.undertow.server.ExchangeCompletionListener

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

JDBCLogCompletionListenerback to summary
private JDBCLogCompletionListener()

Method Detail

exchangeEventback to summary
public void exchangeEvent(final HttpServerExchange exchange, final ExchangeCompletionListener.NextListener nextListener)

Implements io.undertow.server.ExchangeCompletionListener.exchangeEvent.

Annotations
@Override
io.undertow.server.handlers back to summary

private Class JDBCLogHandler.Wrapper

extends Object
implements HandlerWrapper
Class Inheritance
All Implemented Interfaces
io.undertow.server.HandlerWrapper

Field Summary

Modifier and TypeField and Description
private final String
private final DataSource
private final String
private final String
private final String
private final String
private final String
private final String
private final String
private final String
private final String
private final String
private final String

Constructor Summary

AccessConstructor and Description
private
Wrapper(String format, DataSource datasource, String tableName, String remoteHostField, String userField, String timestampField, String virtualHostField, String methodField, String queryField, String statusField, String bytesField, String refererField, String userAgentField)

Method Summary

Modifier and TypeMethod and Description
public HttpHandler
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bytesFieldback to summary
private final String bytesField
datasourceback to summary
private final DataSource datasource
formatback to summary
private final String format
methodFieldback to summary
private final String methodField
queryFieldback to summary
private final String queryField
refererFieldback to summary
private final String refererField
remoteHostFieldback to summary
private final String remoteHostField
statusFieldback to summary
private final String statusField
tableNameback to summary
private final String tableName
timestampFieldback to summary
private final String timestampField
userAgentFieldback to summary
private final String userAgentField
userFieldback to summary
private final String userField
virtualHostFieldback to summary
private final String virtualHostField

Constructor Detail

Wrapperback to summary
private Wrapper(String format, DataSource datasource, String tableName, String remoteHostField, String userField, String timestampField, String virtualHostField, String methodField, String queryField, String statusField, String bytesField, String refererField, String userAgentField)

Method Detail

wrapback to summary
public HttpHandler wrap(HttpHandler handler)

Implements io.undertow.server.HandlerWrapper.wrap.

Annotations
@Override