You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by Henri Yandell <ba...@generationjava.com> on 2002/10/22 20:26:52 UTC

RE: release() methods for jakarta taglibs (fwd)

Some important questions on the Users list.

dbtags and mailer getting the exact focus, but a more general question
being asked. Obviously patches would be nice, or even just bug reports.

Any views?

Hen

---------- Forwarded message ----------
Date: Tue, 22 Oct 2002 12:59:10 -0500
From: "Halvorson, Loren" <Lo...@firepond.com>
Reply-To: Tag Libraries Users List <ta...@jakarta.apache.org>
To: 'Tag Libraries Users List' <ta...@jakarta.apache.org>
Subject: RE: release() methods for jakarta taglibs

This seems very similar to the bug I filed for dbtags last week.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13667
Is someone going to go through and clean up these pooling issues?  Or should
we be submitting patches?
-----Original Message-----
From: Mike Cantrell [mailto:Mike.Cantrell@ind.alcatel.com]
Sent: Tuesday, October 22, 2002 12:31 PM
To: Tag Libraries Users List
Subject: release() methods for jakarta taglibs


We are encountering some problems with the Jakarta Taglibs with newer
servlet containers that pool the tag objects (Tomcat  4.1.x and JRun
4.0). Most of the tags I looked through don't override the release()
method to reset the initial values and do cleanup.

For instance, the mailer taglib has a tag called mt:addrecipient. If you
use this tag, each time the page is called the value is just appended to
the original value. Are there any plans to go through these tags and
make them "pool safe"?

Example:

    <mt:mail server="smtp">
        <mt:from><c:out value="${param.mail_from}"
escapeXml="false"/></mt:from>
        <mt:subject><c:out value="${param.subject}"
escapeXml="false"/></mt:subject>
        <c:forEach var="email" items="${emailList}">
            <mt:addrecipient type="to"><c:out value="${email}"
escapeXml="false"/></mt:setrecipient>
        </c:forEach>
        <mt:message type="html">
            <div style="width: 500px;">
                <c:out value="${param.body}" escapeXml="false"/>
            </div>
        </mt:message>
        <mt:send/>
    </mt:mail>

Let's assume that emailList contains the addresess: jsmith@foo.com and
johns@bar.com.

The first time the page is processed, the email sends out emails to:

     jsmith@foo.com, johns@bar.com.

If you hit reload, the email sends out to:

     jsmith@foo.com, johns@bar.com, jsmith@foo.com, johns@bar.com

and if you hit reload again, the email sends out to:
     jsmith@foo.com, johns@bar.com, jsmith@foo.com,
johns@bar.com, jsmith@foo.com,
     johns@bar.com, jsmith@foo.com, johns@bar.com.


I've double checked the emailList  and it only contains the original 2
elements each time the page reloads. It appears that the taglib is
simply adding  the list to the old list from the Object obtained from
the pool since there's no release() method to reset the tag's initial data.



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] Re: release() methods for jakarta taglibs (fwd)

Posted by Glenn Nielsen <gl...@mail.more.net>.
Adding a release() method does not guarantee that the tags state will
be reset between invocations when tag pooling is used.  Please review
http://jakarta.apache.org/taglibs/guidelines.html and the JSP Specification
custom tag lifecycle when developing or modifying tag libraries to support
Servlet Container JSP custom tag pooling.

Regards,

Glenn

Mike Cantrell wrote:
> I added release() methods to all classes that needed their member vars 
> reset to their initial values.
> 
> Henri Yandell wrote:
> 
>> Some important questions on the Users list.
>>
>> dbtags and mailer getting the exact focus, but a more general question
>> being asked. Obviously patches would be nice, or even just bug reports.
>>
>> Any views?
>>
>> Hen
>>
>> ---------- Forwarded message ----------
>> Date: Tue, 22 Oct 2002 12:59:10 -0500
>> From: "Halvorson, Loren" <Lo...@firepond.com>
>> Reply-To: Tag Libraries Users List <ta...@jakarta.apache.org>
>> To: 'Tag Libraries Users List' <ta...@jakarta.apache.org>
>> Subject: RE: release() methods for jakarta taglibs
>>
>> This seems very similar to the bug I filed for dbtags last week.
>> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13667
>> Is someone going to go through and clean up these pooling issues?  Or 
>> should
>> we be submitting patches?
>> -----Original Message-----
>> From: Mike Cantrell [mailto:Mike.Cantrell@ind.alcatel.com]
>> Sent: Tuesday, October 22, 2002 12:31 PM
>> To: Tag Libraries Users List
>> Subject: release() methods for jakarta taglibs
>>
>>
>> We are encountering some problems with the Jakarta Taglibs with newer
>> servlet containers that pool the tag objects (Tomcat  4.1.x and JRun
>> 4.0). Most of the tags I looked through don't override the release()
>> method to reset the initial values and do cleanup.
>>
>> For instance, the mailer taglib has a tag called mt:addrecipient. If you
>> use this tag, each time the page is called the value is just appended to
>> the original value. Are there any plans to go through these tags and
>> make them "pool safe"?
>>
>> Example:
>>
>>    <mt:mail server="smtp">
>>        <mt:from><c:out value="${param.mail_from}"
>> escapeXml="false"/></mt:from>
>>        <mt:subject><c:out value="${param.subject}"
>> escapeXml="false"/></mt:subject>
>>        <c:forEach var="email" items="${emailList}">
>>            <mt:addrecipient type="to"><c:out value="${email}"
>> escapeXml="false"/></mt:setrecipient>
>>        </c:forEach>
>>        <mt:message type="html">
>>            <div style="width: 500px;">
>>                <c:out value="${param.body}" escapeXml="false"/>
>>            </div>
>>        </mt:message>
>>        <mt:send/>
>>    </mt:mail>
>>
>> Let's assume that emailList contains the addresess: jsmith@foo.com and
>> johns@bar.com.
>>
>> The first time the page is processed, the email sends out emails to:
>>
>>     jsmith@foo.com, johns@bar.com.
>>
>> If you hit reload, the email sends out to:
>>
>>     jsmith@foo.com, johns@bar.com, jsmith@foo.com, johns@bar.com
>>
>> and if you hit reload again, the email sends out to:
>>     jsmith@foo.com, johns@bar.com, jsmith@foo.com,
>> johns@bar.com, jsmith@foo.com,
>>     johns@bar.com, jsmith@foo.com, johns@bar.com.
>>
>>
>> I've double checked the emailList  and it only contains the original 2
>> elements each time the page reloads. It appears that the taglib is
>> simply adding  the list to the old list from the Object obtained from
>> the pool since there's no release() method to reset the tag's initial 
>> data.
>>
>>
>>
>> -- 
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>> -- 
>> To unsubscribe, e-mail:   
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail: 
>> <ma...@jakarta.apache.org>
>>
>>
>>
>>
>> -- 
>> To unsubscribe, e-mail:   
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail: 
>> <ma...@jakarta.apache.org>
>>
>>  
>>
> 
> ------------------------------------------------------------------------
> 
> --- AddRecipientTag.java	Tue Oct 22 13:55:31 2002
> +++ /home/mikec/src/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/AddRecipientTag.java	Tue Oct 22 12:54:32 2002
> @@ -66,10 +66,10 @@
>  import javax.servlet.jsp.tagext.*;
>  
>  /**
> - * AddRecipientTag - JSP tag <b>addrecipient</b> is used to add any type of 
> - *                recipient to an already existant list of recipients in an 
> + * AddRecipientTag - JSP tag <b>addrecipient</b> is used to add any type of
> + *                recipient to an already existant list of recipients in an
>   *                e-mail message. Two attributes are required, type and address.
> - *                Type may be either "to", "cc", or "bcc" and address should be 
> + *                Type may be either "to", "cc", or "bcc" and address should be
>   *                a string representation of the recipients e-mail address.
>   *
>   * <tag>
> @@ -133,8 +133,8 @@
>  	if (myparent == null)
>  	    throw new JspException("addrecipient tag not nested within mail tag");
>  	// Make sure type is set..either "to", "cc", or "bcc"
> -	if ((type != null) && (type.equalsIgnoreCase("to") || 
> -		type.equalsIgnoreCase("cc") || type.equalsIgnoreCase("bcc"))) { 
> +	if ((type != null) && (type.equalsIgnoreCase("to") ||
> +		type.equalsIgnoreCase("cc") || type.equalsIgnoreCase("bcc"))) {
>  
>  	    if (address != null) {
>  		// Try to see if the address attribute was used.
> @@ -149,10 +149,10 @@
>  		    myparent.addBcc(address);
>  		address = null;  // reset address
>  		return SKIP_BODY;
> -	    } else 
> +	    } else
>  	        return EVAL_BODY_TAG;
>  	} else
> -	    throw new JspException("The type attribute is not set. " + 
> +	    throw new JspException("The type attribute is not set. " +
>  				 " Specify either \"to\", \"cc\", or \"bcc\".");
>      }
>  
> @@ -169,7 +169,7 @@
>       *
>       */
>      public final int doAfterBody() throws JspException {
> -        if ((address = bodyContent.getString()) != null) { 
> +        if ((address = bodyContent.getString()) != null) {
>  	    // Try to see if the body was used for the address.
>  	    if (type.equalsIgnoreCase("to"))
>  		// set to in the parent tag
> @@ -182,7 +182,7 @@
>  		myparent.addBcc(address);
>  	    address = null;  // reset address so tag can be reused
>  	    return SKIP_BODY;
> -	} else 
> +	} else
>  	    throw new JspException("Address was not found. set " +
>  			     " the address attribute, or place the address in" +
>  			     " the body of the tag.");
> @@ -191,7 +191,7 @@
>      /**
>       * set the type of recipient for the address
>       *
> -     * @param type  string that is the type of the address either 
> +     * @param type  string that is the type of the address either
>       *   "to", "cc", or "bcc".
>       *
>       */
> @@ -202,11 +202,20 @@
>      /**
>       * set the value for an address to be later added to the email
>       *
> -     * @param address  string that is an address to be added to the 
> +     * @param address  string that is an address to be added to the
>       *   "to", "cc", or "bcc" lists of addresses.
>       *
>       */
>      public final void setAddress(String address) {
>        this.address = address.trim();
>      }
> +
> +    /**
> +     * reset the initial member values
> +     */
> +    public final void release() {
> +      this.myparent = null;
> +      this.address = null;
> +      this.type = null;
> +    }
>  }
> --- AttachTag.java	Tue Oct 22 13:55:31 2002
> +++ /home/mikec/src/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/AttachTag.java	Tue Oct 22 12:55:40 2002
> @@ -282,4 +282,14 @@
>  
>  // End of added
>      }
> +
> +    /**
> +     * reset the initial member values
> +     */
> +    public final void release() {
> +      this.file = null;
> +      this.mbp = null;
> +      this.type = null;
> +      this.url = null;
> +    }
>  }
> --- ErrorTag.java	Tue Oct 22 13:55:31 2002
> +++ /home/mikec/src/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/ErrorTag.java	Tue Oct 22 12:57:20 2002
> @@ -136,11 +136,11 @@
>      }
>  
>      /**
> -     * Implementation of the method from the tag interface that gets called at 
> +     * Implementation of the method from the tag interface that gets called at
>       * end of each error tag.
>       *
>       * @return EVAL_BODY_TAG if there is another error, or SKIP_BODY if there
> -     *                      are no more errors 
> +     *                      are no more errors
>       */
>      public final int doAfterBody() throws JspException
>      {
> @@ -190,11 +190,15 @@
>      }
>  
>      /**
> -     * Remove the script variable after error tag is closed out
> +     * Remove the script variable after error tag is closed out.
> +     * Reset the initial member values
>       */
> -    public final void release()
> -    {
> -	if( id != null && id.length() > 0 )
> -	    pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
> +    public final void release() {
> +      if( id != null && id.length() > 0 )
> +          pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
> +
> +      this.error = null;
> +      this.errorlist = null;
> +      this.errors = null;
>      }
>  }
> --- HeaderTag.java	Tue Oct 22 13:55:31 2002
> +++ /home/mikec/src/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/HeaderTag.java	Tue Oct 22 12:59:05 2002
> @@ -127,7 +127,7 @@
>  		// set header value in the parent tag
>  		myparent.setHeaderValue(value);
>  	    else if ((value = bodyContent.getString()) != null) {
> -		// if value was set in body of header tag 
> +		// if value was set in body of header tag
>  		myparent.setHeaderValue(value);
>  	    } else
>  		throw new JspException("The header tag is empty");
> @@ -154,4 +154,12 @@
>      public final void setValue(String value) {
>  	this.value = value;
>      }
> +
> +    /**
> +     * reset the initial member values
> +     */
> +    public final void release() {
> +      this.name = null;
> +      this.value = null;
> +    }
>  }
> --- MailTag.java	Tue Oct 22 13:55:31 2002
> +++ /home/mikec/src/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/MailTag.java	Tue Oct 22 13:11:23 2002
> @@ -225,7 +225,7 @@
>      private boolean error = false;
>      /**
>       * flag that determines if the session for sending mail should have an
> -     * authenticator so that user name and password can be entered if it is 
> +     * authenticator so that user name and password can be entered if it is
>       * required for the mail server
>       */
>      private boolean authentication = false;
> @@ -262,12 +262,12 @@
>  		// get initial context from which to lookup session
>  		Context ctx = new InitialContext();
>  
> -		// create the mail message using the preconfigured jndi 
> +		// create the mail message using the preconfigured jndi
>  		// named session
>  		sessionobj = (Session)ctx.lookup(session);
>  		message = new MimeMessage(sessionobj);
>  	    } catch (NamingException ne) {
> -		throw new JspException("Naming Exception " + 
> +		throw new JspException("Naming Exception " +
>  					   ne.getExplanation());
>  	    }
>  	} else {
> @@ -286,14 +286,14 @@
>  	    props.put("mail.smtp.dsn.notify", "FAILURE");
>  	    // set amount of message to get returned
>  	    props.put("mail.smtp.dsn.ret", "FULL");
> -	    // create new piece of mail for the smtp mail session check if 
> +	    // create new piece of mail for the smtp mail session check if
>  	    // authentication is required for the mail server
>  
>  	    if (authentication) {
>  		    // create the session with an authenticator object
>  		    // better way to do authentication
>  		    props.put("mail.smtp.auth", "true");
> -		    sessionobj = Session.getDefaultInstance(props, 
> +		    sessionobj = Session.getDefaultInstance(props,
>  					 new MailAuthenticator(user, password));
>  	    } else
>  		sessionobj = Session.getDefaultInstance(props, null);
> @@ -711,5 +711,32 @@
>  	else
>  	    bcc = bcc.concat("," + value);
>      }
> +
> +    /**
> +     * reset the initial member values
> +     */
> +    public final void release() {
> +      this.attachments = false;
> +      this.authentication = false;
> +      this.bcc = null;
> +      this.body = null;
> +      this.bodyparts = new ArrayList(10);
> +      this.cc = null;
> +      this.error = false;
> +      this.from = null;
> +      this.message = null;
> +      this.mimemessage = null;
> +      this.name = new ArrayList(10);
> +      this.password = null;
> +      this.replyto = null;
> +      this.server = "localhost";
> +      this.session = null;
> +      this.sessionobj = null;
> +      this.subject = "";
> +      this.to = null;
> +      this.type = "text/plain";
> +      this.user = null;
> +      this.value = new ArrayList(10);
> +    }
>  }
>  
> --- MessageTag.java	Tue Oct 22 13:55:31 2002
> +++ /home/mikec/src/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/MessageTag.java	Tue Oct 22 13:12:13 2002
> @@ -132,4 +132,11 @@
>      public final void setType(String value) {
>  	type = value;
>      }
> +
> +    /**
> +     * reset the initial member values
> +     */
> +    public final void release() {
> +      this.type = null;
> +    }
>  }
> --- SendTag.java	Tue Oct 22 13:55:31 2002
> +++ /home/mikec/src/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/SendTag.java	Tue Oct 22 13:13:07 2002
> @@ -148,7 +148,7 @@
>  	    try {
>  		// set the to address for this message
>  		// catch any errors in the format of the addresses
> -	        message.setRecipients(Message.RecipientType.TO, 
> +	        message.setRecipients(Message.RecipientType.TO,
>  				      InternetAddress.parse(to));
>  	    } catch (AddressException ae) {
>  		// get the address that the error occured with
> @@ -260,7 +260,7 @@
>  		cc = cc.substring(1);
>  
>  	    try {
> -                message.setRecipients(Message.RecipientType.CC, 
> +                message.setRecipients(Message.RecipientType.CC,
>  					   InternetAddress.parse(cc));
>  	    } catch (AddressException ae) {
>  		// get the address that the error occured with
> @@ -291,7 +291,7 @@
>  		// exception occurs when any of the addresses cannot be
>  		// properly set in the message
>                  String errorinput = "Messaging Exception: Some cc address/es"
> -			                + " could not be set in the message." 
> +			                + " could not be set in the message."
>  			                + me.getMessage();
>  
>  		error.add(errorinput);
> @@ -307,7 +307,7 @@
>  		bcc = bcc.substring(1);
>  
>  	    try {
> -                message.setRecipients(Message.RecipientType.BCC, 
> +                message.setRecipients(Message.RecipientType.BCC,
>  					  InternetAddress.parse(bcc));
>  	    } catch (AddressException ae) {
>  		// get the address that the error occured with
> @@ -338,7 +338,7 @@
>  		// exception occurs when any of the addresses cannot be
>  		// properly set in the message
>                  String errorinput = "Messaging Exception: Some bcc address/es"
> -			                + " could not be set in the message." 
> +			                + " could not be set in the message."
>  			                + me.getMessage();
>  
>  		error.add(errorinput);
> @@ -366,7 +366,7 @@
>  		// create a mimebodypart for the body of the e-mail message
>  		MimeBodyPart mbp = new MimeBodyPart();
>  
> -		// set the content in the bodypart 
> +		// set the content in the bodypart
>  		mbp.setContent(myparent.getBody(), myparent.getType());
>  
>  		// add the message as the first bodypart in the multipart object
> @@ -375,7 +375,7 @@
>  		// get the list of attachments
>  		iterate = myparent.getBodyParts().listIterator();
>  
> -		// loop through the list of attachments and add them to the 
> +		// loop through the list of attachments and add them to the
>  		// multipart object
>  		while (iterate.hasNext()) {
>  		    multipart.addBodyPart((MimeBodyPart) iterate.next());
> @@ -453,6 +453,13 @@
>      public final ArrayList getError() {
>  	return error;
>      }
> +
> +    /**
> +     * reset the initial member values
> +     */
> +    public final void release() {
> +      this.error = null;
> +    }
>  }
>  
>   /**
> @@ -468,10 +475,10 @@
>  
>      private MimeMessage message = null;  // the message to be sent
>      // used to get the servlet context for logging
> -    private javax.servlet.ServletContext sc = null; 
> -    String mailto;  // list of to address this message is being sent to 
> +    private javax.servlet.ServletContext sc = null;
> +    String mailto;  // list of to address this message is being sent to
>  
> -    Mail (MimeMessage mail, javax.servlet.ServletContext servletcontext, 
> +    Mail (MimeMessage mail, javax.servlet.ServletContext servletcontext,
>  	  String to) {
>  	message = mail;
>  	sc = servletcontext;
> @@ -493,7 +500,7 @@
>  	    // Since the JSP has already finished executing this exception will
>  	    // do nothing visible, however the errors should be dealt with by
>  	    // the SMTP host if it is configured correctly
> -	    sc.log("Could not send the e-mail sent to " + mailto + ":  " + 
> +	    sc.log("Could not send the e-mail sent to " + mailto + ":  " +
>  		   me.getMessage());
>  	}
>      }
> --- SetRecipientTag.java	Tue Oct 22 13:55:31 2002
> +++ /home/mikec/src/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/SetRecipientTag.java	Tue Oct 22 13:14:19 2002
> @@ -66,10 +66,10 @@
>  import javax.servlet.jsp.tagext.*;
>  
>  /**
> - * SetRecipientTag - JSP tag <b>setrecipient</b> is used to set any type of 
> - *                recipient to an e-mail. Two attributes are required, type and 
> - *                setress. Type may be either "to", "cc", or "bcc" and address 
> - *                should be a string representation of the recipients e-mail 
> + * SetRecipientTag - JSP tag <b>setrecipient</b> is used to set any type of
> + *                recipient to an e-mail. Two attributes are required, type and
> + *                setress. Type may be either "to", "cc", or "bcc" and address
> + *                should be a string representation of the recipients e-mail
>   *                address.
>   *
>   * <tag>
> @@ -133,8 +133,8 @@
>  	if (myparent == null)
>  	    throw new JspException("setrecipient tag not nested within mail tag");
>  	// Make sure type is set..either "to", "cc", or "bcc"
> -	if ((type != null) && (type.equalsIgnoreCase("to") || 
> -		type.equalsIgnoreCase("cc") || type.equalsIgnoreCase("bcc"))) { 
> +	if ((type != null) && (type.equalsIgnoreCase("to") ||
> +		type.equalsIgnoreCase("cc") || type.equalsIgnoreCase("bcc"))) {
>  
>  	    if (address != null) {
>  		// Try to see if the address attribute was used.
> @@ -149,10 +149,10 @@
>  		    myparent.setBcc(address);
>  		address = null;  // reset address
>  		return SKIP_BODY;
> -	    } else 
> +	    } else
>  	        return EVAL_BODY_TAG;
>  	} else
> -	    throw new JspException("The type attribute is not set. " + 
> +	    throw new JspException("The type attribute is not set. " +
>  				 " Specify either \"to\", \"cc\", or \"bcc\".");
>      }
>  
> @@ -182,7 +182,7 @@
>  		myparent.setBcc(address);
>  	    address = null;  // reset address so tag can be reused
>  	    return SKIP_BODY;
> -	} else 
> +	} else
>  	    throw new JspException("Address was not found. set " +
>  			     " the address attribute, or place the address in" +
>  			     " the body of the tag.");
> @@ -191,7 +191,7 @@
>      /**
>       * set the type of recipient for the address
>       *
> -     * @param type  string that is the type of the address either 
> +     * @param type  string that is the type of the address either
>       *   "to", "cc", or "bcc".
>       *
>       */
> @@ -202,11 +202,20 @@
>      /**
>       * set the value for an address to be later added to the email
>       *
> -     * @param address  string that is an address to be added to the 
> +     * @param address  string that is an address to be added to the
>       *   "to", "cc", or "bcc" lists of addresses.
>       *
>       */
>      public final void setAddress(String address) {
>        this.address = address.trim();
>      }
> +
> +    /**
> +     * reset the initial member values
> +     */
> +    public final void release() {
> +      this.address = null;
> +      this.myparent = null;
> +      this.type = null;
> +    }
>  }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[PATCH] Re: release() methods for jakarta taglibs (fwd)

Posted by Mike Cantrell <Mi...@ind.alcatel.com>.
I added release() methods to all classes that needed their member vars 
reset to their initial values.

Henri Yandell wrote:

>Some important questions on the Users list.
>
>dbtags and mailer getting the exact focus, but a more general question
>being asked. Obviously patches would be nice, or even just bug reports.
>
>Any views?
>
>Hen
>
>---------- Forwarded message ----------
>Date: Tue, 22 Oct 2002 12:59:10 -0500
>From: "Halvorson, Loren" <Lo...@firepond.com>
>Reply-To: Tag Libraries Users List <ta...@jakarta.apache.org>
>To: 'Tag Libraries Users List' <ta...@jakarta.apache.org>
>Subject: RE: release() methods for jakarta taglibs
>
>This seems very similar to the bug I filed for dbtags last week.
>http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13667
>Is someone going to go through and clean up these pooling issues?  Or should
>we be submitting patches?
>-----Original Message-----
>From: Mike Cantrell [mailto:Mike.Cantrell@ind.alcatel.com]
>Sent: Tuesday, October 22, 2002 12:31 PM
>To: Tag Libraries Users List
>Subject: release() methods for jakarta taglibs
>
>
>We are encountering some problems with the Jakarta Taglibs with newer
>servlet containers that pool the tag objects (Tomcat  4.1.x and JRun
>4.0). Most of the tags I looked through don't override the release()
>method to reset the initial values and do cleanup.
>
>For instance, the mailer taglib has a tag called mt:addrecipient. If you
>use this tag, each time the page is called the value is just appended to
>the original value. Are there any plans to go through these tags and
>make them "pool safe"?
>
>Example:
>
>    <mt:mail server="smtp">
>        <mt:from><c:out value="${param.mail_from}"
>escapeXml="false"/></mt:from>
>        <mt:subject><c:out value="${param.subject}"
>escapeXml="false"/></mt:subject>
>        <c:forEach var="email" items="${emailList}">
>            <mt:addrecipient type="to"><c:out value="${email}"
>escapeXml="false"/></mt:setrecipient>
>        </c:forEach>
>        <mt:message type="html">
>            <div style="width: 500px;">
>                <c:out value="${param.body}" escapeXml="false"/>
>            </div>
>        </mt:message>
>        <mt:send/>
>    </mt:mail>
>
>Let's assume that emailList contains the addresess: jsmith@foo.com and
>johns@bar.com.
>
>The first time the page is processed, the email sends out emails to:
>
>     jsmith@foo.com, johns@bar.com.
>
>If you hit reload, the email sends out to:
>
>     jsmith@foo.com, johns@bar.com, jsmith@foo.com, johns@bar.com
>
>and if you hit reload again, the email sends out to:
>     jsmith@foo.com, johns@bar.com, jsmith@foo.com,
>johns@bar.com, jsmith@foo.com,
>     johns@bar.com, jsmith@foo.com, johns@bar.com.
>
>
>I've double checked the emailList  and it only contains the original 2
>elements each time the page reloads. It appears that the taglib is
>simply adding  the list to the old list from the Object obtained from
>the pool since there's no release() method to reset the tag's initial data.
>
>
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>  
>

Re: release() methods for jakarta taglibs (fwd)

Posted by Mike Cantrell <Mi...@ind.alcatel.com>.
I don't mind doing a patch for mailer.


Henri Yandell wrote:

>Some important questions on the Users list.
>
>dbtags and mailer getting the exact focus, but a more general question
>being asked. Obviously patches would be nice, or even just bug reports.
>
>Any views?
>
>Hen
>
>---------- Forwarded message ----------
>Date: Tue, 22 Oct 2002 12:59:10 -0500
>From: "Halvorson, Loren" <Lo...@firepond.com>
>Reply-To: Tag Libraries Users List <ta...@jakarta.apache.org>
>To: 'Tag Libraries Users List' <ta...@jakarta.apache.org>
>Subject: RE: release() methods for jakarta taglibs
>
>This seems very similar to the bug I filed for dbtags last week.
>http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13667
>Is someone going to go through and clean up these pooling issues?  Or should
>we be submitting patches?
>-----Original Message-----
>From: Mike Cantrell [mailto:Mike.Cantrell@ind.alcatel.com]
>Sent: Tuesday, October 22, 2002 12:31 PM
>To: Tag Libraries Users List
>Subject: release() methods for jakarta taglibs
>
>
>We are encountering some problems with the Jakarta Taglibs with newer
>servlet containers that pool the tag objects (Tomcat  4.1.x and JRun
>4.0). Most of the tags I looked through don't override the release()
>method to reset the initial values and do cleanup.
>
>For instance, the mailer taglib has a tag called mt:addrecipient. If you
>use this tag, each time the page is called the value is just appended to
>the original value. Are there any plans to go through these tags and
>make them "pool safe"?
>
>Example:
>
>    <mt:mail server="smtp">
>        <mt:from><c:out value="${param.mail_from}"
>escapeXml="false"/></mt:from>
>        <mt:subject><c:out value="${param.subject}"
>escapeXml="false"/></mt:subject>
>        <c:forEach var="email" items="${emailList}">
>            <mt:addrecipient type="to"><c:out value="${email}"
>escapeXml="false"/></mt:setrecipient>
>        </c:forEach>
>        <mt:message type="html">
>            <div style="width: 500px;">
>                <c:out value="${param.body}" escapeXml="false"/>
>            </div>
>        </mt:message>
>        <mt:send/>
>    </mt:mail>
>
>Let's assume that emailList contains the addresess: jsmith@foo.com and
>johns@bar.com.
>
>The first time the page is processed, the email sends out emails to:
>
>     jsmith@foo.com, johns@bar.com.
>
>If you hit reload, the email sends out to:
>
>     jsmith@foo.com, johns@bar.com, jsmith@foo.com, johns@bar.com
>
>and if you hit reload again, the email sends out to:
>     jsmith@foo.com, johns@bar.com, jsmith@foo.com,
>johns@bar.com, jsmith@foo.com,
>     johns@bar.com, jsmith@foo.com, johns@bar.com.
>
>
>I've double checked the emailList  and it only contains the original 2
>elements each time the page reloads. It appears that the taglib is
>simply adding  the list to the old list from the Object obtained from
>the pool since there's no release() method to reset the tag's initial data.
>
>
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>  
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>