Package org.apache.tiles.servlet.context

Examples of org.apache.tiles.servlet.context.ServletTilesApplicationContext


    /** {@inheritDoc} */
    public TilesApplicationContext createApplicationContext(Object context) {
        if (context instanceof ServletContext) {
            ServletContext servletContext = (ServletContext) context;
            return new ServletTilesApplicationContext(servletContext);
        }

        return null;
    }
View Full Code Here


     * @param context The application context.
     * @return The original servlet context, if found.
     */
    protected ServletContext getServletContext(TilesApplicationContext context) {
        if (context instanceof ServletTilesApplicationContext) {
            ServletTilesApplicationContext app = (ServletTilesApplicationContext) context;
            return app.getServletContext();
        }
        return null;

    }
View Full Code Here

    /** {@inheritDoc} */
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        MockServletContext servletContext = new MockServletContext();
        appContext = new ServletTilesApplicationContext(servletContext);
        MockHttpSession session = new MockHttpSession(servletContext);
        MockHttpServletRequest request = new MockHttpServletRequest(session);
        MockHttpServletResponse response = new MockHttpServletResponse();
        this.request = request;
        this.response = response;
View Full Code Here

        for (Map.Entry<String, String> entry : initParameters.entrySet()) {
            context.setInitParameter(entry.getKey(), entry.getValue());
        }

        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                context);
        AbstractTilesApplicationContextFactory acFactory = AbstractTilesApplicationContextFactory
                .createFactory(applicationContext);
        applicationContext = acFactory.createApplicationContext(context);
View Full Code Here

     *
     * @param context The servlet context to use.
     * @return The created container
     */
    protected TilesContainer createContainer(ServletContext context) {
        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                context);
        AbstractTilesApplicationContextFactory acFactory = AbstractTilesApplicationContextFactory
                .createFactory(applicationContext);
        if (acFactory instanceof Initializable) {
            ((Initializable) acFactory).init(applicationContext.getInitParams());
        }
        applicationContext = acFactory.createApplicationContext(context);
        AbstractTilesContainerFactory factory = AbstractTilesContainerFactory
                .getTilesContainerFactory(applicationContext);
        return factory.createContainer(applicationContext);
View Full Code Here

  public ViewPreparer getPreparer(String name, TilesRequestContext context) throws TilesException {
    ServletRequest servletRequest = null;
    if (context.getRequest() instanceof ServletRequest) {
      servletRequest = (ServletRequest) context.getRequest();
    }
    ServletTilesApplicationContext tilesApplicationContext = null;
    if (context instanceof ServletTilesApplicationContext) {
      tilesApplicationContext = (ServletTilesApplicationContext) context;
    }
    if (servletRequest == null && tilesApplicationContext == null) {
      throw new IllegalStateException("SpringBeanPreparerFactory requires either a " +
          "ServletRequest or a ServletTilesApplicationContext to operate on");
    }
    WebApplicationContext webApplicationContext = RequestContextUtils.getWebApplicationContext(
        servletRequest, tilesApplicationContext.getServletContext());
    return getPreparer(name, webApplicationContext);
  }
View Full Code Here

        for (Map.Entry<String, String> entry : initParameters.entrySet()) {
            context.setInitParameter(entry.getKey(), entry.getValue());
        }

        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                context);
        AbstractTilesApplicationContextFactory acFactory = AbstractTilesApplicationContextFactory
                .createFactory(applicationContext);
        applicationContext = acFactory.createApplicationContext(context);
View Full Code Here

     *
     * @param event The intercepted event.
     */
    public void contextInitialized(ServletContextEvent event) {
        ServletContext servletContext = event.getServletContext();
        initializer.initialize(new ServletTilesApplicationContext(
                servletContext));
    }
View Full Code Here

     * @return The created container.
     * @deprecated Use {@link BasicTilesInitializer#createContainer(org.apache.tiles.TilesApplicationContext)}
     * instead.
     */
    protected TilesContainer createContainer(ServletContext context) {
        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                context);
        AbstractTilesContainerFactory factory = AbstractTilesContainerFactory
                .getTilesContainerFactory(applicationContext);
        return factory.createContainer(applicationContext);
    }
View Full Code Here

    /** {@inheritDoc} */
    @Override
    public void init() throws ServletException {
        ServletContext adaptedContext = new ServletContextAdapter(
                getServletConfig());
        ServletTilesApplicationContext preliminaryContext = new ServletTilesApplicationContext(
                adaptedContext);
        initializer.initialize(preliminaryContext);
    }
View Full Code Here

TOP

Related Classes of org.apache.tiles.servlet.context.ServletTilesApplicationContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.