[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...

Gavin King gavin.king at jboss.com
Sat Dec 16 19:25:55 EST 2006


  User: gavin   
  Date: 06/12/16 19:25:55

  Added:       src/main/org/jboss/seam/core  Navigator.java
  Log:
  JBSEAM-605, navigation in pages.xml
  make s:link action trigger navigation even if outcome is null (but not page actions)
  
  Revision  Changes    Path
  1.1      date: 2006/12/17 00:25:55;  author: gavin;  state: Exp;jboss-seam/src/main/org/jboss/seam/core/Navigator.java
  
  Index: Navigator.java
  ===================================================================
  package org.jboss.seam.core;
  
  import javax.faces.component.UIViewRoot;
  import javax.faces.context.FacesContext;
  
  import org.jboss.seam.log.LogProvider;
  import org.jboss.seam.log.Logging;
  import org.jboss.seam.util.Strings;
  
  abstract class Navigator
  {
     private static final LogProvider log = Logging.getLogProvider(Navigator.class);
  
     /**
      * Send an error.
      */
     protected static void error(int code, String message)
     {
        if ( log.isDebugEnabled() ) log.debug("sending error: " + code);
        org.jboss.seam.core.HttpError httpError = org.jboss.seam.core.HttpError.instance();
        if (message==null)
        {
           httpError.send(code);
        }
        else
        {
           httpError.send(code, message);
        }
     }
  
     /**
      * Redirect to the view id.
      */
     protected static void redirect(String viewId)
     {
        if ( Strings.isEmpty(viewId) )
        {
           viewId = FacesContext.getCurrentInstance().getViewRoot().getViewId();
        }
        if ( log.isDebugEnabled() ) log.debug("redirecting to: " + viewId);
        Manager.instance().redirect(viewId);
     }
     
     /**
      * Render the view id.
      */
     protected static void render(String viewId)
     {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if ( !Strings.isEmpty(viewId) )
        {
           UIViewRoot viewRoot = facesContext.getApplication().getViewHandler()
                 .createView(facesContext, viewId);
           facesContext.setViewRoot(viewRoot);
        }
        else
        {
           viewId = facesContext.getViewRoot().getViewId(); //just for the log message
        }
        if ( log.isDebugEnabled() ) log.debug("rendering: " + viewId);
        facesContext.renderResponse();
     }
  
  
  }
  
  
  



More information about the jboss-cvs-commits mailing list