/** {@inheritDoc} */ public Map<String, Object> getApplicationScope() { return context.getApplicationScope(); }
/** {@inheritDoc} */ public Map<String, Object> getApplicationScope() { return rootContext.getApplicationScope(); }
/** * Configures the container to be used in the application. * * @param context The Tiles application context object to use. * @param container The container object to set. * @param key The key under which the container will be stored. * @throws TilesAccessException If something goes wrong during manipulation of the * context. * @since 2.1.2 */ public static void setContainer(TilesApplicationContext context, TilesContainer container, String key) { Log log = LogFactory.getLog(TilesAccess.class); if (key == null) { key = CONTAINER_ATTRIBUTE; } if (container == null) { if (log.isInfoEnabled()) { log.info("Removing TilesContext for context: " + context.getClass().getName()); } context.getApplicationScope().remove(key); } if (container != null && log.isInfoEnabled()) { log.info("Publishing TilesContext for context: " + context.getClass().getName()); } context.getApplicationScope().put(key, container); }
@Override public ViewPreparer getPreparer(String name, TilesRequestContext context) throws TilesException { WebApplicationContext webApplicationContext = (WebApplicationContext) context.getRequestScope().get( DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (webApplicationContext == null) { webApplicationContext = (WebApplicationContext) context.getApplicationContext().getApplicationScope().get( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (webApplicationContext == null) { throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?"); } } return getPreparer(name, webApplicationContext); }
/** {@inheritDoc} */ @Override public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) { List<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>(); TilesRequestContext request = (TilesRequestContext) context .getContext(TilesRequestContext.class); collectBeanInfo(request.getRequestScope(), list); collectBeanInfo(request.getSessionScope(), list); TilesApplicationContext applicationContext = (TilesApplicationContext) context .getContext(TilesApplicationContext.class); collectBeanInfo(applicationContext.getApplicationScope(), list); return list.iterator(); }
/** * Finds an object in request, session or application scope, in this order. * * @param context The context to use. * @param property The property used as an attribute name. * @return The found bean, if it exists, or <code>null</code> otherwise. */ protected Object findObjectByProperty(ELContext context, Object property) { Object retValue = null; TilesRequestContext request = (TilesRequestContext) context .getContext(TilesRequestContext.class); String prop = property.toString(); retValue = getObject(request.getRequestScope(), prop); if (retValue == null) { retValue = getObject(request.getSessionScope(), prop); if (retValue == null) { TilesApplicationContext applicationContext = (TilesApplicationContext) context .getContext(TilesApplicationContext.class); retValue = getObject(applicationContext.getApplicationScope(), prop); } } return retValue; }