public void requestEnd(ServletRequest request, ServletResponse response) { CayenneRuntime.bindThreadInjector(null); BaseContext.bindThreadObjectContext(null); }
@Override public void destroy() { super.destroy(); CayenneRuntime runtime = WebUtil.getCayenneRuntime(servletContext); if (runtime != null) { runtime.shutdown(); } }
/** * @deprecated since 3.1 use better named {@link #newContext()} instead. */ @Deprecated public ObjectContext getContext() { return newContext(); }
public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { CayenneRuntime runtime = WebUtil.getCayenneRuntime(servletContext); RequestHandler handler = runtime.getInjector().getInstance(RequestHandler.class); handler.requestStart(request, response); try { chain.doFilter(request, response); } finally { handler.requestEnd(request, response); } } }
/** * Checks whether this context is attached to Cayenne runtime stack and if * not, attempts to attach itself to the runtime using Injector returned * from the call to {@link CayenneRuntime#getThreadInjector()}. If thread * Injector is not available and the context is not attached, throws * CayenneRuntimeException. * <p> * This method is called internally by the context before access to * transient variables to allow the context to attach to the stack lazily * following deserialization. * * @return true if the context successfully attached to the thread runtime, * false - if it was already attached. * @since 3.1 */ protected boolean attachToRuntimeIfNeeded() { if (channel != null) { return false; } Injector injector = CayenneRuntime.getThreadInjector(); if (injector == null) { throw new CayenneRuntimeException("Can't attach to Cayenne runtime. " + "Null injector returned from CayenneRuntime.getThreadInjector()"); } attachToRuntime(injector); return true; }
public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { CayenneRuntime runtime = WebUtil.getCayenneRuntime(servletContext); RequestHandler handler = runtime.getInjector().getInstance(RequestHandler.class); handler.requestStart(request, response); try { chain.doFilter(request, response); } finally { handler.requestEnd(request, response); } } }
public void requestEnd(ServletRequest request, ServletResponse response) { CayenneRuntime.bindThreadInjector(null); BaseContext.bindThreadObjectContext(null); }
public void destroy() { CayenneRuntime runtime = WebUtil.getCayenneRuntime(servletContext); if (runtime != null) { runtime.shutdown(); } }
/** * @deprecated since 3.1 use better named {@link #newContext(DataChannel)} * instead. */ @Deprecated public ObjectContext getContext(DataChannel parentChannel) { return newContext(parentChannel); } }
public void requestEnd(ServletRequest request, ServletResponse response) { CayenneRuntime.bindThreadInjector(null); BaseContext.bindThreadObjectContext(null); }
public void destroy() { CayenneRuntime runtime = WebUtil.getCayenneRuntime(servletContext); if (runtime != null) { runtime.shutdown(); } }
public void requestEnd(ServletRequest request, ServletResponse response) { CayenneRuntime.bindThreadInjector(null); BaseContext.bindThreadObjectContext(null); }
public void requestStart(ServletRequest request, ServletResponse response) { CayenneRuntime.bindThreadInjector(injector); if (request instanceof HttpServletRequest) { // this forces session creation if it does not exist yet HttpSession session = ((HttpServletRequest) request).getSession(); ObjectContext context; synchronized (session) { context = (ObjectContext) session.getAttribute(SESSION_CONTEXT_KEY); if (context == null) { context = injector .getInstance(ObjectContextFactory.class) .createContext(); session.setAttribute(SESSION_CONTEXT_KEY, context); } } BaseContext.bindThreadObjectContext(context); } }
public void requestStart(ServletRequest request, ServletResponse response) { CayenneRuntime.bindThreadInjector(injector); if (request instanceof HttpServletRequest) { // this forces session creation if it does not exist yet HttpSession session = ((HttpServletRequest) request).getSession(); ObjectContext context; synchronized (session) { context = (ObjectContext) session.getAttribute(SESSION_CONTEXT_KEY); if (context == null) { context = injector .getInstance(ObjectContextFactory.class) .createContext(); session.setAttribute(SESSION_CONTEXT_KEY, context); } } BaseContext.bindThreadObjectContext(context); } }
public void requestStart(ServletRequest request, ServletResponse response) { CayenneRuntime.bindThreadInjector(injector); ObjectContext context = injector.getInstance(ObjectContextFactory.class).createContext(); BaseContext.bindThreadObjectContext(context); }
public void requestStart(ServletRequest request, ServletResponse response) { CayenneRuntime.bindThreadInjector(injector); ObjectContext context = injector.getInstance(ObjectContextFactory.class).createContext(); BaseContext.bindThreadObjectContext(context); }