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

2003-07-13 Thread dgraham
dgraham 2003/07/13 16:37:30

  Modified:src/share/org/apache/struts/taglib/logic ForwardTag.java
  Log:
  Refactored functionality into new doForward() and doRedirect() methods.
  
  Revision  ChangesPath
  1.16  +50 -31
jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java
  
  Index: ForwardTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ForwardTag.java   13 Jul 2003 23:33:27 -  1.15
  +++ ForwardTag.java   13 Jul 2003 23:37:30 -  1.16
  @@ -144,39 +144,58 @@
   path = config.getPrefix() + path;
   
   if (forward.getRedirect()) {
  -HttpServletRequest request =
  -(HttpServletRequest) pageContext.getRequest();
  -
  -HttpServletResponse response =
  -(HttpServletResponse) pageContext.getResponse();
  -
  -try {
  -if (path.startsWith("/")) {
  -path = request.getContextPath() + path;
  -}
  -response.sendRedirect(response.encodeRedirectURL(path));
  -
  -} catch (Exception e) {
  -RequestUtils.saveException(pageContext, e);
  -throw new JspException(
  -messages.getMessage("forward.redirect", name, e.toString()));
  -}
  -
  +this.doRedirect(path);
   } else {
  -
  -try {
  -pageContext.forward(path);
  -
  -} catch (Exception e) {
  -RequestUtils.saveException(pageContext, e);
  -throw new JspException(
  -messages.getMessage("forward.forward", name, e.toString()));
  -}
  +this.doForward(path);
   }
   
   // Skip the remainder of this page
   return (SKIP_PAGE);
   
  +}
  +
  +/**
  + * Forward to the given path converting exceptions to JspException.
  + * @param path The path to forward to.
  + * @throws JspException
  + * @since Struts 1.2
  + */
  +protected void doForward(String path) throws JspException {
  +try {
  +pageContext.forward(path);
  +
  +} catch (Exception e) {
  +RequestUtils.saveException(pageContext, e);
  +throw new JspException(
  +messages.getMessage("forward.forward", name, e.toString()));
  +}
  +}
  +
  +/**
  + * Redirect to the given path converting exceptions to JspException.
  + * @param path The path to redirect to.
  + * @throws JspException
  + * @since Struts 1.2
  + */
  +protected void doRedirect(String path) throws JspException {
  +HttpServletRequest request =
  +(HttpServletRequest) pageContext.getRequest();
  +
  +HttpServletResponse response =
  +(HttpServletResponse) pageContext.getResponse();
  +
  +try {
  +if (path.startsWith("/")) {
  +path = request.getContextPath() + path;
  +}
  +
  +response.sendRedirect(response.encodeRedirectURL(path));
  +
  +} catch (Exception e) {
  +RequestUtils.saveException(pageContext, e);
  +throw new JspException(
  +messages.getMessage("forward.redirect", name, e.toString()));
  +}
   }
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

2002-11-22 Thread rleland
rleland 2002/11/22 22:31:23

  Modified:src/share/org/apache/struts/taglib/logic ForwardTag.java
  Log:
  Bug 13613 Make Forward Tag Module aware.
  Reported and patched by
  [EMAIL PROTECTED] (Jim Bonanno)
  
  Thanks !
  
  Revision  ChangesPath
  1.13  +10 -4 
jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java
  
  Index: ForwardTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ForwardTag.java   9 Nov 2002 16:30:02 -   1.12
  +++ ForwardTag.java   23 Nov 2002 06:31:23 -  1.13
  @@ -147,6 +147,12 @@
   
// Forward or redirect to the corresponding actual path
String path = forward.getPath();
  +// support modules
  +if (config != null) {
  +path = config.getPrefix() + path;
  +}
  +
  +
if (forward.getRedirect()) {
   HttpServletRequest request =
   (HttpServletRequest) pageContext.getRequest();
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2002-10-29 Thread rleland
rleland 2002/10/29 18:31:23

  Modified:src/share/org/apache/struts/taglib/logic ForwardTag.java
  Log:
  use method getModuleConfig instead of getApplicationConfig to
  used internally to class
  
  Revision  ChangesPath
  1.11  +5 -5  
jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java
  
  Index: ForwardTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ForwardTag.java   14 Oct 2002 18:16:18 -  1.10
  +++ ForwardTag.java   30 Oct 2002 02:31:23 -  1.11
  @@ -136,7 +136,7 @@
   
// Look up the desired ActionForward entry
ActionForward forward = null;
  -ApplicationConfig config = RequestUtils.getApplicationConfig(pageContext);
  +ApplicationConfig config = RequestUtils.getModuleConfig(pageContext);
if (config != null)
forward = (ActionForward) config.findForwardConfig(name);
if (forward == null) {
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




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

2001-04-28 Thread craigmcc

craigmcc01/04/28 20:51:01

  Modified:src/share/org/apache/struts/taglib/logic ForwardTag.java
  Log:
  Make the context path prepend for a redirect performed by 
  operate identically to the corresponding processing in ActionServlet when an
  Action returns an ActionForward with the redirect flag set.
  
  PR: Bugzilla #1317
  Submitted by: Stoehr Sukachevin <[EMAIL PROTECTED]>
  
  Revision  ChangesPath
  1.7   +6 -5  
jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java
  
  Index: ForwardTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ForwardTag.java   2001/04/21 23:53:42 1.6
  +++ ForwardTag.java   2001/04/29 03:51:01 1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v 
1.6 2001/04/21 23:53:42 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/04/21 23:53:42 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v 
1.7 2001/04/29 03:51:01 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/04/29 03:51:01 $
*
* 
*
  @@ -82,7 +82,7 @@
* ActionForwards collection associated with our application.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2001/04/21 23:53:42 $
  + * @version $Revision: 1.7 $ $Date: 2001/04/29 03:51:01 $
*/
   
   public class ForwardTag extends TagSupport {
  @@ -159,7 +159,8 @@
HttpServletResponse response =
(HttpServletResponse) pageContext.getResponse();
try {
  -path = request.getContextPath() + path;
  +if (path.startsWith("/"))
  +path = request.getContextPath() + path;
response.sendRedirect(response.encodeRedirectURL(path));
} catch (Exception e) {
   RequestUtils.saveException(pageContext, e);
  
  
  



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

2001-04-22 Thread craigmcc

craigmcc01/04/21 16:53:43

  Modified:src/share/org/apache/struts/taglib/logic ForwardTag.java
  Log:
  When following an ActionForward that is redirecting, prepend the context path
  to the path specified in the forward, in the same way that the controller
  servlet would if this ActionForward were returned from an Action.
  
  PR: Bugzilla #1302
  Submitted by: Stoehr Sukachevin <[EMAIL PROTECTED]>
  
  Revision  ChangesPath
  1.6   +8 -4  
jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java
  
  Index: ForwardTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ForwardTag.java   2001/02/12 21:49:55 1.5
  +++ ForwardTag.java   2001/04/21 23:53:42 1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v 
1.5 2001/02/12 21:49:55 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/02/12 21:49:55 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v 
1.6 2001/04/21 23:53:42 craigmcc Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/04/21 23:53:42 $
*
* 
*
  @@ -64,6 +64,7 @@
   
   
   import java.io.IOException;
  +import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.JspWriter;
  @@ -81,7 +82,7 @@
* ActionForwards collection associated with our application.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2001/02/12 21:49:55 $
  + * @version $Revision: 1.6 $ $Date: 2001/04/21 23:53:42 $
*/
   
   public class ForwardTag extends TagSupport {
  @@ -153,9 +154,12 @@
// Forward or redirect to the corresponding actual path
String path = forward.getPath();
if (forward.getRedirect()) {
  +HttpServletRequest request =
  +(HttpServletRequest) pageContext.getRequest();
HttpServletResponse response =
(HttpServletResponse) pageContext.getResponse();
try {
  +path = request.getContextPath() + path;
response.sendRedirect(response.encodeRedirectURL(path));
} catch (Exception e) {
   RequestUtils.saveException(pageContext, e);