cvs commit: jakarta-struts/src/share/org/apache/struts/util RequestUtils.java

2003-07-13 Thread martinc
martinc 2003/07/13 21:21:06

  Modified:src/share/org/apache/struts/util RequestUtils.java
  Log:
  Detab file.
  
  Revision  ChangesPath
  1.109 +55 -55
jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java
  
  Index: RequestUtils.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- RequestUtils.java 4 Jul 2003 20:53:42 -   1.108
  +++ RequestUtils.java 14 Jul 2003 04:21:05 -  1.109
  @@ -388,8 +388,8 @@
   boolean redirect)
   throws MalformedURLException {
   
  - return computeURL(pageContext, forward, href, page, null, params,
  -   anchor, redirect);
  +return computeURL(pageContext, forward, href, page, null, params,
  +  anchor, redirect);
   }
   
   /**
  @@ -529,7 +529,7 @@
   } else if (href != null) {
   url.append(href);
   } else if (action != null) {
  - url.append(getActionMappingURL(action, pageContext));
  +url.append(getActionMappingURL(action, pageContext));
   
   } else /* if (page != null) */ {
   url.append(request.getContextPath());
  @@ -866,15 +866,15 @@
   throws JspException {
   
   if (scopeName == null) {
  - return pageContext.findAttribute(name);
  +return pageContext.findAttribute(name);
   }
   
   try {
  - return pageContext.getAttribute(name, getScope(scopeName));
  +return pageContext.getAttribute(name, getScope(scopeName));
   
   } catch (JspException e) {
  - saveException(pageContext, e);
  - throw e;
  +saveException(pageContext, e);
  +throw e;
   }
   
   }
  @@ -888,13 +888,13 @@
* @since Struts 1.1
*/
   public static int getScope(String scopeName) throws JspException {
  - Integer scope = (Integer) scopes.get(scopeName.toLowerCase());
  +Integer scope = (Integer) scopes.get(scopeName.toLowerCase());
   
  - if (scope == null) {
  - throw new JspException(messages.getMessage("lookup.scope", 
scope));
  - }
  +if (scope == null) {
  +throw new JspException(messages.getMessage("lookup.scope", scope));
  +}
   
  - return scope.intValue();
  +return scope.intValue();
   }
   
   /**
  @@ -1035,8 +1035,8 @@
   Object args[])
   throws JspException {
   
  - MessageResources resources =
  - retrieveMessageResources(pageContext, bundle, false);
  +MessageResources resources =
  +retrieveMessageResources(pageContext, bundle, false);
   
   Locale userLocale = retrieveUserLocale(pageContext, locale);
   
  @@ -1067,11 +1067,11 @@
   boolean checkPageScope)
   throws JspException {
   
  - MessageResources resources = null;
  +MessageResources resources = null;
   
  - if (bundle == null) {
  - bundle = Globals.MESSAGES_KEY;
  - }
  +if (bundle == null) {
  +bundle = Globals.MESSAGES_KEY;
  +}
   
   if (checkPageScope) {
   resources =
  @@ -1080,29 +1080,29 @@
   PageContext.PAGE_SCOPE);
   }
   
  - if (resources == null) {
  - resources =
  - (MessageResources) pageContext.getAttribute(
  - bundle,
  - PageContext.REQUEST_SCOPE);
  - }
  -
  - if (resources == null) {
  - resources =
  - (MessageResources) pageContext.getAttribute(
  - bundle,
  - PageContext.APPLICATION_SCOPE);
  - }
  -
  - if (resources == null) {
  - JspException e =
  - new JspException(messages.getMessage("message.bundle", 
bundle));
  - saveException(pageContext, e);
  - throw e;
  - }
  +if (resources == null) {
  +resources =
  +(MessageResources) pageContext.getAttribute(
  +bundle,
  +PageContext.REQUEST_SCOPE);
  +}
  +
  +if (resources == null) {
  +resources =
  +(MessageResources) pageContext.getAttribute(
  +bundle,
  +PageContext.APPLICATION_SCOPE);
  +}
  +
  +

Re: tiles tags exception handling

2003-07-13 Thread Nathan Coast
excellent, thanks

David Graham wrote:
This was a known problem that I've fixed for Struts 1.2.  You could also
use a recent nightly build to pick up this fix.
David

--- Nathan Coast <[EMAIL PROTECTED]> wrote:

Hi,

I've been having trouble getting exceptions handled usefully when they 
occur within jsps called via tiles:insert tags.

I've tracked the code down to:

org.apache.struts.taglib.tiles.InsertTag

where this exception handling code is called:

protected void processException(Throwable ex, String msg) throws 
JspException {
  try {
if (msg == null)
  msg = ex.getMessage();
if (log.isDebugEnabled()) { // show full trace
  log.debug(msg, ex);
  pageContext.getOut().println(msg);
  ex.printStackTrace(new PrintWriter(pageContext.getOut(), true));
} else { // show only message
  pageContext.getOut().println(msg);
} // end if
  } catch (IOException ioex) { // problems. Propagate original
exception
pageContext.setAttribute(
  ComponentConstants.EXCEPTION_KEY,
  ex,
  PageContext.REQUEST_SCOPE);
throw new JspException(msg);
  }
}

my understanding of this code is that no exception will be passed to the

enclosing jsp page.  If an excption occurs, a simple error message will 
appear in the enclosing page.  If debug is enabled for the Logger 
"org.apache.struts.taglib.tiles.InsertTag" then the stack is filled in 
too.  Am I right?

If so, would it be better to enable excptions to be cascaded up, 
enabling exception management in a more application specific manner? 
e.g. making use of the error-page elements in the web.xml

I'd like to be able to log the error centrally and display to the user a

meaningful error page.

thanks
Nathan
p.s.  thanks to all the development team.  Struts seriously reduces 
devlopment time and increases the quality of applications built with it.

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


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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


DO NOT REPLY [Bug 21541] - Limitation in struts model component

2003-07-13 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21541

Limitation in struts model component





--- Additional Comments From [EMAIL PROTECTED]  2003-07-14 00:27 ---
Well If the goal from struts is to allow easier development of webpages, I can 
see the next logical step for struts would be to allow that kind of frame work 
into the struts model. 
Additionally David's solution doesn't apply to forms where form fields names 
doesn't necessarly coincide with the object methods and properties(real life 
scenarios). Generally you have the business objects designed and created and 
then they are given to the jsp developer to work with. Hope more people will 
be willing to discuss this issue.

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



DO NOT REPLY [Bug 21486] - NoSuchMethodError: MultipartStream.setHeaderEncoding

2003-07-13 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21486

NoSuchMethodError: MultipartStream.setHeaderEncoding

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 OS/Version|Linux   |All
 Resolution||WORKSFORME



--- Additional Comments From [EMAIL PROTECTED]  2003-07-14 00:21 ---
I wasn't able to reproduce this with the struts-upload.war from Struts 1.1 
Final running on Tomcat 4.1.24.

>From the stack trace it seems your problem is with Commons FileUpload rather 
than Struts itself (the missing 
org.apache.commons.fileupload.MultipartStream.setHeaderEncoding is called from 
another Commons FileUpload method, 
org.apache.commons.fileupload.FileUploadBase.parseRequest).  The fact that you 
don't get the problem with Struts 1.1b3 doesn't necessarily indicate 
otherwise; Struts 1.1 Final calls 
org.apache.commons.fileupload.DiskFileUpload.parseRequest, and Struts 1.1b3 
calls org.apache.commons.fileupload.FileUpload.parseRequest, so a sufficiently 
broken Commons FileUpload would be consistent with what you're seeing.

But that said, I don't see anything wrong with the Commons FileUpload code 
that would explain your problem.  So what I would suggest is that you check 
again that the commons-fileupload.jar you're using is the 1.0 release 
(unmodified), and if that doesn't fix the problem, raise the issue with the 
Commons FileUpload folks.

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



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/bean HeaderTag.java

2003-07-13 Thread dgraham
dgraham 2003/07/13 17:10:49

  Modified:src/share/org/apache/struts/taglib/bean HeaderTag.java
  Log:
  Refactored doStartTag() into smaller methods.
  
  Revision  ChangesPath
  1.11  +40 -24
jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTag.java
  
  Index: HeaderTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTag.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- HeaderTag.java14 Jul 2003 00:04:44 -  1.10
  +++ HeaderTag.java14 Jul 2003 00:10:49 -  1.11
  @@ -151,26 +151,21 @@
*/
   public int doStartTag() throws JspException {
   
  -// Deal with a single header value
  -if (multiple == null) {
  -String value =
  -((HttpServletRequest) pageContext.getRequest()).getHeader(name);
  -
  -if ((value == null) && (this.value != null)) {
  -value = this.value;
  -}
  -
  -if (value == null) {
  -JspException e =
  -new JspException(messages.getMessage("header.get", name));
  -RequestUtils.saveException(pageContext, e);
  -throw e;
  -}
  -pageContext.setAttribute(id, value);
  -return (SKIP_BODY);
  +if (this.multiple == null) {
  +this.handleSingleHeader();
  +} else {
  +this.handleMultipleHeaders();
   }
   
  -// Deal with multiple header values
  +return SKIP_BODY;
  +}
  +
  +/**
  + * Expose an array of header values.
  + * @throws JspException
  + * @since Struts 1.2
  + */
  +protected void handleMultipleHeaders() throws JspException {
   ArrayList values = new ArrayList();
   Enumeration items =
   ((HttpServletRequest) pageContext.getRequest()).getHeaders(name);
  @@ -179,7 +174,7 @@
   values.add(items.nextElement());
   }
   
  -if ((values.size() == 0) && (this.value != null)){
  +if (values.isEmpty() && (this.value != null)){
   values.add(this.value);
   }
   
  @@ -192,8 +187,29 @@
   }
   
   pageContext.setAttribute(id, (String[]) values.toArray(headers));
  -return (SKIP_BODY);
  +}
  +
  +/**
  + * Expose a single header value.
  + * @throws JspException
  + * @since Struts 1.2
  + */
  +protected void handleSingleHeader() throws JspException {
  +String value =
  +((HttpServletRequest) pageContext.getRequest()).getHeader(name);
   
  +if ((value == null) && (this.value != null)) {
  +value = this.value;
  +}
  +
  +if (value == null) {
  +JspException e =
  +new JspException(messages.getMessage("header.get", name));
  +RequestUtils.saveException(pageContext, e);
  +throw e;
  +}
  +
  +pageContext.setAttribute(id, value);
   }
   
   /**
  
  
  

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



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/bean HeaderTag.java

2003-07-13 Thread dgraham
dgraham 2003/07/13 17:04:44

  Modified:src/share/org/apache/struts/taglib/bean HeaderTag.java
  Log:
  Fixed formatting.
  
  Revision  ChangesPath
  1.10  +40 -43
jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTag.java
  
  Index: HeaderTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTag.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- HeaderTag.java22 Sep 2002 06:32:45 -  1.9
  +++ HeaderTag.java14 Jul 2003 00:04:44 -  1.10
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -59,19 +59,18 @@
*
*/
   
  -
   package org.apache.struts.taglib.bean;
   
  -
   import java.util.ArrayList;
   import java.util.Enumeration;
  +
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.tagext.TagSupport;
  +
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   
  -
   /**
* Define a scripting variable based on the value(s) of the specified
* header received with this request.
  @@ -79,13 +78,10 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
  -
   public class HeaderTag extends TagSupport {
   
  -
   // - Properties
   
  -
   /**
* The name of the scripting variable that will be exposed as a page
* scope attribute.
  @@ -100,14 +96,12 @@
   this.id = id;
   }
   
  -
   /**
* The message resources for this package.
*/
   protected static MessageResources messages =
  -MessageResources.getMessageResources
  -("org.apache.struts.taglib.bean.LocalStrings");
  -
  +MessageResources.getMessageResources(
  +"org.apache.struts.taglib.bean.LocalStrings");
   
   /**
* Return an array of header values if multiple is non-null.
  @@ -122,7 +116,6 @@
   this.multiple = multiple;
   }
   
  -
   /**
* The name of the header whose value is to be exposed.
*/
  @@ -136,7 +129,6 @@
   this.name = name;
   }
   
  -
   /**
* The default value to return if no header of the specified name is found.
*/
  @@ -150,10 +142,8 @@
   this.value = value;
   }
   
  -
   // - Public Methods
   
  -
   /**
* Retrieve the required property and expose it as a scripting variable.
*
  @@ -163,41 +153,49 @@
   
   // Deal with a single header value
   if (multiple == null) {
  - String value =
  -   ((HttpServletRequest) pageContext.getRequest()).getHeader(name);
  -if ((value == null) && (this.value != null))
  +String value =
  +((HttpServletRequest) pageContext.getRequest()).getHeader(name);
  +
  +if ((value == null) && (this.value != null)) {
   value = this.value;
  - if (value == null) {
  - JspException e = new JspException
  -   (messages.getMessage("header.get", name));
  +}
  +
  +if (value == null) {
  +JspException e =
  +new JspException(messages.getMessage("header.get", name));
   RequestUtils.saveException(pageContext, e);
   throw e;
   }
  - pageContext.setAttribute(id, value);
  - return (SKIP_BODY);
  - }
  -
  - // Deal with multiple header values
  - ArrayList values = new ArrayList();
  - Enumeration items =
  -   ((HttpServletRequest) pageContext.getRequest()).getHeaders(name);
  - while (items.hasMoreElements())
  - values.add(items.nextElement());
  -if ((values.size() == 0) && (this.value != null))
  +pageContext.setAttribute(id, value);
  +return (SKIP_BODY);
  +}
  +
  +// Deal with multiple header values
  +ArrayList values = new ArrayList();
  +Enumeration items =
  +((HttpServletRequest) pageContext.getRequest()).getHeaders(name);
  +
  +while (items.hasMoreElements()){
  +values.add(items.nextElement());
  +}
  +
  +if ((values.size() == 0) && (this.value != null)){
   values.add(this.value);
  - String headers[] = new String[values.size()];
  - if (headers.length == 0) {
  - JspException e = ne

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/bean ResourceTag.java

2003-07-13 Thread dgraham
dgraham 2003/07/13 17:02:29

  Modified:src/share/org/apache/struts/taglib/bean ResourceTag.java
  Log:
  Fixed formatting.
  
  Revision  ChangesPath
  1.12  +39 -50
jakarta-struts/src/share/org/apache/struts/taglib/bean/ResourceTag.java
  
  Index: ResourceTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ResourceTag.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ResourceTag.java  22 Sep 2002 06:32:46 -  1.11
  +++ ResourceTag.java  14 Jul 2003 00:02:29 -  1.12
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -59,20 +59,18 @@
*
*/
   
  -
   package org.apache.struts.taglib.bean;
   
  -
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.InputStreamReader;
  +
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.tagext.TagSupport;
  +
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   
  -
  -
   /**
* Define a scripting variable based on the contents of the specified
* web application resource.
  @@ -80,19 +78,15 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
  -
   public class ResourceTag extends TagSupport {
   
  -
   // - Properties
   
  -
   /**
* Buffer size to use when reading the input stream.
*/
   protected static final int BUFFER_SIZE = 256;
   
  -
   /**
* The name of the scripting variable that will be exposed as a page
* scope attribute.
  @@ -107,7 +101,6 @@
   this.id = id;
   }
   
  -
   /**
* Return an InputStream to the specified resource if this is non-null.
*/
  @@ -121,14 +114,12 @@
   this.input = input;
   }
   
  -
   /**
* The message resources for this package.
*/
   protected static MessageResources messages =
  -MessageResources.getMessageResources
  -("org.apache.struts.taglib.bean.LocalStrings");
  -
  +MessageResources.getMessageResources(
  +"org.apache.struts.taglib.bean.LocalStrings");
   
   /**
* The module-relative URI of the resource whose contents are to
  @@ -144,10 +135,8 @@
   this.name = name;
   }
   
  -
   // - Public Methods
   
  -
   /**
* Retrieve the required property and expose it as a scripting variable.
*
  @@ -157,45 +146,46 @@
   
   // Acquire an input stream to the specified resource
   InputStream stream =
  -  pageContext.getServletContext().getResourceAsStream(name);
  -if (stream == null) {
  -JspException e = new JspException
  -  (messages.getMessage("resource.get", name));
  +pageContext.getServletContext().getResourceAsStream(name);
  +
  +if (stream == null) {
  +JspException e =
  +new JspException(messages.getMessage("resource.get", name));
   RequestUtils.saveException(pageContext, e);
   throw e;
   }
   
  -// If we are returning an InputStream, do so and return
  -if (input != null) {
  -pageContext.setAttribute(id, stream);
  -return (SKIP_BODY);
  -}
  -
  -// Accumulate the contents of this resource into a StringBuffer
  -try {
  -StringBuffer sb = new StringBuffer();
  -InputStreamReader reader =
  -  new InputStreamReader(stream);
  -char buffer[] = new char[BUFFER_SIZE];
  -int n = 0;
  -while (true) {
  -n = reader.read(buffer);
  -if (n < 1)
  -break;
  -sb.append(buffer, 0, n);
  +// If we are returning an InputStream, do so and return
  +if (input != null) {
  +pageContext.setAttribute(id, stream);
  +return (SKIP_BODY);
   }
  -reader.close();
  -pageContext.setAttribute(id, sb.toString());
  -} catch (IOException e) {
  +
  +// Accumulate the contents of this resource into a StringBuffer
  +try {
  +StringBuffer sb = new StringBuffer();
  +InputStreamReader reader = new InputStreamReader(stream);
  +char buffer[] = new char[BUFFER_SIZE];
  +int n = 0;
  +while (true) {
  +n = reader.read(buffer);
  +if (n < 1) {
  +break;
  +}
  +sb.appe

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/bean ParameterTag.java

2003-07-13 Thread dgraham
dgraham 2003/07/13 17:00:14

  Modified:src/share/org/apache/struts/taglib/bean ParameterTag.java
  Log:
  Fixed formatting.
  
  Revision  ChangesPath
  1.9   +29 -41
jakarta-struts/src/share/org/apache/struts/taglib/bean/ParameterTag.java
  
  Index: ParameterTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ParameterTag.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ParameterTag.java 22 Sep 2002 06:32:46 -  1.8
  +++ ParameterTag.java 14 Jul 2003 00:00:14 -  1.9
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -59,17 +59,14 @@
*
*/
   
  -
   package org.apache.struts.taglib.bean;
   
  -
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.tagext.TagSupport;
  +
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   
  -
  -
   /**
* Define a scripting variable based on the value(s) of the specified
* parameter received with this request.
  @@ -77,13 +74,10 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
  -
   public class ParameterTag extends TagSupport {
   
  -
   // - Properties
   
  -
   /**
* The name of the scripting variable that will be exposed as a page
* scope attribute.
  @@ -98,14 +92,12 @@
   this.id = id;
   }
   
  -
   /**
* The message resources for this package.
*/
   protected static MessageResources messages =
  -MessageResources.getMessageResources
  -("org.apache.struts.taglib.bean.LocalStrings");
  -
  +MessageResources.getMessageResources(
  +"org.apache.struts.taglib.bean.LocalStrings");
   
   /**
* Return an array of parameter values if multiple is
  @@ -121,7 +113,6 @@
   this.multiple = multiple;
   }
   
  -
   /**
* The name of the parameter whose value is to be exposed.
*/
  @@ -135,7 +126,6 @@
   this.name = name;
   }
   
  -
   /**
* The default value to return if no parameter of the specified name is
* found.
  @@ -150,10 +140,8 @@
   this.value = value;
   }
   
  -
   // - Public Methods
   
  -
   /**
* Retrieve the required property and expose it as a scripting variable.
*
  @@ -163,41 +151,42 @@
   
   // Deal with a single parameter value
   if (multiple == null) {
  - String value =
  -   pageContext.getRequest().getParameter(name);
  -if ((value == null) && (this.value != null))
  +String value = pageContext.getRequest().getParameter(name);
  +if ((value == null) && (this.value != null)) {
   value = this.value;
  - if (value == null) {
  - JspException e = new JspException
  -   (messages.getMessage("parameter.get", name));
  +}
  +
  +if (value == null) {
  +JspException e =
  +new JspException(messages.getMessage("parameter.get", name));
   RequestUtils.saveException(pageContext, e);
   throw e;
   }
  - pageContext.setAttribute(id, value);
  - return (SKIP_BODY);
  - }
  -
  - // Deal with multiple parameter values
  - String values[] =
  -   pageContext.getRequest().getParameterValues(name);
  +
  +pageContext.setAttribute(id, value);
  +return (SKIP_BODY);
  +}
  +
  +// Deal with multiple parameter values
  +String values[] = pageContext.getRequest().getParameterValues(name);
   if ((values == null) || (values.length == 0)) {
   if (this.value != null) {
  -values = new String[1];
  -values[0] = this.value;
  +values = new String[] { this.value };
   }
   }
  - if ((values == null) || (values.length == 0)) {
  - JspException e = new JspException
  -   (messages.getMessage("parameter.get", name));
  +
  +if ((values == null) || (values.length == 0)) {
  +JspException e =
  +new JspException(messages.getMessage("parameter.get", name));
   RequestUtils.saveException(pageContext, e);
   throw e;
   }
  - pageContext.setAttribute(id, values);
  +
  +pageContext.setAttribute(id, values);
   

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/bean MessageTag.java

2003-07-13 Thread dgraham
dgraham 2003/07/13 16:57:32

  Modified:src/share/org/apache/struts/taglib/bean MessageTag.java
  Log:
  Simplified args[] creation, deprecated unused defaultLocale variable.
  
  Revision  ChangesPath
  1.12  +6 -10 
jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java
  
  Index: MessageTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MessageTag.java   13 Jul 2003 23:55:00 -  1.11
  +++ MessageTag.java   13 Jul 2003 23:57:32 -  1.12
  @@ -164,6 +164,7 @@
   
   /**
* The default Locale for our server.
  + * @deprecated This will be removed after Struts 1.2.
*/
   protected static final Locale defaultLocale = Locale.getDefault();
   
  @@ -262,12 +263,7 @@
   }
   
   // Construct the optional arguments array we will be using
  -Object args[] = new Object[5];
  -args[0] = arg0;
  -args[1] = arg1;
  -args[2] = arg2;
  -args[3] = arg3;
  -args[4] = arg4;
  +Object args[] = new Object[] { arg0, arg1, arg2, arg3, arg4 };
   
   // Retrieve the message string we are looking for
   String message =
  
  
  

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



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/bean MessageTag.java

2003-07-13 Thread dgraham
dgraham 2003/07/13 16:55:00

  Modified:src/share/org/apache/struts/taglib/bean MessageTag.java
  Log:
  Fixed formatting.
  
  Revision  ChangesPath
  1.11  +63 -79
jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java
  
  Index: MessageTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MessageTag.java   11 Mar 2003 00:00:28 -  1.10
  +++ MessageTag.java   13 Jul 2003 23:55:00 -  1.11
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -59,10 +59,8 @@
*
*/
   
  -
   package org.apache.struts.taglib.bean;
   
  -
   import java.util.Locale;
   
   import javax.servlet.jsp.JspException;
  @@ -73,7 +71,6 @@
   import org.apache.struts.util.RequestUtils;
   import org.apache.struts.util.ResponseUtils;
   
  -
   /**
* Custom tag that retrieves an internationalized messages string (with
* optional parametric replacement) from the ActionResources
  @@ -83,117 +80,106 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
  -
   public class MessageTag extends TagSupport {
   
  -
   // - Properties
   
  -
   /**
* The first optional argument.
*/
   protected String arg0 = null;
   
   public String getArg0() {
  - return (this.arg0);
  +return (this.arg0);
   }
   
   public void setArg0(String arg0) {
  - this.arg0 = arg0;
  +this.arg0 = arg0;
   }
   
  -
   /**
* The second optional argument.
*/
   protected String arg1 = null;
   
   public String getArg1() {
  - return (this.arg1);
  +return (this.arg1);
   }
   
   public void setArg1(String arg1) {
  - this.arg1 = arg1;
  +this.arg1 = arg1;
   }
   
  -
   /**
* The third optional argument.
*/
   protected String arg2 = null;
   
   public String getArg2() {
  - return (this.arg2);
  +return (this.arg2);
   }
   
   public void setArg2(String arg2) {
  - this.arg2 = arg2;
  +this.arg2 = arg2;
   }
   
  -
   /**
* The fourth optional argument.
*/
   protected String arg3 = null;
   
   public String getArg3() {
  - return (this.arg3);
  +return (this.arg3);
   }
   
   public void setArg3(String arg3) {
  - this.arg3 = arg3;
  +this.arg3 = arg3;
   }
   
  -
   /**
* The fifth optional argument.
*/
   protected String arg4 = null;
   
   public String getArg4() {
  - return (this.arg4);
  +return (this.arg4);
   }
   
   public void setArg4(String arg4) {
  - this.arg4 = arg4;
  +this.arg4 = arg4;
   }
   
  -
   /**
* The servlet context attribute key for our resources.
*/
   protected String bundle = null;
   
   public String getBundle() {
  - return (this.bundle);
  +return (this.bundle);
   }
   
   public void setBundle(String bundle) {
  - this.bundle = bundle;
  +this.bundle = bundle;
   }
   
  -
   /**
* The default Locale for our server.
*/
   protected static final Locale defaultLocale = Locale.getDefault();
   
  -
   /**
* The message key of the message to be retrieved.
*/
   protected String key = null;
   
   public String getKey() {
  - return (this.key);
  +return (this.key);
   }
   
   public void setKey(String key) {
  - this.key = key;
  +this.key = key;
   }
   
  -
   /**
* Name of the bean that contains the message key.
*/
  @@ -207,7 +193,6 @@
   this.name = name;
   }
   
  -
   /**
* Name of the property to be accessed on the specified bean.
*/
  @@ -221,7 +206,6 @@
   this.property = property;
   }
   
  -
   /**
* The scope to be searched to retrieve the specified bean.
*/
  @@ -235,32 +219,28 @@
   this.scope = scope;
   }
   
  -
   /**
* The session scope key under which our Locale is stored.
*/
   protected String localeKey = Globals.LOCALE_KEY;
   
   public String getLocale() {
  - return (this.localeKey);
  +return (this.localeKey);
   }
   
   public void setLocale(String localeKey) {
  - this.localeKey = localeKey;
  +this.localeKey = localeKey;
   }
   
  -
   /**

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

2003-07-13 Thread dgraham
dgraham 2003/07/13 16:50:50

  Modified:src/share/org/apache/struts/taglib/logic PresentTag.java
  Log:
  Refactored condition() into smaller methods.
  
  Revision  ChangesPath
  1.15  +46 -28
jakarta-struts/src/share/org/apache/struts/taglib/logic/PresentTag.java
  
  Index: PresentTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/PresentTag.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PresentTag.java   24 Mar 2003 04:33:42 -  1.14
  +++ PresentTag.java   13 Jul 2003 23:50:50 -  1.15
  @@ -59,17 +59,16 @@
*
*/
   
  -
   package org.apache.struts.taglib.logic;
   
  -
   import java.security.Principal;
   import java.util.StringTokenizer;
  +
   import javax.servlet.http.Cookie;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.jsp.JspException;
  -import org.apache.struts.util.RequestUtils;
   
  +import org.apache.struts.util.RequestUtils;
   
   /**
* Evalute the nested body content of this tag if the specified value
  @@ -78,7 +77,6 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
  -
   public class PresentTag extends ConditionalTagBase {
   
   
  @@ -118,32 +116,14 @@
   HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
   
   if (cookie != null) {
  -Cookie cookies[] = request.getCookies();
  -if (cookies != null) {
  -for (int i = 0; i < cookies.length; i++) {
  -if (cookie.equals(cookies[i].getName())) {
  -present = true;
  -break;
  -}
  -}
  -}
  +present = this.isCookiePresent(request);
   
   } else if (header != null) {
   String value = request.getHeader(header);
   present = (value != null);
   
   } else if (name != null) {
  -Object value = null;
  -try {
  -if (property != null) {
  -value = RequestUtils.lookup(pageContext, name, property, scope);
  -} else {
  -value = RequestUtils.lookup(pageContext, name, scope);
  -}
  -} catch (JspException e) {
  -value = null;
  -}
  -present = (value != null);
  +present = this.isBeanPresent();
   
   } else if (parameter != null) {
   String value = request.getParameter(parameter);
  @@ -168,6 +148,44 @@
   
   return (present == desired);
   
  +}
  +
  +/**
  + * Returns true if the bean given in the name attribute is found.
  + * @since Struts 1.2
  + */
  +protected boolean isBeanPresent() {
  +Object value = null;
  +try {
  +if (this.property != null) {
  +value = RequestUtils.lookup(pageContext, name, this.property, 
scope);
  +} else {
  +value = RequestUtils.lookup(pageContext, name, scope);
  +}
  +} catch (JspException e) {
  +value = null;
  +}
  +
  +return (value != null);
  +}
  +
  +/**
  + * Returns true if the cookie is present in the request.
  + * @since Struts 1.2
  + */
  +protected boolean isCookiePresent(HttpServletRequest request) {
  +Cookie cookies[] = request.getCookies();
  +if (cookies == null) {
  +return false;
  +}
  +
  +for (int i = 0; i < cookies.length; i++) {
  +if (this.cookie.equals(cookies[i].getName())) {
  +return true;
  +}
  +}
  +
  +return false;
   }
   
   
  
  
  

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



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

2003-07-13 Thread dgraham
dgraham 2003/07/13 16:40:46

  Modified:src/share/org/apache/struts/taglib/logic RedirectTag.java
  Log:
  Refactored doEndTag() into smaller methods.
  
  Revision  ChangesPath
  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 -  1.15
  +++ RedirectTag.java  13 Jul 2003 23:40:46 -  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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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 RedirectTag.java ForwardTag.java

2003-07-13 Thread dgraham
dgraham 2003/07/13 16:33:27

  Modified:src/share/org/apache/struts/taglib/logic RedirectTag.java
ForwardTag.java
  Log:
  Fixed formatting.
  
  Revision  ChangesPath
  1.15  +54 -56
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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- RedirectTag.java  23 Sep 2002 05:22:08 -  1.14
  +++ RedirectTag.java  13 Jul 2003 23:33:27 -  1.15
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -59,33 +59,29 @@
*
*/
   
  -
   package org.apache.struts.taglib.logic;
   
  -
   import java.io.IOException;
   import java.net.MalformedURLException;
   import java.util.Map;
  +
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.tagext.TagSupport;
  +
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
   
  -
   /**
* Generate a URL-encoded redirect to the specified URI.
*
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
  -
   public class RedirectTag extends TagSupport {
   
  -
   // - Properties
   
  -
   /**
* The anchor to be added to the end of the generated hyperlink.
*/
  @@ -99,42 +95,38 @@
   this.anchor = anchor;
   }
   
  -
   /**
* The logical forward name from which to retrieve the redirect URI.
*/
   protected String forward = null;
   
   public String getForward() {
  -return (this.forward);
  +return (this.forward);
   }
   
   public void setForward(String forward) {
  -this.forward = forward;
  +this.forward = forward;
   }
   
  -
   /**
* The redirect URI.
*/
   protected String href = null;
   
   public String getHref() {
  -return (this.href);
  +return (this.href);
   }
   
   public void setHref(String href) {
  -this.href = href;
  +this.href = href;
   }
   
  -
   /**
* The message resources for this package.
*/
   protected static MessageResources messages =
  - MessageResources.getMessageResources
  -("org.apache.struts.taglib.logic.LocalStrings");
  -
  +MessageResources.getMessageResources(
  +"org.apache.struts.taglib.logic.LocalStrings");
   
   /**
* The JSP bean name for query parameters.
  @@ -142,14 +134,13 @@
   protected String name = null;
   
   public String getName() {
  -return (this.name);
  +return (this.name);
   }
   
   public void setName(String name) {
  -this.name = name;
  +this.name = name;
   }
   
  -
   /**
* The module-relative page URL (beginning with a slash) to which
* this redirect will be rendered.
  @@ -164,7 +155,6 @@
   this.page = page;
   }
   
  -
   /**
* The single-parameter request parameter name to generate.
*/
  @@ -178,7 +168,6 @@
   this.paramId = paramId;
   }
   
  -
   /**
* The single-parameter JSP bean name.
*/
  @@ -192,7 +181,6 @@
   this.paramName = paramName;
   }
   
  -
   /**
* The single-parameter JSP bean property.
*/
  @@ -206,7 +194,6 @@
   this.paramProperty = paramProperty;
   }
   
  -
   /**
* The single-parameter JSP bean scope.
*/
  @@ -220,21 +207,19 @@
   this.paramScope = paramScope;
   }
   
  -
   /**
* The JSP bean property name for query parameters.
*/
   protected String property = null;
   
   public String getProperty() {
  -return (this.property);
  +return (this.property);
   }
   
   public void setProperty(String property) {
  -this.property = property;
  +this.property = property;
   }
   
  -
   /**
* The scope of the bean specified by the name property, if any.
*/
  @@ -248,7 +233,6 @@
   this.scope = scope;
   }
   
  -
   /**
* Include our transaction control token?
*/
  @@ -262,10 +246,8 @@
   this.transaction = transaction;
   }
   
  -
   // - Public Methods
   
  -
   /**
* Defer generation until the end of this tag is encountered.
 

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

2003-07-13 Thread dgraham
dgraham 2003/07/13 16:28:03

  Modified:src/share/org/apache/struts/taglib/logic EmptyTag.java
  Log:
  Simplified logic.
  
  Revision  ChangesPath
  1.8   +26 -25
jakarta-struts/src/share/org/apache/struts/taglib/logic/EmptyTag.java
  
  Index: EmptyTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/EmptyTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- EmptyTag.java 10 May 2003 18:06:40 -  1.7
  +++ EmptyTag.java 13 Jul 2003 23:28:03 -  1.8
  @@ -63,7 +63,9 @@
   
   import java.util.Collection;
   import java.util.Map;
  +
   import javax.servlet.jsp.JspException;
  +
   import org.apache.struts.util.RequestUtils;
   
   /**
  @@ -113,8 +115,6 @@
RequestUtils.saveException(pageContext, e);
throw e;
}
  -
  - boolean empty = true;
   
Object value = null;
if (this.property == null) {
  @@ -123,27 +123,28 @@
value = RequestUtils.lookup(pageContext, name, property, 
scope);
}
   
  - if (value != null) {
  -
  - if (value instanceof String) {
  - String strValue = (String) value;
  - empty = (strValue.length() < 1);
  -
  - } else if (value instanceof Collection) {
  - Collection collValue = (Collection) value;
  - empty = collValue.isEmpty();
  -
  - } else if (value instanceof Map) {
  - Map mapValue = (Map) value;
  - empty = mapValue.isEmpty();
  -
  - } else {
  - empty = false;
  - }
  - }
  +boolean empty = true;
  +
  +if (value == null) {
  +empty = true;
  +
  +} else if (value instanceof String) {
  +String strValue = (String) value;
  +empty = (strValue.length() < 1);
  +
  +} else if (value instanceof Collection) {
  +Collection collValue = (Collection) value;
  +empty = collValue.isEmpty();
  +
  +} else if (value instanceof Map) {
  +Map mapValue = (Map) value;
  +empty = mapValue.isEmpty();
  +
  +} else {
  +empty = false;
  +}
   
return (empty == desired);
   }
  -
   
   }
  
  
  

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



Re: New Request Processor System [was Re: DO NOT REPLY [Bug 21479] - Add ServletRequest or HttpServletRequest to ActionForm constructor]

2003-07-13 Thread Peter A. Pilgrim
David Graham wrote:
As one of those contributors to the whole "Composable Request Processor"
a while ago, is there chance that we will get hint to what the
Request Processor system look likes?


I haven't seen it yet but I hear it's based on the GoF Chain of
Responsibility pattern and will be a commons component, not Struts
specific.  This seemed to be an appropriate middle ground between the
Filters vs. Struts only RequestProcessor debate to me.
Chain of Responsibility is appropriate. My guess is there may be
probably multiple CoR here just by casual inspection of the
current request processor.
Anyway, the  bug bear would be the configuration details
of the new request processor. This is what the previous bun-fight
debate detoriated to? Should it be with XML and/or
programmatically? I wait with baited breathe.
I finished of Struts 1.1 FCS integration Expresso Framework today,
time to catch some well deserved sun and sea.
--
Peter Pilgrim
   __ _ _ _
  / //__  // ___// ___/   +  Serverside Java
 / /___/ // /__ / /__ +  Struts
/ // ___// ___// ___/ +  Expresso Committer
 __/ // /__ / /__ / /__   +  Independent Contractor
/___///////   +  Intrinsic Motivation
On Line Resume
   ||
   \\===>  `` http://www.xenonsoft.demon.co.uk/no-it-striker.html ''
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

2003-07-13 Thread dgraham
dgraham 2003/07/13 16:20:16

  Modified:src/share/org/apache/struts/taglib/logic
MessagesPresentTag.java
  Log:
  Simplified condition() logic.
  
  Revision  ChangesPath
  1.7   +7 -21 
jakarta-struts/src/share/org/apache/struts/taglib/logic/MessagesPresentTag.java
  
  Index: MessagesPresentTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/MessagesPresentTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MessagesPresentTag.java   5 Jan 2003 00:40:04 -   1.6
  +++ MessagesPresentTag.java   13 Jul 2003 23:20:16 -  1.7
  @@ -1,7 +1,7 @@
   /*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -53,7 +53,6 @@
*
*/
   
  -
   package org.apache.struts.taglib.logic;
   
   import java.util.Iterator;
  @@ -64,7 +63,6 @@
   import org.apache.struts.action.ActionMessages;
   import org.apache.struts.util.RequestUtils;
   
  -
   /**
* Evalute to true if an ActionMessages class or a
* class that can be converted to an ActionMessages class is in
  @@ -75,7 +73,6 @@
* @version $Revision$ $Date$
* @since Struts 1.1
*/
  -
   public class MessagesPresentTag extends ConditionalTagBase {
   
   /**
  @@ -125,15 +122,12 @@
   protected boolean condition(boolean desired) throws JspException {
   ActionMessages am = null;
   
  -if (message != null && "true".equalsIgnoreCase(message))
  +if (message != null && "true".equalsIgnoreCase(message)){
  name = Globals.MESSAGE_KEY;
  -
  -// Evaluate the presence of the specified value
  -boolean bMessages = false;
  +}
   
   try {
  -// Definitely know it should be an error so
  -// use method to retrieve errors.
  +// Definitely know it should be an error so use method to retrieve 
errors.
   if (Globals.ERROR_KEY.equals(name)) {
   am = RequestUtils.getActionErrors(pageContext, name);
   } else {
  @@ -144,17 +138,9 @@
   throw e;
   }
   
  -Iterator iterator = null;
  -
  -if (property == null)
  -iterator = am.get();
  -else
  -iterator = am.get(property);
  -
  -if (iterator.hasNext())
  -   bMessages = true;
  +Iterator iterator = (property == null) ? am.get() : am.get(property);
   
  -return (bMessages == desired);
  +return (iterator.hasNext() == desired);
   
   }
   
  
  
  

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



Re: Please Ignore This (if the attached patch arrived)

2003-07-13 Thread David Graham
--- Benjamin Hood <[EMAIL PROTECTED]> wrote:
> Please Ignore This (if the attached patch arrived),
> 
> but I'm confused by the fact that the attached patch I just submitted
> didn't show up it the mail via my subscription.
> 
> I had actually previously read the FAQs to submitting patches.

Patches should be attached to a bugzilla ticket.

David

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


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: tiles tags exception handling

2003-07-13 Thread David Graham
This was a known problem that I've fixed for Struts 1.2.  You could also
use a recent nightly build to pick up this fix.

David


--- Nathan Coast <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I've been having trouble getting exceptions handled usefully when they 
> occur within jsps called via tiles:insert tags.
> 
> I've tracked the code down to:
> 
> org.apache.struts.taglib.tiles.InsertTag
> 
> where this exception handling code is called:
> 
> protected void processException(Throwable ex, String msg) throws 
> JspException {
>try {
>  if (msg == null)
>msg = ex.getMessage();
>  if (log.isDebugEnabled()) { // show full trace
>log.debug(msg, ex);
>pageContext.getOut().println(msg);
>ex.printStackTrace(new PrintWriter(pageContext.getOut(), true));
>  } else { // show only message
>pageContext.getOut().println(msg);
>  } // end if
>} catch (IOException ioex) { // problems. Propagate original
> exception
>  pageContext.setAttribute(
>ComponentConstants.EXCEPTION_KEY,
>ex,
>PageContext.REQUEST_SCOPE);
>  throw new JspException(msg);
>}
> }
> 
> my understanding of this code is that no exception will be passed to the
> 
> enclosing jsp page.  If an excption occurs, a simple error message will 
> appear in the enclosing page.  If debug is enabled for the Logger 
> "org.apache.struts.taglib.tiles.InsertTag" then the stack is filled in 
> too.  Am I right?
> 
> If so, would it be better to enable excptions to be cascaded up, 
> enabling exception management in a more application specific manner? 
> e.g. making use of the error-page elements in the web.xml
> 
> I'd like to be able to log the error centrally and display to the user a
> 
> meaningful error page.
> 
> thanks
> Nathan
> 
> p.s.  thanks to all the development team.  Struts seriously reduces 
> devlopment time and increases the quality of applications built with it.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: New Request Processor System [was Re: DO NOT REPLY [Bug 21479] - Add ServletRequest or HttpServletRequest to ActionForm constructor]

2003-07-13 Thread David Graham
> As one of those contributors to the whole "Composable Request Processor"
> a while ago, is there chance that we will get hint to what the
> Request Processor system look likes?

I haven't seen it yet but I hear it's based on the GoF Chain of
Responsibility pattern and will be a commons component, not Struts
specific.  This seemed to be an appropriate middle ground between the
Filters vs. Struts only RequestProcessor debate to me.

David

> 
> 
> -- 
> Peter Pilgrim
> __ _ _ _
>/ //__  // ___// ___/   +  Serverside Java
>   / /___/ // /__ / /__ +  Struts
>  / // ___// ___// ___/ +  Expresso Committer
>   __/ // /__ / /__ / /__   +  Independent Contractor
>  /___///////   +  Intrinsic Motivation
> On Line Resume
> ||
> \\===>  `` http://www.xenonsoft.demon.co.uk/no-it-striker.html ''
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



DO NOT REPLY [Bug 21548] New: - html:link tag can check validity of parameters

2003-07-13 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21548

html:link tag can check validity of parameters

   Summary: html:link tag can check validity of parameters
   Product: Struts
   Version: 1.1RC2
  Platform: Other
OS/Version: Other
Status: NEW
  Severity: Enhancement
  Priority: Other
 Component: Custom Tags
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


We've run into a situation where JSP developers often write html:link tags but specify 
a 
parameter name to an action incorrectly. It seems like it shouldn't be too hard for 
the 
html:link tag to validate the supplied parameter name (paramId attribute) against the 
available setters in the form specified for the action.

Obviously, this would only work in the situation where the html:link tag is used with 
the 
action attribute, but it would be very helpful if it threw an exception or rendered 
error text 
at the time of renderign the URL into the page.

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



Please Ignore This (if the attached patch arrived)

2003-07-13 Thread Benjamin Hood
Please Ignore This (if the attached patch arrived),

but I'm confused by the fact that the attached patch I just submitted
didn't show up it the mail via my subscription.

I had actually previously read the FAQs to submitting patches.

Cheers,

Ben



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



[PATCH] RequestProcessor : Populating non-String Bean fields

2003-07-13 Thread Benjamin Hood
Hallo,

I'm very new to MVC Frontends but thing I have noticed is that many struts
applications replicate business objects through forms, which are just the
string representation of the business data.

I have noticed that there has been some discussion about automatically
populating non-String Bean fields through the RequestProcessor facility.

Therefore I am submitting a working sugestion, which may or may not seem
sensible. As I said, this is just a first version of a solution to a
problem that I am confronted with in a productive situation, so there are
many details which would need to brushed up, if this approach was to be
followed any further (e.g. XML-Configuration, Default configurations,
creating a separate RequestProcessor, examples, testing, etc).

Briefly:

- I tentatively called this the FromString plugin (because that's what it
does).
- It uses the plugin mechanism.
- For speeds sake, I patched the RequestProcessor and the RequestUtils
(although one could create a separate RP, but I didn't because I gathered
through various discussion threads that the RP interface is going to be
changed - but correct if I'm wrong).
- It has a static configuration at the moment (so any further developement
would need to use the Digester mechanism).
- Because of this static config, the package contains a TestForm, in order
to prevent a cyclical dependency during deployment (for testing).
- It just provides the String2java.util.Date conversion at the moment.
- It has been tested with a simple JSP that sets a bean field of the type
java.util.Date
- The plugin essentially defines a collection of conversion services, which
can be configured at the field level of any given bean.
- For example, Bean XXX has fields 1 to n, where field i is a Date field.
Therefore the field[i] of XXXBean is mapped to Conversion object which is
invoked when the Bean gets populated after the View form has been
submitted.
- Of course, Conversion objects can be reused and one can map any number of
fields in any bean.
- (Maybe I've forgotten something, but I don't think so)

As I mentioned above, I would like to use such a mechanism in production
code, but if anybody feels that this kind of thing might be useful for the
general framework, I would quite happy to brush it up and submit it as open
source code, rather than just implementing proprietry code (of course
taking any further suggestions into account).

Cheers,

Ben

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

Bug report for Struts [2003/07/13]

2003-07-13 Thread bugzilla
+---+
| Bugzilla Bug ID   |
| +-+
| | Status: UNC=Unconfirmed NEW=New ASS=Assigned|
| | OPN=ReopenedVER=Verified(Skipped Closed/Resolved)   |
| |   +-+
| |   | Severity: BLK=Blocker CRI=CriticalMAJ=Major |
| |   |   MIN=Minor   NOR=Normal  ENH=Enhancement   |
| |   |   +-+
| |   |   | Date Posted |
| |   |   |  +--+
| |   |   |  | Description  |
| |   |   |  |  |
| 5395|Opn|Enh|2001-12-12|ActionContext class   |
| 5566|New|Enh|2001-12-21|html:link bug |
| 5739|Opn|Enh|2002-01-08|Struts fails silently in too many places  |
| 5937|New|Enh|2002-01-21|html:form trims all extensions|
| 6686|New|Enh|2002-02-26|make "action" attribute of html:form tag optional |
| 7892|Opn|Enh|2002-04-09|Using Multiple Resource Bundles for an Application|
| 9616|New|Enh|2002-06-05|Some more Struts docs |
| 9748|New|Enh|2002-06-10|attribute labelKeyProperty for Options tag|
|10550|New|Enh|2002-07-08|Delegate path-management to ActionForwards|
|10552|New|Enh|2002-07-08|create helper objects in struts-config|
|11520|Opn|Enh|2002-08-07|[validator-rules.xml] javascript validateRequired(|
|11932|New|Maj|2002-08-22|MessageResources is not module aware  |
|12600|New|Enh|2002-09-12|html:form tag always prepends context path to acti|
|13521|New|Enh|2002-10-11|CombinedDispatchAction|
|16074|New|Enh|2003-01-14|html:form uses 'action' not 'input' to select mapp|
|16296|New|Enh|2003-01-21|Add "action" attribute to   |
|16634|New|Enh|2003-01-31|reuiredif ignores missing property|
|16708|New|Enh|2003-02-03|I18N on ActionForwards|
|16792|Ass|Enh|2003-02-05|Migrate to commons-resources for message resources|
|16804|New|Enh|2003-02-05|html:text tag has no filter attribute |
|16814|New|Enh|2003-02-05|Add a generalized utililty class to expose informa|
|16971|New|Enh|2003-02-11|"multiple" attribute on select tag should not rend|
|17117|New|Enh|2003-02-17|Add a DispatchAction that is configurable via Acti|
|17281|New|Enh|2003-02-21|Add validateLongRange to Validator|
|17449|New|Enh|2003-02-26|Allow relative URL in action attribute of  custom tag to write forms' proper|
|18022|New|Enh|2003-03-14|HttpSessionBindingListener.valueUnbound() called o|
|18032|Opn|Enh|2003-03-16| tag appending session doesn't work with|
|18107|New|Enh|2003-03-18|contextRelative enhancement to  tag  |
|18111|New|Enh|2003-03-18|contextRelative enhancement to  t|
|18127|New|Enh|2003-03-18|Add DigestingPlugIn   |
|18221|New|Enh|2003-03-21|Move custom taglibs into their own jar/distributio|
|18255|New|Enh|2003-03-23|Japanese Message Resorces for struts-example  |
|18289|New|Enh|2003-03-24|Dynamic Message Resources |
|18293|New|Enh|2003-03-24|Loading language files does not use Resource Bundl|
|18370|New|Enh|2003-03-26|generate MANIFEST.MF with ant task|
|18426|New|Enh|2003-03-27|Add Tiles Support to  tag. |
|18583|New|Enh|2003-04-01| creates exceptions in normal flow  |
|18788|New|Enh|2003-04-07|Multiple input hook for multipage forms in process|
|18798|New|Enh|2003-04-08|Configure ActionServlet DataSource logging|
|18873|New|Enh|2003-04-09|Style deprecation messages during build   |
|18904|New|Enh|2003-04-10|Producing P3P header and in particular Compact Pol|
|18981|New|Enh|2003-04-13|File upload maximum size validator|
|18993|New|Enh|2003-04-14|required JavaScript validation doesn't work with m|
|19022|New|Enh|2003-04-15|Add execute()-method to o.a.s.tiles.Controller|
|19161|New|Enh|2003-04-18|validateDate javascript validation doesn't handle |
|19256|New|Enh|2003-04-23|Enhancement for dynamic link creation |
|19346|New|Enh|2003-04-26|Errors and Messages should be easier to manage|
|19420|New|Enh|2003-04-29|BaseHandlerTag should use its getter methods  |
|19539|New|Enh|2003-05-02|Add checks for List and Map-backed properties in D|
|19625|New|Enh|2003-05-03|DynaActionForm with LazyList support and WrapDynaA|
|19631|New|Enh|2003-05-04|Enhancements to RequestUtils tests|
|19780|Opn|Enh|2003-05-08| does not seem to support java.uti

New Request Processor System [was Re: DO NOT REPLY [Bug 21479] - Add ServletRequest or HttpServletRequest to ActionForm constructor]

2003-07-13 Thread Peter A. Pilgrim
David Graham wrote:
There is some movement towards separating Struts from the Servlet API so
that it may be used in by the upcoming Portlets API.  Craig is
implementing a new RequestProcessor system that accomodates that and I
would hate to move things in the opposite direction by tying ActionForms
even more to HttpServletRequest objects.
David

--- Kurt Post <[EMAIL PROTECTED]> wrote:

As one of those contributors to the whole "Composable Request Processor"
a while ago, is there chance that we will get hint to what the
Request Processor system look likes?
--
Peter Pilgrim
   __ _ _ _
  / //__  // ___// ___/   +  Serverside Java
 / /___/ // /__ / /__ +  Struts
/ // ___// ___// ___/ +  Expresso Committer
 __/ // /__ / /__ / /__   +  Independent Contractor
/___///////   +  Intrinsic Motivation
On Line Resume
   ||
   \\===>  `` http://www.xenonsoft.demon.co.uk/no-it-striker.html ''
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


tiles tags exception handling

2003-07-13 Thread Nathan Coast
Hi,

I've been having trouble getting exceptions handled usefully when they 
occur within jsps called via tiles:insert tags.

I've tracked the code down to:

org.apache.struts.taglib.tiles.InsertTag

where this exception handling code is called:

protected void processException(Throwable ex, String msg) throws 
JspException {
  try {
if (msg == null)
  msg = ex.getMessage();
if (log.isDebugEnabled()) { // show full trace
  log.debug(msg, ex);
  pageContext.getOut().println(msg);
  ex.printStackTrace(new PrintWriter(pageContext.getOut(), true));
} else { // show only message
  pageContext.getOut().println(msg);
} // end if
  } catch (IOException ioex) { // problems. Propagate original exception
pageContext.setAttribute(
  ComponentConstants.EXCEPTION_KEY,
  ex,
  PageContext.REQUEST_SCOPE);
throw new JspException(msg);
  }
}

my understanding of this code is that no exception will be passed to the 
enclosing jsp page.  If an excption occurs, a simple error message will 
appear in the enclosing page.  If debug is enabled for the Logger 
"org.apache.struts.taglib.tiles.InsertTag" then the stack is filled in 
too.  Am I right?

If so, would it be better to enable excptions to be cascaded up, 
enabling exception management in a more application specific manner? 
e.g. making use of the error-page elements in the web.xml

I'd like to be able to log the error centrally and display to the user a 
meaningful error page.

thanks
Nathan
p.s.  thanks to all the development team.  Struts seriously reduces 
devlopment time and increases the quality of applications built with it.

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