You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by dg...@apache.org on 2003/07/14 01:40:46 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/logic RedirectTag.java

dgraham     2003/07/13 16:40:46

  Modified:    src/share/org/apache/struts/taglib/logic RedirectTag.java
  Log:
  Refactored doEndTag() into smaller methods.
  
  Revision  Changes    Path
  1.16      +26 -10    jakarta-struts/src/share/org/apache/struts/taglib/logic/RedirectTag.java
  
  Index: RedirectTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/RedirectTag.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- RedirectTag.java	13 Jul 2003 23:33:27 -0000	1.15
  +++ RedirectTag.java	13 Jul 2003 23:40:46 -0000	1.16
  @@ -266,7 +266,18 @@
        */
       public int doEndTag() throws JspException {
   
  -        // Calculate the redirect URL
  +        this.doRedirect(this.generateRedirectURL());
  +
  +        return (SKIP_PAGE);
  +
  +    }
  +
  +    /**
  +     * Calculate the url to redirect to.
  +     * @throws JspException
  +     * @since Struts 1.2
  +     */
  +    protected String generateRedirectURL() throws JspException {
           Map params =
               RequestUtils.computeParameters(
                   pageContext,
  @@ -296,8 +307,17 @@
               throw new JspException(
                   messages.getMessage("redirect.url", e.toString()));
           }
  +        
  +        return url;
  +    }
   
  -        // Perform the redirection
  +    /**
  +     * Redirect to the given url converting exceptions to JspException.
  +     * @param url The path to redirect to.
  +     * @throws JspException
  +     * @since Struts 1.2
  +     */
  +    protected void doRedirect(String url) throws JspException {
           HttpServletResponse response =
               (HttpServletResponse) pageContext.getResponse();
               
  @@ -308,10 +328,6 @@
               RequestUtils.saveException(pageContext, e);
               throw new JspException(e.getMessage());
           }
  -
  -        // Skip the remainder of this apge
  -        return (SKIP_PAGE);
  -
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org