/** * Returns a new ObjectContext instance based on the runtime's main * DataChannel. * * @since 4.0 */ public ObjectContext newContext() { return injector.getInstance(ObjectContextFactory.class).createContext(); }
/** * Returns a new ObjectContext which is a child of the specified * DataChannel. This method is used for creation of nested ObjectContexts, * with parent ObjectContext passed as an argument. * * @since 4.0 */ public ObjectContext newContext(DataChannel parentChannel) { return injector.getInstance(ObjectContextFactory.class).createContext(parentChannel); }
/** * Creates a server-side channel that will handle all client requests. For * shared sessions the same channel instance is reused for the entire group * of clients. For dedicated sessions, one channel per client is created. * <p> * This implementation returns {@link ClientServerChannel} instance wrapping * a DataContext. Subclasses may override the method to customize channel * creation. For instance they may wrap channel in the custom interceptors * to handle transactions or security. */ protected DataChannel createChannel() { return new ClientServerChannel((DataContext) contextFactory.createContext()); }
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); }