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...@apache.org on 2001/07/13 02:09:15 UTC
cvs commit: jakarta-taglibs/request/src/org/apache/taglibs/request EqualsAttributeTag.java EqualsCookieTag.java EqualsHeaderTag.java EqualsParameterTag.java AttributesTag.java CookiesTag.java ExistsAttributeTag.java ExistsCookieTag.java ExistsHeaderTag.java ExistsParameterTag.java ExistsQueryStringTag.java HeaderValuesTag.java HeadersTag.java IsSecureTag.java IsSessionFromCookieTag.java IsSessionFromURLTag.java IsSessionValidTag.java IsUserInRoleTag.java ParameterValuesTag.java ParametersTag.java QueryStringsTag.java
glenn 01/07/12 17:09:15
Modified: request/src/org/apache/taglibs/request AttributesTag.java
CookiesTag.java ExistsAttributeTag.java
ExistsCookieTag.java ExistsHeaderTag.java
ExistsParameterTag.java ExistsQueryStringTag.java
HeaderValuesTag.java HeadersTag.java
IsSecureTag.java IsSessionFromCookieTag.java
IsSessionFromURLTag.java IsSessionValidTag.java
IsUserInRoleTag.java ParameterValuesTag.java
ParametersTag.java QueryStringsTag.java
Added: request/src/org/apache/taglibs/request
EqualsAttributeTag.java EqualsCookieTag.java
EqualsHeaderTag.java EqualsParameterTag.java
Log:
Convert to new build and implement tag guidelines
Revision Changes Path
1.3 +4 -11 jakarta-taglibs/request/src/org/apache/taglibs/request/AttributesTag.java
Index: AttributesTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/AttributesTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AttributesTag.java 2000/11/03 12:47:40 1.2
+++ AttributesTag.java 2001/07/13 00:08:58 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/AttributesTag.java,v 1.2 2000/11/03 12:47:40 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:47:40 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/AttributesTag.java,v 1.3 2001/07/13 00:08:58 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:08:58 $
*
* ====================================================================
*
@@ -144,6 +144,7 @@
*/
public final int doEndTag() throws JspException
{
+ pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
try
{
if(bodyContent != null)
@@ -182,12 +183,4 @@
return "" + value.toString();
}
- /**
- * Remove the script variable after attributes tag closed out
- */
- public final void release()
- {
- if( id != null && id.length() > 0 )
- pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
- }
}
1.4 +4 -11 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CookiesTag.java 2000/11/03 12:48:18 1.3
+++ CookiesTag.java 2001/07/13 00:08:58 1.4
@@ -1,7 +1,7 @@
/*
- * $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 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/CookiesTag.java,v 1.4 2001/07/13 00:08:58 glenn Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/07/13 00:08:58 $
*
* ====================================================================
*
@@ -166,6 +166,7 @@
*/
public final int doEndTag() throws JspException
{
+ pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
try
{
if(bodyContent != null)
@@ -289,12 +290,4 @@
return "" + cookie.getVersion();
}
- /**
- * Remove the script variable after cookies tag closed out
- */
- public final void release()
- {
- if( id != null && id.length() > 0 )
- pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
- }
}
1.3 +9 -13 jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsAttributeTag.java
Index: ExistsAttributeTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsAttributeTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExistsAttributeTag.java 2000/11/03 12:48:32 1.2
+++ ExistsAttributeTag.java 2001/07/13 00:09:00 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsAttributeTag.java,v 1.2 2000/11/03 12:48:32 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:48:32 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsAttributeTag.java,v 1.3 2001/07/13 00:09:00 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:00 $
*
* ====================================================================
*
@@ -101,7 +101,7 @@
public class ExistsAttributeTag extends TagSupport
{
private String name = null;
- private Boolean value = null;
+ private boolean value = true;
/**
* Includes the body of the tag if the request attribute exists.
@@ -114,13 +114,9 @@
if( pageContext.getRequest().getAttribute(name) != null )
result = true;
- if( value == null ) {
- if( result )
- return EVAL_BODY_INCLUDE;
- return SKIP_BODY;
- }
- if( value.booleanValue() == result )
+ if( value == result )
return EVAL_BODY_INCLUDE;
+
return SKIP_BODY;
}
@@ -137,11 +133,11 @@
/**
* Set the optional tag attribute <b>value</b> to true or false.
*
- * @param String true or false
+ * @param boolean true or false
*/
- public final void setValue(String str)
+ public final void setValue(boolean value)
{
- value = new Boolean(str);
+ this.value = value;
}
}
1.3 +12 -16 jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsCookieTag.java
Index: ExistsCookieTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsCookieTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExistsCookieTag.java 2000/11/03 12:48:48 1.2
+++ ExistsCookieTag.java 2001/07/13 00:09:00 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsCookieTag.java,v 1.2 2000/11/03 12:48:48 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:48:48 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsCookieTag.java,v 1.3 2001/07/13 00:09:00 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:00 $
*
* ====================================================================
*
@@ -68,18 +68,18 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>existscookie</b>, used to determine if an HttpServletRequest
+ * JSP Tag <b>existsCookie</b>, used to determine if an HttpServletRequest
* cookie exists.
* <p>
* Includes the body of the tag if the cookie exists.
* <p>
* You can set the optional tag cookie <b>value</b> to <i>true</i> or
- * <i>false</i>. The body of the tag is included if existscookie matches
+ * <i>false</i>. The body of the tag is included if existsCookie matches
* the value.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>existscookie</name>
+ * <name>existsCookie</name>
* <tagclass>org.apache.taglibs.request.ExistsCookieTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Includes the body of the tag if the request cookie exists.</info>
@@ -103,12 +103,12 @@
// Name of cookie to test for existance
private String name = null;
// Optional attribute value of existance required
- private Boolean value = null;
+ private boolean value = true;
/**
* Includes the body of the tag if the request cookie exists.
*
- * @return SKIP_BODY if existscookie doesn't match value, EVAL_BODY_include if existscookie matches value
+ * @return SKIP_BODY if existsCookie doesn't match value, EVAL_BODY_include if existsCookie matches value
*/
public final int doStartTag() throws JspException
{
@@ -129,13 +129,9 @@
if( cookie != null )
result = true;
- if( value == null ) {
- if( result )
- return EVAL_BODY_INCLUDE;
- return SKIP_BODY;
- }
- if( value.booleanValue() == result )
+ if( value == result )
return EVAL_BODY_INCLUDE;
+
return SKIP_BODY;
}
@@ -154,9 +150,9 @@
*
* @param String true or false
*/
- public final void setValue(String str)
+ public final void setValue(boolean value)
{
- value = new Boolean(str);
+ this.value = value;
}
}
1.3 +13 -17 jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsHeaderTag.java
Index: ExistsHeaderTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsHeaderTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExistsHeaderTag.java 2000/11/03 12:49:00 1.2
+++ ExistsHeaderTag.java 2001/07/13 00:09:01 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsHeaderTag.java,v 1.2 2000/11/03 12:49:00 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:49:00 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsHeaderTag.java,v 1.3 2001/07/13 00:09:01 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:01 $
*
* ====================================================================
*
@@ -68,18 +68,18 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>existsheader</b>, used to determine if an HttpServletRequest
+ * JSP Tag <b>existsHeader</b>, used to determine if an HttpServletRequest
* header exists.
* <p>
* Includes the body of the tag if the header exists.
* <p>
* You can set the optional tag header <b>value</b> to <i>true</i> or
- * <i>false</i>. The body of the tag is included if existsheader matches
+ * <i>false</i>. The body of the tag is included if existsHeader matches
* the value.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>existsheader</name>
+ * <name>existsHeader</name>
* <tagclass>org.apache.taglibs.request.ExistsHeaderTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Includes the body of the tag if the request header exists.</info>
@@ -103,12 +103,12 @@
// Required attribute, name of HTTP header
private String name = null;
// Optional value to test existance
- private Boolean value = null;
+ private boolean value = true;
/**
* Includes the body of the tag if the request header exists.
*
- * @return SKIP_BODY if existsheader doesn't match value, EVAL_BODY_include if existsheader matches value
+ * @return SKIP_BODY if existsHeader doesn't match value, EVAL_BODY_include if existsHeader matches value
*/
public final int doStartTag() throws JspException
{
@@ -116,13 +116,9 @@
if( ((HttpServletRequest)pageContext.getRequest()).getHeader(name) != null )
result = true;
- if( value == null ) {
- if( result )
- return EVAL_BODY_INCLUDE;
- return SKIP_BODY;
- }
- if( value.booleanValue() == result )
+ if( value == result )
return EVAL_BODY_INCLUDE;
+
return SKIP_BODY;
}
@@ -139,11 +135,11 @@
/**
* Set the optional tag attribute <b>value</b> to true or false.
*
- * @param String true or false
+ * @param boolean true or false
*/
- public final void setValue(String str)
+ public final void setValue(boolean value)
{
- value = new Boolean(str);
+ this.value = value;
}
}
1.4 +13 -17 jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsParameterTag.java
Index: ExistsParameterTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsParameterTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ExistsParameterTag.java 2000/12/03 01:38:15 1.3
+++ ExistsParameterTag.java 2001/07/13 00:09:01 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsParameterTag.java,v 1.3 2000/12/03 01:38:15 glenn Exp $
- * $Revision: 1.3 $
- * $Date: 2000/12/03 01:38:15 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsParameterTag.java,v 1.4 2001/07/13 00:09:01 glenn Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/07/13 00:09:01 $
*
* ====================================================================
*
@@ -68,18 +68,18 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>existsparameter</b>, used to determine if an HttpServletRequest
+ * JSP Tag <b>existsParameter</b>, used to determine if an HttpServletRequest
* parameter exists.
* <p>
* Includes the body of the tag if the parameter exists.
* <p>
* You can set the optional tag parameter <b>value</b> to <i>true</i> or
- * <i>false</i>. The body of the tag is included if existsparameter matches
+ * <i>false</i>. The body of the tag is included if existsParameter matches
* the value.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>existsparameter</name>
+ * <name>existsParameter</name>
* <tagclass>org.apache.taglibs.request.ExistsParameterTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Includes the body of the tag if the request parameter exists.</info>
@@ -102,12 +102,12 @@
{
// Required attribute, parameter name
private String name = null;
- private Boolean value = null;
+ private boolean value = true;
/**
* Includes the body of the tag if the request parameter exists.
*
- * @return SKIP_BODY if existsparameter doesn't match value, EVAL_BODY_include if existsparameter matches value
+ * @return SKIP_BODY if existsParameter doesn't match value, EVAL_BODY_include if existsParameter matches value
*/
public final int doStartTag() throws JspException
{
@@ -116,13 +116,9 @@
if( tmp != null && tmp.length() > 0 )
result = true;
- if( value == null ) {
- if( result )
- return EVAL_BODY_INCLUDE;
- return SKIP_BODY;
- }
- if( value.booleanValue() == result )
+ if( value == result )
return EVAL_BODY_INCLUDE;
+
return SKIP_BODY;
}
@@ -139,11 +135,11 @@
/**
* Set the optional tag attribute <b>value</b> to true or false.
*
- * @param String true or false
+ * @param boolean true or false
*/
- public final void setValue(String str)
+ public final void setValue(boolean value)
{
- value = new Boolean(str);
+ this.value = value;
}
}
1.3 +9 -13 jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsQueryStringTag.java
Index: ExistsQueryStringTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsQueryStringTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExistsQueryStringTag.java 2000/11/03 12:53:31 1.2
+++ ExistsQueryStringTag.java 2001/07/13 00:09:02 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsQueryStringTag.java,v 1.2 2000/11/03 12:53:31 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:53:31 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ExistsQueryStringTag.java,v 1.3 2001/07/13 00:09:02 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:02 $
*
* ====================================================================
*
@@ -101,7 +101,7 @@
public class ExistsQueryStringTag extends TagSupport
{
private String name = null;
- private Boolean value = null;
+ private boolean value = true;
/**
* Includes the body of the tag if the request querystring parameter exists.
@@ -123,13 +123,9 @@
}
}
- if( value == null ) {
- if( result )
- return EVAL_BODY_INCLUDE;
- return SKIP_BODY;
- }
- if( value.booleanValue() == result )
+ if( value == result )
return EVAL_BODY_INCLUDE;
+
return SKIP_BODY;
}
@@ -146,11 +142,11 @@
/**
* Set the optional tag attribute <b>value</b> to true or false.
*
- * @param String true or false
+ * @param boolean true or false
*/
- public final void setValue(String str)
+ public final void setValue(boolean value)
{
- value = new Boolean(str);
+ this.value = value;
}
}
1.3 +8 -15 jakarta-taglibs/request/src/org/apache/taglibs/request/HeaderValuesTag.java
Index: HeaderValuesTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/HeaderValuesTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HeaderValuesTag.java 2000/11/03 12:49:50 1.2
+++ HeaderValuesTag.java 2001/07/13 00:09:02 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/HeaderValuesTag.java,v 1.2 2000/11/03 12:49:50 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:49:50 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/HeaderValuesTag.java,v 1.3 2001/07/13 00:09:02 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:02 $
*
* ====================================================================
*
@@ -68,12 +68,12 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>headervaluess</b>, used to get HTTP header values for
+ * JSP Tag <b>headerValuess</b>, used to get HTTP header values for
* headers which can have multiple values such as Language
* using the standard JSP <jsp:getProperty> tag.
* <p>
* The script variable of name <b>id</b> is availble only within the
- * body of the <b>headervalues</b> tag.
+ * body of the <b>headerValues</b> tag.
* <p>
* Loops through all the header values for a header.
* <p>
@@ -81,7 +81,7 @@
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>headervalues</name>
+ * <name>headerValues</name>
* <tagclass>org.apache.taglibs.request.HeaderValuesTag</tagclass>
* <teiclass>org.apache.taglibs.request.HeaderValuesTEI</teiclass>
* <bodycontent>JSP</bodycontent>
@@ -140,7 +140,7 @@
}
/**
- * Method called at end of each headervalues tag.
+ * Method called at end of each headerValues tag.
*
* @return EVAL_BODY_TAG if there is another header value, or SKIP_BODY if there are no more header values
*/
@@ -163,6 +163,7 @@
*/
public final int doEndTag() throws JspException
{
+ pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
try
{
if(bodyContent != null)
@@ -186,12 +187,4 @@
return value;
}
- /**
- * Remove the script variable after headervalues tag closed out
- */
- public final void release()
- {
- if( id != null && id.length() > 0 )
- pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
- }
}
1.3 +5 -12 jakarta-taglibs/request/src/org/apache/taglibs/request/HeadersTag.java
Index: HeadersTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/HeadersTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HeadersTag.java 2000/11/03 12:50:12 1.2
+++ HeadersTag.java 2001/07/13 00:09:03 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/HeadersTag.java,v 1.2 2000/11/03 12:50:12 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:50:12 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/HeadersTag.java,v 1.3 2001/07/13 00:09:03 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:03 $
*
* ====================================================================
*
@@ -139,7 +139,7 @@
}
/**
- * Method called at end of each headers tag.
+ * Method called at end of each headers tag body.
*
* @return EVAL_BODY_TAG if there is another header, or SKIP_BODY if there are no more headers or this is a named header
*/
@@ -162,6 +162,7 @@
*/
public final int doEndTag() throws JspException
{
+ pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
try
{
if(bodyContent != null)
@@ -234,12 +235,4 @@
return "" + req.getIntHeader(header);
}
- /**
- * Remove the script variable after headers tag closed out
- */
- public final void release()
- {
- if( id != null && id.length() > 0 )
- pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
- }
}
1.3 +10 -13 jakarta-taglibs/request/src/org/apache/taglibs/request/IsSecureTag.java
Index: IsSecureTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSecureTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IsSecureTag.java 2000/11/03 12:50:34 1.2
+++ IsSecureTag.java 2001/07/13 00:09:03 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSecureTag.java,v 1.2 2000/11/03 12:50:34 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:50:34 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSecureTag.java,v 1.3 2001/07/13 00:09:03 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:03 $
*
* ====================================================================
*
@@ -95,7 +95,7 @@
public class IsSecureTag extends TagSupport
{
- private Boolean value = null;
+ private boolean value = true;
/**
* Tests condition of is secure HTTPS connection.
@@ -105,24 +105,21 @@
public final int doStartTag() throws JspException
{
boolean result = ((HttpServletRequest)pageContext.getRequest()).isSecure();
- if( value == null ) {
- if( result )
- return EVAL_BODY_INCLUDE;
- return SKIP_BODY;
- }
- if( value.booleanValue() == result )
+
+ if( value == result )
return EVAL_BODY_INCLUDE;
+
return SKIP_BODY;
}
/**
* Set the optional tag attribute <b>value</b> to true or false.
*
- * @param String true or false
+ * @param boolean true or false
*/
- public final void setValue(String str)
+ public final void setValue(boolean value)
{
- value = new Boolean(str);
+ this.value = value;
}
}
1.3 +10 -13 jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionFromCookieTag.java
Index: IsSessionFromCookieTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionFromCookieTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IsSessionFromCookieTag.java 2000/11/03 12:51:01 1.2
+++ IsSessionFromCookieTag.java 2001/07/13 00:09:04 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionFromCookieTag.java,v 1.2 2000/11/03 12:51:01 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:51:01 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionFromCookieTag.java,v 1.3 2001/07/13 00:09:04 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:04 $
*
* ====================================================================
*
@@ -95,7 +95,7 @@
public class IsSessionFromCookieTag extends TagSupport
{
- private Boolean value = null;
+ private boolean value = true;
/**
* Determines if session is from a cookie
@@ -105,24 +105,21 @@
public final int doStartTag() throws JspException
{
boolean result = ((HttpServletRequest)pageContext.getRequest()).isRequestedSessionIdFromCookie();
- if( value == null ) {
- if( result )
- return EVAL_BODY_INCLUDE;
- return SKIP_BODY;
- }
- if( value.booleanValue() == result )
+
+ if( value == result )
return EVAL_BODY_INCLUDE;
+
return SKIP_BODY;
}
/**
* Set the optional tag attribute <b>value</b> to true or false.
*
- * @param String true or false
+ * @param boolean true or false
*/
- public final void setValue(String str)
+ public final void setValue(boolean value)
{
- value = new Boolean(str);
+ this.value = value;
}
}
1.3 +10 -13 jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionFromURLTag.java
Index: IsSessionFromURLTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionFromURLTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IsSessionFromURLTag.java 2000/11/03 12:51:08 1.2
+++ IsSessionFromURLTag.java 2001/07/13 00:09:04 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionFromURLTag.java,v 1.2 2000/11/03 12:51:08 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:51:08 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionFromURLTag.java,v 1.3 2001/07/13 00:09:04 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:04 $
*
* ====================================================================
*
@@ -95,7 +95,7 @@
public class IsSessionFromURLTag extends TagSupport
{
- private Boolean value = null;
+ private boolean value = true;
/**
* Determines whether session is from URL encoding
@@ -105,24 +105,21 @@
public final int doStartTag() throws JspException
{
boolean result = ((HttpServletRequest)pageContext.getRequest()).isRequestedSessionIdFromURL();
- if( value == null ) {
- if( result )
- return EVAL_BODY_INCLUDE;
- return SKIP_BODY;
- }
- if( value.booleanValue() == result )
+
+ if( value == result )
return EVAL_BODY_INCLUDE;
+
return SKIP_BODY;
}
/**
* Set the optional tag attribute <b>value</b> to true or false.
*
- * @param String true or false
+ * @param boolean true or false
*/
- public final void setValue(String str)
+ public final void setValue(boolean value)
{
- value = new Boolean(str);
+ this.value = value;
}
}
1.3 +10 -13 jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionValidTag.java
Index: IsSessionValidTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionValidTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IsSessionValidTag.java 2000/11/03 12:51:16 1.2
+++ IsSessionValidTag.java 2001/07/13 00:09:05 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionValidTag.java,v 1.2 2000/11/03 12:51:16 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:51:16 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsSessionValidTag.java,v 1.3 2001/07/13 00:09:05 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:05 $
*
* ====================================================================
*
@@ -95,7 +95,7 @@
public class IsSessionValidTag extends TagSupport
{
- private Boolean value = null;
+ private boolean value = true;
/**
* Determines whether session is valid.
@@ -105,24 +105,21 @@
public final int doStartTag() throws JspException
{
boolean result = ((HttpServletRequest)pageContext.getRequest()).isRequestedSessionIdValid();
- if( value == null ) {
- if( result )
- return EVAL_BODY_INCLUDE;
- return SKIP_BODY;
- }
- if( value.booleanValue() == result )
+
+ if( value == result )
return EVAL_BODY_INCLUDE;
+
return SKIP_BODY;
}
/**
* Set the optional tag attribute <b>value</b> to true or false.
*
- * @param String true or false
+ * @param boolean true or false
*/
- public final void setValue(String str)
+ public final void setValue(boolean value)
{
- value = new Boolean(str);
+ this.value = value;
}
}
1.3 +10 -13 jakarta-taglibs/request/src/org/apache/taglibs/request/IsUserInRoleTag.java
Index: IsUserInRoleTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsUserInRoleTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IsUserInRoleTag.java 2000/11/03 12:51:27 1.2
+++ IsUserInRoleTag.java 2001/07/13 00:09:06 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsUserInRoleTag.java,v 1.2 2000/11/03 12:51:27 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:51:27 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/IsUserInRoleTag.java,v 1.3 2001/07/13 00:09:06 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:06 $
*
* ====================================================================
*
@@ -102,7 +102,7 @@
public class IsUserInRoleTag extends TagSupport
{
- private Boolean value = null;
+ private boolean value = true;
private String role = null;
/**
@@ -113,24 +113,21 @@
public final int doStartTag() throws JspException
{
boolean result = ((HttpServletRequest)pageContext.getRequest()).isUserInRole(role);
- if( value == null ) {
- if( result )
- return EVAL_BODY_INCLUDE;
- return SKIP_BODY;
- }
- if( value.booleanValue() == result )
+
+ if( value == result )
return EVAL_BODY_INCLUDE;
+
return SKIP_BODY;
}
/**
* Set the optional tag attribute <b>value</b> to true or false.
*
- * @param String true or false
+ * @param boolean true or false
*/
- public final void setValue(String str)
+ public final void setValue(boolean value)
{
- value = new Boolean(str);
+ this.value = value;
}
/**
1.3 +8 -15 jakarta-taglibs/request/src/org/apache/taglibs/request/ParameterValuesTag.java
Index: ParameterValuesTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ParameterValuesTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ParameterValuesTag.java 2000/11/03 12:51:51 1.2
+++ ParameterValuesTag.java 2001/07/13 00:09:06 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ParameterValuesTag.java,v 1.2 2000/11/03 12:51:51 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:51:51 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ParameterValuesTag.java,v 1.3 2001/07/13 00:09:06 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:06 $
*
* ====================================================================
*
@@ -68,12 +68,12 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>parametervaluess</b>, used to get HTTP parameter values for
+ * JSP Tag <b>parameterValues</b>, used to get HTTP parameter values for
* parameters which have multiple values
* using the standard JSP <jsp:getProperty> tag.
* <p>
* The script variable of name <b>id</b> is availble only within the
- * body of the <b>parametervalues</b> tag.
+ * body of the <b>parameterValues</b> tag.
* <p>
* Loops through all the parameter values for a parameter.
* <p>
@@ -81,7 +81,7 @@
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>parametervalues</name>
+ * <name>parameterValues</name>
* <tagclass>org.apache.taglibs.request.ParameterValuesTag</tagclass>
* <teiclass>org.apache.taglibs.request.ParameterValuesTEI</teiclass>
* <bodycontent>JSP</bodycontent>
@@ -136,7 +136,7 @@
}
/**
- * Method called at end of each parametervalues tag.
+ * Method called at end of each parameterValues tag.
*
* @return EVAL_BODY_TAG if there is another parameter value, or SKIP_BODY if there are no more parameter values
*/
@@ -159,6 +159,7 @@
*/
public final int doEndTag() throws JspException
{
+ pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
try
{
if(bodyContent != null)
@@ -182,12 +183,4 @@
return value;
}
- /**
- * Remove the script variable after parametervalues tag closed out
- */
- public final void release()
- {
- if( id != null && id.length() > 0 )
- pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
- }
}
1.3 +4 -11 jakarta-taglibs/request/src/org/apache/taglibs/request/ParametersTag.java
Index: ParametersTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ParametersTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ParametersTag.java 2000/11/03 12:52:07 1.2
+++ ParametersTag.java 2001/07/13 00:09:06 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ParametersTag.java,v 1.2 2000/11/03 12:52:07 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:52:07 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/ParametersTag.java,v 1.3 2001/07/13 00:09:06 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:06 $
*
* ====================================================================
*
@@ -160,6 +160,7 @@
*/
public final int doEndTag() throws JspException
{
+ pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
try
{
if(bodyContent != null)
@@ -208,12 +209,4 @@
return value;
}
- /**
- * Remove the script variable after parameters tag closed out
- */
- public final void release()
- {
- if( id != null && id.length() > 0 )
- pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
- }
}
1.3 +4 -11 jakarta-taglibs/request/src/org/apache/taglibs/request/QueryStringsTag.java
Index: QueryStringsTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/QueryStringsTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- QueryStringsTag.java 2000/11/03 12:54:03 1.2
+++ QueryStringsTag.java 2001/07/13 00:09:07 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/QueryStringsTag.java,v 1.2 2000/11/03 12:54:03 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/03 12:54:03 $
+ * $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/QueryStringsTag.java,v 1.3 2001/07/13 00:09:07 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/13 00:09:07 $
*
* ====================================================================
*
@@ -190,6 +190,7 @@
*/
public final int doEndTag() throws JspException
{
+ pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
try
{
if(bodyContent != null)
@@ -253,12 +254,4 @@
return query;
}
- /**
- * Remove the script variable after querystrings tag closed out
- */
- public final void release()
- {
- if( id != null && id.length() > 0 )
- pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
- }
}
1.1 jakarta-taglibs/request/src/org/apache/taglibs/request/EqualsAttributeTag.java
Index: EqualsAttributeTag.java
===================================================================
/*
* $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/EqualsAttributeTag.java,v 1.1 2001/07/13 00:08:59 glenn Exp $
* $Revision: 1.1 $
* $Date: 2001/07/13 00:08:59 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.request;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
/**
* JSP Tag <b>equalsAttribute</b>, used to determine if a Request
* attribute equals the value of the "match" tag attribute.
* <p>
* Includes the body of the tag if the attribute equals the value of the
* "match" tag attribute.
* <p>
* You can set the optional tag attribute <b>value</b> to <i>true</i> or
* <i>false</i>. The body of the tag is included if equalsAttribute matches
* the value.
* <p>
* You can set the optional tag attribute <b>ignoreCase</b> to <i>true</i> or
* <i>false</i>. If ignoreCase is set to true, then the comparison between the
* request attribute and the "match" tag attribute will <i>not</i> be
* case-sensitive.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
* <name>equalsAttribute</name>
* <tagclass>org.apache.taglibs.request.EqualsAttributeTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Includes the body of the tag if the request attribute equals the
* value of the "match" tag attribute.</info>
* <attribute>
* <name>name</name>
* <required>true</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* <attribute>
* <name>value</name>
* <required>false</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* <attribute>
* <name>match</name>
* <required>true</required>
* <rtexprvalue>true</rtexprvalue>
* </attribute>
* <attribute>
* <name>ignoreCase</name>
* <required>false</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* </pre>
*
* @author Glenn Nielsen
*/
public class EqualsAttributeTag extends TagSupport
{
private String name = null;
private String match = null;
//default behaviour is don't ignore case and execute body when tag contents
//equal value set by setMatch
private boolean ignoreCase = false;
private boolean value = true;
/**
* Includes the body of the tag if the request attribute equals the value set in the
* 'match' attribute.
*
* @return SKIP_BODY if equalsAttribute body content does not equal the value of
* the match attribute, EVAL_BODY_include if it does
*/
public final int doStartTag() throws JspException
{
//result is whether or not tag contents equal the match attribute
boolean result = false;
Object attribute = pageContext.getAttribute(name,PageContext.REQUEST_SCOPE);
if (attribute != null) {
String attributeValue = attribute.toString();
if (ignoreCase) {
result = attributeValue.equalsIgnoreCase(match);
} else {
result = attributeValue.equals(match);
}
}
if( value == result )
return EVAL_BODY_INCLUDE;
return SKIP_BODY;
}
/**
* Set the required tag attribute <b>name</b>.
*
* @param String name of request attribute
*/
public final void setName(String str)
{
name = str;
}
/**
* Set the String that will be compared to the request
* attribute.
*
* @param String value to match against the request attribute
*/
public final void setMatch(String str) {
match=str;
}
/**
* If ignoreCase is set to true, then the comparison
* between the "match" attribute and the
* request attribute will <i>not</i> be case sensitive
*
* @param boolean true = ignore case<BR>false = case sensitive<BR>
* default value = false
*/
public final void setIgnoreCase(boolean value) {
ignoreCase = value;
}
/**
* Set the optional tag attribute <b>value</b> to true or false.
*
* @param boolean true or false
*/
public final void setValue(boolean value)
{
this.value = value;
}
}
1.1 jakarta-taglibs/request/src/org/apache/taglibs/request/EqualsCookieTag.java
Index: EqualsCookieTag.java
===================================================================
/*
* $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/EqualsCookieTag.java,v 1.1 2001/07/13 00:08:59 glenn Exp $
* $Revision: 1.1 $
* $Date: 2001/07/13 00:08:59 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.request;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
/**
* JSP Tag <b>equalsCookie</b>, used to determine if a Request
* cookie equals the value of the "match" tag attribute.
* <p>
* Includes the body of the tag if the cookie equals the value of the
* "match" tag cookie.
* <p>
* You can set the optional tag cookie <b>value</b> to <i>true</i> or
* <i>false</i>. The body of the tag is included if equalsCookie matches
* the value.
* <p>
* You can set the optional tag cookie <b>ignoreCase</b> to <i>true</i> or
* <i>false</i>. If ignoreCase is set to true, then the comparison between the
* request cookie and the "match" tag attribute will <i>not</i> be
* case-sensitive.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
* <name>equalsCookie</name>
* <tagclass>org.apache.taglibs.request.EqualsCookieTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Includes the body of the tag if the request cookie equals the
* value of the "match" tag cookie.</info>
* <attribute>
* <name>name</name>
* <required>true</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* <attribute>
* <name>value</name>
* <required>false</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* <attribute>
* <name>match</name>
* <required>true</required>
* <rtexprvalue>true</rtexprvalue>
* </attribute>
* <attribute>
* <name>ignoreCase</name>
* <required>false</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* </pre>
*
* @author Glenn Nielsen
*/
public class EqualsCookieTag extends TagSupport
{
private String name = null;
private String match = null;
//default behaviour is don't ignore case and execute body when tag contents
//equal value set by setMatch
private boolean ignoreCase = false;
private boolean value = true;
/**
* Includes the body of the tag if the request cookie equals the value set in the
* 'match' cookie.
*
* @return SKIP_BODY if equalsCookie body content does not equal the value of
* the match cookie, EVAL_BODY_include if it does
*/
public final int doStartTag() throws JspException
{
//result is whether or not tag contents equal the match cookie
boolean result = false;
// Get the cookies
Cookie cookie = null;
Cookie [] cookies =
((HttpServletRequest)pageContext.getRequest()).getCookies();
if( cookies != null ) {
for( int i = 0; i < cookies.length; i++ ) {
if( cookies[i].getName().equals(name) ) {
cookie = cookies[i];
break;
}
}
}
if (cookie != null) {
if (ignoreCase) {
result = cookie.getValue().equalsIgnoreCase(match);
} else {
result = cookie.getValue().equals(match);
}
}
if( value == result )
return EVAL_BODY_INCLUDE;
return SKIP_BODY;
}
/**
* Set the required tag cookie <b>name</b>.
*
* @param String name of request cookie
*/
public final void setName(String str)
{
name = str;
}
/**
* Set the String that will be compared to the request
* cookie.
*
* @param String value to match against the request cookie
*/
public final void setMatch(String str) {
match=str;
}
/**
* If ignoreCase is set to true, then the comparison
* between the "match" attribute and the
* request cookie will <i>not</i> be case sensitive
*
* @param boolean true = ignore case<BR>false = case sensitive<BR>
* default value = false
*/
public final void setIgnoreCase(boolean value) {
ignoreCase = value;
}
/**
* Set the optional tag cookie <b>value</b> to true or false.
*
* @param boolean true or false
*/
public final void setValue(boolean value)
{
this.value = value;
}
}
1.1 jakarta-taglibs/request/src/org/apache/taglibs/request/EqualsHeaderTag.java
Index: EqualsHeaderTag.java
===================================================================
/*
* $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/EqualsHeaderTag.java,v 1.1 2001/07/13 00:08:59 glenn Exp $
* $Revision: 1.1 $
* $Date: 2001/07/13 00:08:59 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.request;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
/**
* JSP Tag <b>equalsHeader</b>, used to determine if a Request
* header equals the value of the "match" tag attribute.
* <p>
* Includes the body of the tag if the header equals the value of the
* "match" tag header.
* <p>
* You can set the optional tag header <b>value</b> to <i>true</i> or
* <i>false</i>. The body of the tag is included if equalsHeader matches
* the value.
* <p>
* You can set the optional tag header <b>ignoreCase</b> to <i>true</i> or
* <i>false</i>. If ignoreCase is set to true, then the comparison between the
* request header and the "match" tag attribute will <i>not</i> be
* case-sensitive.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
* <name>equalsHeader</name>
* <tagclass>org.apache.taglibs.request.EqualsHeaderTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Includes the body of the tag if the request header equals the
* value of the "match" tag header.</info>
* <header>
* <name>name</name>
* <required>true</required>
* <rtexprvalue>false</rtexprvalue>
* </header>
* <header>
* <name>value</name>
* <required>false</required>
* <rtexprvalue>false</rtexprvalue>
* </header>
* <header>
* <name>match</name>
* <required>true</required>
* <rtexprvalue>true</rtexprvalue>
* </header>
* <header>
* <name>ignoreCase</name>
* <required>false</required>
* <rtexprvalue>false</rtexprvalue>
* </header>
* </pre>
*
* @author Glenn Nielsen
*/
public class EqualsHeaderTag extends TagSupport
{
private String name = null;
private String match = null;
//default behaviour is don't ignore case and execute body when tag contents
//equal value set by setMatch
private boolean ignoreCase = false;
private boolean value = true;
/**
* Includes the body of the tag if the request header equals the value set in the
* 'match' header.
*
* @return SKIP_BODY if equalsHeader body content does not equal the value of
* the match header, EVAL_BODY_include if it does
*/
public final int doStartTag() throws JspException
{
//result is whether or not tag contents equal the match header
boolean result = false;
// Get the header value
String header = ((HttpServletRequest)pageContext.getRequest()).getHeader(name);
if (header != null) {
if (ignoreCase) {
result = header.equalsIgnoreCase(match);
} else {
result = header.equals(match);
}
}
if( value == result )
return EVAL_BODY_INCLUDE;
return SKIP_BODY;
}
/**
* Set the required tag header <b>name</b>.
*
* @param String name of request header
*/
public final void setName(String str)
{
name = str;
}
/**
* Set the String that will be compared to the request
* header.
*
* @param String value to match against the request header
*/
public final void setMatch(String str) {
match=str;
}
/**
* If ignoreCase is set to true, then the comparison
* between the "match" attribute and the
* request header will <i>not</i> be case sensitive
*
* @param boolean true = ignore case<BR>false = case sensitive<BR>
* default value = false
*/
public final void setIgnoreCase(boolean value) {
ignoreCase = value;
}
/**
* Set the optional tag header <b>value</b> to true or false.
*
* @param boolean true or false
*/
public final void setValue(boolean value)
{
this.value = value;
}
}
1.1 jakarta-taglibs/request/src/org/apache/taglibs/request/EqualsParameterTag.java
Index: EqualsParameterTag.java
===================================================================
/*
* $Header: /home/cvs/jakarta-taglibs/request/src/org/apache/taglibs/request/EqualsParameterTag.java,v 1.1 2001/07/13 00:08:59 glenn Exp $
* $Revision: 1.1 $
* $Date: 2001/07/13 00:08:59 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.request;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
/**
* JSP Tag <b>equalsParameter</b>, used to determine if a Request
* parameter equals the value of the "match" tag attribute.
* <p>
* Includes the body of the tag if the parameter equals the value of the
* "match" tag parameter.
* <p>
* You can set the optional tag parameter <b>value</b> to <i>true</i> or
* <i>false</i>. The body of the tag is included if equalsParameter matches
* the value.
* <p>
* You can set the optional tag parameter <b>ignoreCase</b> to <i>true</i> or
* <i>false</i>. If ignoreCase is set to true, then the comparison between the
* request parameter and the "match" tag attribute will <i>not</i> be
* case-sensitive.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
* <name>equalsParameter</name>
* <tagclass>org.apache.taglibs.request.EqualsParameterTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Includes the body of the tag if the request parameter equals the
* value of the "match" tag parameter.</info>
* <attribute>
* <name>name</name>
* <required>true</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* <attribute>
* <name>value</name>
* <required>false</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* <attribute>
* <name>match</name>
* <required>true</required>
* <rtexprvalue>true</rtexprvalue>
* </attribute>
* <attribute>
* <name>ignoreCase</name>
* <required>false</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* </pre>
*
* @author Glenn Nielsen
*/
public class EqualsParameterTag extends TagSupport
{
private String name = null;
private String match = null;
//default behaviour is don't ignore case and execute body when tag contents
//equal value set by setMatch
private boolean ignoreCase = false;
private boolean value = true;
/**
* Includes the body of the tag if the request parameter equals the value set in the
* 'match' parameter.
*
* @return SKIP_BODY if equalsParameter body content does not equal the value of
* the match parameter, EVAL_BODY_include if it does
*/
public final int doStartTag() throws JspException
{
//result is whether or not tag contents equal the match parameter
boolean result = false;
// Get the parameter
String param = ((HttpServletRequest)pageContext.getRequest()).getParameter(name);
if (param != null) {
if (ignoreCase) {
result = param.equalsIgnoreCase(match);
} else {
result = param.equals(match);
}
}
if( value == result )
return EVAL_BODY_INCLUDE;
return SKIP_BODY;
}
/**
* Set the required tag parameter <b>name</b>.
*
* @param String name of request parameter
*/
public final void setName(String str)
{
name = str;
}
/**
* Set the String that will be compared to the request
* parameter.
*
* @param String value to match against the request parameter
*/
public final void setMatch(String str) {
match=str;
}
/**
* If ignoreCase is set to true, then the comparison
* between the "match" attribute and the
* request parameter will <i>not</i> be case sensitive
*
* @param boolean true = ignore case<BR>false = case sensitive<BR>
* default value = false
*/
public final void setIgnoreCase(boolean value) {
ignoreCase = value;
}
/**
* Set the optional tag parameter <b>value</b> to true or false.
*
* @param boolean true or false
*/
public final void setValue(boolean value)
{
this.value = value;
}
}