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 gl...@locus.apache.org on 2000/11/03 13:48:20 UTC
cvs commit: jakarta-taglibs/request/src/org/apache/taglibs/request CookiesTag.java
glenn 00/11/03 04:48:19
Modified: request/src/org/apache/taglibs/request CookiesTag.java
Log:
Cleanup for release
Revision Changes Path
1.3 +33 -27 jakarta-taglibs/request/src/org/apache/taglibs/request/CookiesTag.java
Index: CookiesTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/CookiesTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CookiesTag.java 2000/09/24 00:04:16 1.2
+++ CookiesTag.java 2000/11/03 12:48:18 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/CookiesTag.java,v 1.2 2000/09/24 00:04:16 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/09/24 00:04:16 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/CookiesTag.java,v 1.3 2000/11/03 12:48:18 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/11/03 12:48:18 $
*
* ====================================================================
*
@@ -84,7 +84,7 @@
* <tagclass>org.apache.taglibs.request.CookiesTag</tagclass>
* <teiclass>org.apache.taglibs.request.CookiesTEI</teiclass>
* <bodycontent>JSP</bodycontent>
- * <info>Used to loop through all cookies or get a single cookie.</info>
+ * <info>Loop through all cookies or get a single cookie.</info>
* <attribute>
* <name>id</name>
* <required>true</required>
@@ -102,9 +102,13 @@
public class CookiesTag extends BodyTagSupport
{
+ // All the cookies received with request
private Cookie [] cookies = null;
+ // Current cookie
private Cookie cookie = null;
+ // Number of cookies
private int cookie_num = 0;
+ // Optional attribute, name of single cookie to get
private String name = null;
/**
@@ -112,7 +116,7 @@
*
* @return SKIP_BODY if no cookies or cookie with <b>name</b> is not found, EVAL_BODY_TAG if cookie exists
*/
- public int doStartTag() throws JspException
+ public final int doStartTag() throws JspException
{
// Get the cookies
cookies = ((HttpServletRequest)pageContext.getRequest()).getCookies();
@@ -141,7 +145,7 @@
*
* @return EVAL_BODY_TAG if there is another cookie, or SKIP_BODY if there are no more cookies or this is a named cookie
*/
- public int doAfterBody() throws JspException
+ public final int doAfterBody() throws JspException
{
// increment the cookie number from the cookies array
cookie_num++;
@@ -157,9 +161,10 @@
/**
* Method called at end of Tag
+ *
* @return EVAL_PAGE
*/
- public int doEndTag() throws JspException
+ public final int doEndTag() throws JspException
{
try
{
@@ -173,10 +178,11 @@
}
/**
- * Set the name of the cookie to get.
+ * Set the optional tag attribute <b>name</b>.
*
+ * @param String name of cookie
*/
- public void setName(String str)
+ public final void setName(String str)
{
name = str;
}
@@ -187,9 +193,9 @@
* <p>
* <jsp:getProperty name=<i>"id"</i> property="comment"/>
*
- * @return the cookie comment as a String
+ * @return String - cookie comment
*/
- public String getComment()
+ public final String getComment()
{
return cookie.getComment();
}
@@ -199,9 +205,9 @@
* <p>
* <jsp:getProperty name=<i>"id"</i> property="domain"/>
*
- * @return the cookie domain as a String
+ * @return String - cookie domain
*/
- public String getDomain()
+ public final String getDomain()
{
return cookie.getDomain();
}
@@ -213,9 +219,9 @@
* <p>
* <jsp:getProperty name=<i>"id"</i> property="maxAge"/>
*
- * @return the cookie max age as a String
+ * @return String - cookie max age
*/
- public String getMaxAge()
+ public final String getMaxAge()
{
return "" + cookie.getMaxAge();
}
@@ -225,9 +231,9 @@
* <p>
* <jsp:getProperty name=<i>"id"</i> property="name"/>
*
- * @return the cookie name as a String
+ * @return String - cookie name
*/
- public String getName()
+ public final String getName()
{
return cookie.getName();
}
@@ -237,9 +243,9 @@
* <p>
* <jsp:getProperty name=<i>"id"</i> property="path"/>
*
- * @return the cookie path on the server as a String
+ * @return String - cookie path on the server
*/
- public String getPath()
+ public final String getPath()
{
return cookie.getPath();
}
@@ -249,9 +255,9 @@
* <p>
* <jsp:getProperty name=<i>"id"</i> property="value"/>
*
- * @return the cookie value as a String
+ * @return String - cookie value
*/
- public String getValue()
+ public final String getValue()
{
return cookie.getValue();
}
@@ -262,9 +268,9 @@
* <p>
* <jsp:getProperty name=<i>"id"</i> property="secure"/>
*
- * @return "1" if the cookies are secure, "0" if not
+ * @return String - "1" if the cookies are secure, "0" if not
*/
- public String getSecure()
+ public final String getSecure()
{
if( cookie.getSecure() )
return "1";
@@ -276,9 +282,9 @@
* <p>
* <jsp:getProperty name=<i>"id"</i> property="version"/>
*
- * @return the cookie version as a String
+ * @return String - cookie version
*/
- public String getVersion()
+ public final String getVersion()
{
return "" + cookie.getVersion();
}
@@ -286,9 +292,9 @@
/**
* Remove the script variable after cookies tag closed out
*/
- public void release()
+ public final void release()
{
- if( id.length() > 0 )
+ if( id != null && id.length() > 0 )
pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
}
}