Package ejava.examples.webtier.web
Class JPAFilter
- java.lang.Object
-
- ejava.examples.webtier.web.JPAFilter
-
-
Field Summary
Fields Modifier and Type Field Description private booleancontainerManagedprivate static ThreadLocal<EntityManager>emprivate EntityManagerFactoryemfprivate static org.slf4j.Loggerloggerprivate static StringPU_NAME
-
Constructor Summary
Constructors Constructor Description JPAFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcloseEntityManager()voiddestroy()private voiddoDump(int level, StringBuilder text, Context context, String name)voiddoFilter(ServletRequest request, ServletResponse response, FilterChain chain)private voiddump(Context context, String name)static EntityManagergetEntityManager()protected StringgetPad(int level)voidinit(FilterConfig config)private EntityManagerinitEntityManager()protected booleanisContext(String className)
-
-
-
Field Detail
-
logger
private static org.slf4j.Logger logger
-
PU_NAME
private static final String PU_NAME
- See Also:
- Constant Field Values
-
containerManaged
private boolean containerManaged
-
emf
private EntityManagerFactory emf
-
em
private static ThreadLocal<EntityManager> em
-
-
Method Detail
-
init
public void init(FilterConfig config) throws ServletException
- Specified by:
initin interfaceFilter- Throws:
ServletException
-
doFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
- Specified by:
doFilterin interfaceFilter- Throws:
IOExceptionServletException
-
initEntityManager
private EntityManager initEntityManager() throws ServletException
- Throws:
ServletException
-
closeEntityManager
private void closeEntityManager()
-
getEntityManager
public static final EntityManager getEntityManager()
-
doDump
private void doDump(int level, StringBuilder text, Context context, String name) throws NamingException- Throws:
NamingException
-
isContext
protected boolean isContext(String className)
-
getPad
protected String getPad(int level)
-
-