Package org.apache.struts.tiles

Examples of org.apache.struts.tiles.Controller


  protected TagHandler processDefinition(ComponentDefinition definition)
    throws JspException {
    // Declare local variable in order to not change Tag attribute values.
    String role = this.role;
    String page = this.page;
    Controller controller = null;

    try {
      controller = definition.getOrCreateController();

      // Overload definition with tag's template and role.
View Full Code Here


        // If context exists, or if the response has already been committed we will do an include
        tileContext = ComponentContext.getContext(sacontext.getRequest());
        doInclude = (tileContext != null || sacontext.getResponse().isCommitted());

        // Controller associated to a definition, if any
        Controller controller = null;

        // Computed uri to include
        String uri = null;

        if (definition != null)
        {
            // We have a "forward config" definition.
            // We use it to complete missing attribute in context.
            // We also get uri, controller.
            uri = definition.getPath();
            controller = definition.getOrCreateController();

            if (tileContext == null) {
                tileContext =
                        new ComponentContext(definition.getAttributes());
                ComponentContext.setContext(tileContext, sacontext.getRequest());

            } else {
                tileContext.addMissing(definition.getAttributes());
            }
        }

        // Process definition set in Action, if any.  This may override the
        // values for uri or controller found using the ForwardConfig, and
        // may augment the tileContext with additional attributes.
        // :FIXME: the class DefinitionsUtil is deprecated, but I can't find
        // the intended alternative to use.
        definition = DefinitionsUtil.getActionDefinition(sacontext.getRequest());
        if (definition != null) { // We have a definition.
                // We use it to complete missing attribute in context.
                // We also overload uri and controller if set in definition.
                if (definition.getPath() != null) {
                    log.debug("Override forward uri "
                              + uri
                              + " with action uri "
                              + definition.getPath());
                        uri = definition.getPath();
                }

                if (definition.getOrCreateController() != null) {
                    log.debug("Override forward controller with action controller");
                        controller = definition.getOrCreateController();
                }

                if (tileContext == null) {
                        tileContext =
                                new ComponentContext(definition.getAttributes());
                        ComponentContext.setContext(tileContext, sacontext.getRequest());
                } else {
                        tileContext.addMissing(definition.getAttributes());
                }
        }


        if (uri == null) {
            log.debug("no uri computed, so pass to next command");
            return false;
        }

        // Execute controller associated to definition, if any.
        if (controller != null) {
            log.trace("Execute controller: " + controller);
            controller.execute(
                    tileContext,
                    sacontext.getRequest(),
                    sacontext.getResponse(),
                    sacontext.getContext());
        }
View Full Code Here

     * @throws Exception from InstantiationException Can't create requested controller
     */
    protected String processDefinition(ComponentDefinition definition) throws
            Exception
    {
        Controller controller = null;
        try
        {
            controller = definition.getOrCreateController();

            String role = definition.getRole();
View Full Code Here

      if (LOG.isDebugEnabled()) {
        LOG.debug("Initializing controller: " + key);
      }
      XmlDefinition d = definitions.getDefinition(key);
      try {
        Controller controller = d.getOrCreateController();
        if (controller != null) {
          // check if it is implementing Startable, if so execute lifecycle
          // method
          if (controller instanceof Startable) {
            ((Startable) controller).start(servletContext);
View Full Code Here

                {
                    tileContext.addMissing(definition.getAttributes());
                }
                viewId = definition.getPage();
                // if a controller is defined for this tile, execute it
                Controller tilesController = definition.getOrCreateController();
                if (tilesController != null) {
                    ServletResponse response = (ServletResponse) externalContext.getResponse();
                    if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
                        try {
                            tilesController.execute(tileContext, (HttpServletRequest) request,
                                    (HttpServletResponse) response, servletContext);
                        } catch (Exception e) {
                            throw new FacesException(e);
                        }
                    } // else not executing controller for non-HTTP request/response (is this right??)
View Full Code Here

                {
                    tileContext.addMissing(definition.getAttributes());
                }
                viewId = definition.getPage();
                // if a controller is defined for this tile, execute it
                Controller tilesController = definition.getOrCreateController();
                if (tilesController != null) {
                    ServletResponse response = (ServletResponse) externalContext.getResponse();
                    if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
                        try {
                            tilesController.execute(tileContext, (HttpServletRequest) request,
                                    (HttpServletResponse) response, servletContext);
                        } catch (Exception e) {
                            throw new FacesException(e);
                        }
                    } // else not executing controller for non-HTTP request/response (is this right??)
View Full Code Here

    // get current component context
    ComponentContext context = getComponentContext(definition, request);

    // execute component controller associated with definition, if any
    Controller controller = getController(definition, request);
    if (controller != null) {
      if (logger.isDebugEnabled()) {
        logger.debug("Executing Tiles controller [" + controller + "]");
      }
      executeController(controller, context, request, response);
View Full Code Here

    // get current component context
    ComponentContext context = getComponentContext(definition, request);

    // execute component controller associated with definition, if any
    Controller controller = getController(definition, request);
    if (controller != null) {
      if (logger.isDebugEnabled()) {
        logger.debug("Executing Tiles controller [" + controller + "]");
      }
      executeController(controller, context, request, response);
View Full Code Here

    // get current component context
    ComponentContext context = getComponentContext(definition, request);

    // execute component controller associated with definition, if any
    Controller controller = getController(definition, request);
    if (controller != null) {
      if (logger.isDebugEnabled()) {
        logger.debug("Executing Tiles controller [" + controller + "]");
      }
      executeController(controller, context, request, response);
View Full Code Here

      throws JspException
    {
      // Declare local variable in order to not change Tag attribute values.
    String role = this.role;
    String page = this.page;
    Controller controller = null;

    try
      {
      controller = definition.getOrCreateController();
View Full Code Here

TOP

Related Classes of org.apache.struts.tiles.Controller

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.