protected void compose(WebappComposer composer, ServletContext context, ScopedContainers scopedContainers) { composer.composeApplication(scopedContainers.getApplicationContainer(), context); if (!isStateless) { composer.composeSession(scopedContainers.getSessionContainer()); } composer.composeRequest(scopedContainers.getRequestContainer()); }
public void putLifecycleStateModelForThread(LifecycleState lifecycleState) { tl.set(lifecycleState); }
public void contextDestroyed(ServletContextEvent event) { ScopedContainers scopedContainers = getScopedContainers(event.getServletContext()); stop(scopedContainers.getApplicationContainer()); dispose(scopedContainers.getApplicationContainer()); }
public void sessionDestroyed(HttpSessionEvent event) { if (!isStateless) { HttpSession session = event.getSession(); ScopedContainers scopedContainers = getScopedContainers(session.getServletContext()); MutablePicoContainer sessionCtr = scopedContainers.getSessionContainer(); SessionStoreHolder ssh = (SessionStoreHolder) session.getAttribute(SessionStoreHolder.class.getName()); scopedContainers.getSessionStoring().putCacheForThread(ssh.getStoreWrapper()); scopedContainers.getSessionState().putLifecycleStateModelForThread(ssh.getLifecycleState()); stop(sessionCtr); dispose(sessionCtr); scopedContainers.getSessionStoring().invalidateCacheForThread(); scopedContainers.getSessionState().invalidateStateModelForThread(); session.setAttribute(SessionStoreHolder.class.getName(), null); } }
public void init(FilterConfig filterConfig) throws ServletException { ServletContext context = filterConfig.getServletContext(); ScopedContainers scopedContainers = getScopedContainers(context); setAppContainer(scopedContainers.getApplicationContainer()); isStateless = Boolean.parseBoolean(context.getInitParameter(PicoServletContainerListener.STATELESS_WEBAPP)); printSessionSize = Boolean.parseBoolean(context.getInitParameter(PicoServletContainerListener.PRINT_SESSION_SIZE)); String exposeServletInfrastructureString = filterConfig.getInitParameter("exposeServletInfrastructure"); if (exposeServletInfrastructureString == null || Boolean.parseBoolean(exposeServletInfrastructureString)) { exposeServletInfrastructure = true; } scopedContainers.getRequestContainer().as(Characteristics.NO_CACHE).addAdapter(new HttpSessionInjector()); scopedContainers.getRequestContainer().as(Characteristics.NO_CACHE).addAdapter(new HttpServletRequestInjector()); scopedContainers.getRequestContainer().as(Characteristics.NO_CACHE).addAdapter(new HttpServletResponseInjector()); initAdditionalScopedComponents(scopedContainers.getSessionContainer(), scopedContainers.getRequestContainer()); }
public void sessionCreated(HttpSessionEvent event) { if (!isStateless) { HttpSession session = event.getSession(); ScopedContainers scopedContainers = getScopedContainers(session.getServletContext()); SessionStoreHolder ssh = new SessionStoreHolder(scopedContainers.getSessionStoring().resetCacheForThread(), scopedContainers.getSessionState().resetStateModelForThread()); start(scopedContainers.getSessionContainer()); session.setAttribute(SessionStoreHolder.class.getName(), ssh); } }
@Override public Object provide(HttpServletRequest req) { String num = (String) super.provide(req); try { return Integer.parseInt(num); } catch (NumberFormatException e) { throw new PicoContainerWebException("'" + num + "' cannot be converted to an integer"); } }
public void contextInitialized(ServletContextEvent event) { OgnlRuntime.setSecurityManager(null); super.contextInitialized(event); }
public void starting() { tl.get().starting(); }
/** * {@inheritDoc} * <p>Provides the header as specified by the header name.</p> **/ public String provide(final HttpServletRequest request) { String result = request.getHeader(headerName); if (result == null) { throw new HeaderNotFound(headerName); } return result; }
public Object provide(HttpServletRequest req) { String parameter = req.getParameter(paramName); if (parameter == null) { throw new ParameterNotFound(paramName); } return parameter; }
@Deprecated protected ScopedContainers makeScopedContainers() { return makeScopedContainers(false); }
/** * Add a number of StringFromRequest adapters to a container. * @param toContainer the container to add to * @param names the list of names to make adapters from */ public static void addStringRequestParameters(MutablePicoContainer toContainer, String... names) { for (String name : names) { toContainer.addAdapter(new StringFromRequest(name)); } }
/** * Add a number of IntFromRequest adapters to a container. * @param toContainer the container to add to * @param names the list of names to make adapters from */ public static void addIntegerRequestParameters(MutablePicoContainer toContainer, String... names) { for (String name : names) { toContainer.addAdapter(new IntFromRequest(name)); } }
public boolean isDisposed() { return tl.get().isDisposed(); }
public void invalidateStateModelForThread() { tl.set(null); }
public void disposing() { tl.get().disposing(); }
public LifecycleState resetStateModelForThread() { DefaultLifecycleState dls = new DefaultLifecycleState(); tl.set(dls); return dls; }
public boolean isStarted() { return tl.get().isStarted(); }
public void disposed() { tl.get().disposed(); }