public class DBConnectionFilter extends AppControllerFilter
DBConfig
class
of the application before controller is executed and will close it after.HttpSupport.HttpBuilder, HttpSupport.RenderBuilder
Constructor and Description |
---|
DBConnectionFilter()
This constructor is used to open all configured connections for a current environment.
|
DBConnectionFilter(String dbName)
Use this constructor to only open a named DB connection for a given environment.
|
DBConnectionFilter(String dbName,
boolean manageTransaction)
Use this constructor to only open a named DB connection for a given environment and specify
if this filter needs to manage transactions.
|
Modifier and Type | Method and Description |
---|---|
void |
after() |
void |
before() |
void |
onException(Exception e)
To be implemented by application level filters.
|
appContext, assign, blank, context, cookie, cookies, cookieValue, encoding, exists, flash, flash, flash, flash, format, getEncoding, getFile, getHttpServletRequest, getHttpServletResponse, getId, getLocale, getMap, getMap, getRealPath, getRequestBytes, getRequestHost, getRequestInputStream, getRequestPort, getRequestProtocol, getRequestStream, getRequestString, getResponseHeaders, getRoute, header, header, header, headers, host, ipAddress, ipForwardedFor, isDelete, isGet, isHead, isPost, isPut, isXhr, jsonList, jsonMap, jsonMaps, locale, locale, logDebug, logError, logError, logError, logInfo, logWarning, logWarning, merge, method, multipartFormItems, multipartFormItems, multipartFormItems, outputStream, outputStream, outputStream, param, param, params, params, params, params1st, params1st, path, port, protocol, queryString, redirect, redirect, redirect, redirect, redirect, redirect, redirect, redirect, redirectToReferrer, redirectToReferrer, remoteAddress, remoteHost, render, requestHas, respond, sanitize, sendCookie, sendCookie, sendFile, sendFile, sendPermanentCookie, session, session, session, sessionBoolean, sessionDouble, sessionFloat, sessionHas, sessionInteger, sessionLong, sessionObject, sessionString, setContentLength, setEncoding, setLocale, setRequestEncoding, setResponseEncoding, status, streamOut, uploadedFiles, uploadedFiles, uploadedFiles, uri, url, userAgent, values, view, view, view, writer, writer, xhr
public DBConnectionFilter()
public DBConnectionFilter(String dbName)
dbName
- name of DB to openpublic DBConnectionFilter(String dbName, boolean manageTransaction)
dbName
- name of DB to openmanageTransaction
- if set to true, the filter will start a transaction inside before()
method,
commit inside the after()
method, and rollback inside onException(Exception)
method. This applies to
all connections managed by this filter. If set to false, transactions are not managed. Configuration of J2EE container transaction management
for a given JNDI DataSource can interfere with this filter. This filter uses simple java.sql.Connection
methods:
setAutocommit(boolean)
, commit()
and rollback()
. If you configure XA transactions,
this parameter could be completely ignored by the container itself. For this filter to manage transactions, the
datasources should not be type of XA. Read container documentation.public void before()
before
in class HttpSupportFilter
public void after()
after
in class HttpSupportFilter
public void onException(Exception e)
HttpSupportFilter
onException
in class HttpSupportFilter
e
- exception.Copyright © 2019 JavaLite. All rights reserved.