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/15 18:21:28 UTC
cvs commit: jakarta-taglibs/response/src/org/apache/taglibs/response AddCookieTag.java AddDateHeaderTag.java AddHeaderTag.java AddIntHeaderTag.java ContainsHeaderTag.java CookieCommentTag.java CookieDomainTag.java CookieMaxAgeTag.java CookiePathTag.java CookieSecureTag.java CookieValueTag.java CookieVersionTag.java EncodeRedirectURLTag.java EncodeURLTag.java FlushBufferTag.java IsCommittedTag.java SendErrorTag.java SendRedirectTag.java SetContentTypeTag.java SetDateHeaderTag.java SetHeaderTag.java SetIntHeaderTag.java SetStatusTag.java SkipPageTag.java
glenn 01/07/15 09:21:28
Modified: response/src/org/apache/taglibs/response AddCookieTag.java
AddDateHeaderTag.java AddHeaderTag.java
AddIntHeaderTag.java ContainsHeaderTag.java
CookieCommentTag.java CookieDomainTag.java
CookieMaxAgeTag.java CookiePathTag.java
CookieSecureTag.java CookieValueTag.java
CookieVersionTag.java EncodeRedirectURLTag.java
EncodeURLTag.java FlushBufferTag.java
IsCommittedTag.java SendErrorTag.java
SendRedirectTag.java SetContentTypeTag.java
SetDateHeaderTag.java SetHeaderTag.java
SetIntHeaderTag.java SetStatusTag.java
SkipPageTag.java
Log:
Implement new tag design guidelines
Revision Changes Path
1.3 +20 -37 jakarta-taglibs/response/src/org/apache/taglibs/response/AddCookieTag.java
Index: AddCookieTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddCookieTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AddCookieTag.java 2000/11/11 15:48:31 1.2
+++ AddCookieTag.java 2001/07/15 16:21:22 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddCookieTag.java,v 1.2 2000/11/11 15:48:31 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:48:31 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddCookieTag.java,v 1.3 2001/07/15 16:21:22 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:22 $
*
* ====================================================================
*
@@ -67,18 +67,18 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>addcookie</b>, used to add a cookie to the Http Response.
+ * JSP Tag <b>addCookie</b>, used to add a cookie to the Http Response.
* <p>
* The script variable for the <b>name</b> of the cookie is required.
* <p>
* Cookie attributes such as the comment, value, etc. can be set
- * statically by using the corresponding addcookie tag attribute.
+ * statically by using the corresponding addCookie tag attribute.
* Or dynamically using the corresponding tag in the body of the
- * addcookie tag.
+ * addCookie tag.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>addcookie</name>
+ * <name>addCookie</name>
* <tagclass>org.apache.taglibs.response.AddCookieTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Add a cookie to an Http Response.</info>
@@ -103,7 +103,7 @@
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* <attribute>
- * <name>maxage</name>
+ * <name>maxAge</name>
* <required>false</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
@@ -134,15 +134,13 @@
private String value = null;
private String comment = null;
private String domain = null;
- private int maxage = 0;
- private boolean maxage_set = false;
+ private int maxAge = -1;
private String path = null;
private boolean secure = false;
private int version = 0;
- private boolean version_set = false;
/**
- * Method called at start of addcookie tag to create cookie
+ * Method called at start of addCookie tag to create cookie
*
* @return EVAL_BODY_INCLUDE
*/
@@ -167,12 +165,9 @@
cookie.setComment(comment);
if( domain != null )
cookie.setDomain(domain);
- if( maxage_set )
- cookie.setMaxAge(maxage);
- if( secure )
- cookie.setSecure(secure);
- if( version_set )
- cookie.setVersion(version);
+ cookie.setMaxAge(maxAge);
+ cookie.setSecure(secure);
+ cookie.setVersion(version);
// Add the cookie
((HttpServletResponse)pageContext.getResponse()).addCookie(cookie);
@@ -205,14 +200,9 @@
*
* @param String number of seconds
*/
- public final void setMaxage(String max) throws JspException
+ public final void setMaxAge(int max)
{
- try {
- maxage = Integer.valueOf(max).intValue();
- maxage_set = true;
- } catch(NumberFormatException e) {
- throw new JspException("Response tag addcookie maxage attribute value must be an integer.");
- }
+ maxAge = max;
}
/**
@@ -253,27 +243,20 @@
*
* @param String true or false
*/
- public final void setSecure(String flag)
+ public final void setSecure(boolean flag)
{
- if( flag.equals("true") ) {
- secure = true;
- }
+ secure = flag;
}
/**
* Optional attribute, sets the version of the cookie protocol
* this cookie complies with.
*
- * @param String version number
+ * @param int version number
*/
- public final void setVersion(String vers) throws JspException
+ public final void setVersion(int version)
{
- try {
- version = Integer.valueOf(vers).intValue();
- version_set = true;
- } catch(NumberFormatException e) {
- throw new JspException("Response tag addcookie version attribute value must be an integer.");
- }
+ this.version = version;
}
}
1.4 +9 -9 jakarta-taglibs/response/src/org/apache/taglibs/response/AddDateHeaderTag.java
Index: AddDateHeaderTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddDateHeaderTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AddDateHeaderTag.java 2000/11/11 15:48:39 1.3
+++ AddDateHeaderTag.java 2001/07/15 16:21:23 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddDateHeaderTag.java,v 1.3 2000/11/11 15:48:39 glenn Exp $
- * $Revision: 1.3 $
- * $Date: 2000/11/11 15:48:39 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddDateHeaderTag.java,v 1.4 2001/07/15 16:21:23 glenn Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/07/15 16:21:23 $
*
* ====================================================================
*
@@ -68,13 +68,13 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>adddateheader</b>, used to add a header for the HTTP Response.
+ * JSP Tag <b>addDateHeader</b>, used to add a header for the HTTP Response.
* <p>
- * The header value is set to the content of the body of the <b>adddateheader</b> tag.
+ * The header value is set to the content of the body of the <b>addDateHeader</b> tag.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>adddateheader</name>
+ * <name>addDateHeader</name>
* <tagclass>org.apache.taglibs.response.AddDateHeaderTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Add a single HTTP date header.</info>
@@ -103,7 +103,7 @@
}
/**
- * Read the body of the adddateheader tag to obtain the header value.
+ * Read the body of the addDateHeader tag to obtain the header value.
*
* @return SKIP_BODY
*/
@@ -111,7 +111,7 @@
{
// Use the body of the tag as header value
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the header
// value
body.clearBody();
@@ -120,7 +120,7 @@
try {
value = Long.valueOf(s).longValue();
} catch(NumberFormatException e) {
- throw new JspException("Response tag adddateheader: " +
+ throw new JspException("Response tag addDateHeader: " +
e.getMessage());
}
1.4 +8 -8 jakarta-taglibs/response/src/org/apache/taglibs/response/AddHeaderTag.java
Index: AddHeaderTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddHeaderTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AddHeaderTag.java 2000/11/11 15:48:46 1.3
+++ AddHeaderTag.java 2001/07/15 16:21:23 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddHeaderTag.java,v 1.3 2000/11/11 15:48:46 glenn Exp $
- * $Revision: 1.3 $
- * $Date: 2000/11/11 15:48:46 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddHeaderTag.java,v 1.4 2001/07/15 16:21:23 glenn Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/07/15 16:21:23 $
*
* ====================================================================
*
@@ -68,13 +68,13 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>addheader</b>, used to add a header for the HTTP Response.
+ * JSP Tag <b>addHeader</b>, used to add a header for the HTTP Response.
* <p>
- * The header value is set to the content of the body of the <b>addheader</b> tag.
+ * The header value is set to the content of the body of the <b>addHeader</b> tag.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>addheader</name>
+ * <name>addHeader</name>
* <tagclass>org.apache.taglibs.response.AddHeaderTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Add a single HTTP header.</info>
@@ -103,7 +103,7 @@
}
/**
- * Read the body of the addheader tag to obtain the header value.
+ * Read the body of the addHeader tag to obtain the header value.
*
* @return SKIP_BODY
*/
@@ -111,7 +111,7 @@
{
// Use the body of the tag as header value
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the header
// value
body.clearBody();
1.4 +9 -9 jakarta-taglibs/response/src/org/apache/taglibs/response/AddIntHeaderTag.java
Index: AddIntHeaderTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddIntHeaderTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AddIntHeaderTag.java 2000/11/11 15:48:52 1.3
+++ AddIntHeaderTag.java 2001/07/15 16:21:23 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddIntHeaderTag.java,v 1.3 2000/11/11 15:48:52 glenn Exp $
- * $Revision: 1.3 $
- * $Date: 2000/11/11 15:48:52 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/AddIntHeaderTag.java,v 1.4 2001/07/15 16:21:23 glenn Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/07/15 16:21:23 $
*
* ====================================================================
*
@@ -68,13 +68,13 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>addintheader</b>, used to add a header for the HTTP Response.
+ * JSP Tag <b>addIntHeader</b>, used to add a header for the HTTP Response.
* <p>
- * The header value is set to the content of the body of the <b>addintheader</b> tag.
+ * The header value is set to the content of the body of the <b>addIntHeader</b> tag.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>addintheader</name>
+ * <name>addIntHeader</name>
* <tagclass>org.apache.taglibs.response.AddIntHeaderTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Add a single HTTP integer header.</info>
@@ -103,7 +103,7 @@
}
/**
- * Read the body of the addintheader tag to obtain the header value.
+ * Read the body of the addIntHeader tag to obtain the header value.
*
* @return SKIP_BODY
*/
@@ -111,7 +111,7 @@
{
// Use the body of the tag as header value
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the header
// value
body.clearBody();
@@ -120,7 +120,7 @@
try {
value = Integer.valueOf(s).intValue();
} catch(NumberFormatException e) {
- throw new JspException("Response tag addintheader: " +
+ throw new JspException("Response tag addIntHeader: " +
e.getMessage());
}
1.3 +14 -17 jakarta-taglibs/response/src/org/apache/taglibs/response/ContainsHeaderTag.java
Index: ContainsHeaderTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/ContainsHeaderTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ContainsHeaderTag.java 2000/11/11 15:48:59 1.2
+++ ContainsHeaderTag.java 2001/07/15 16:21:23 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/ContainsHeaderTag.java,v 1.2 2000/11/11 15:48:59 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:48:59 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/ContainsHeaderTag.java,v 1.3 2001/07/15 16:21:23 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:23 $
*
* ====================================================================
*
@@ -68,18 +68,18 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>containsheader</b>, used to determine if the Http Response
+ * JSP Tag <b>containsHeader</b>, used to determine if the Http Response
* contains the header named <b>name</b>.
* <p>
* Includes the body of the tag if the header exists.
* <p>
* You can set the optional tag attribute <b>value</b> to <b>true</b> or
- * <b>false</b>. The body of the tag is included if containsheader matches
+ * <b>false</b>. The body of the tag is included if containsHeader matches
* the value.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>containsheader</name>
+ * <name>containsHeader</name>
* <tagclass>org.apache.taglibs.response.ContainsHeaderTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Test whether the HTTP Response contains a header.</info>
@@ -101,35 +101,32 @@
public class ContainsHeaderTag extends TagSupport
{
private String name = null;
- private Boolean value = null;
+ private boolean value = true;
/**
* Used to test whether the HTTP Response contains a header.
*
- * @return SKIP_BODY if containsheader doesn't match value, EVAL_BODY_INCLUDE if containsheader matches value
+ * @return SKIP_BODY if containsHeader doesn't match value, EVAL_BODY_INCLUDE if containsHeader matches value
*/
public final int doStartTag() throws JspException
{
boolean result =
((HttpServletResponse)pageContext.getResponse()).containsHeader(name);
- 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 +7 -7 jakarta-taglibs/response/src/org/apache/taglibs/response/CookieCommentTag.java
Index: CookieCommentTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieCommentTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CookieCommentTag.java 2000/11/11 15:49:09 1.2
+++ CookieCommentTag.java 2001/07/15 16:21:23 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieCommentTag.java,v 1.2 2000/11/11 15:49:09 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:49:09 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieCommentTag.java,v 1.3 2001/07/15 16:21:23 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:23 $
*
* ====================================================================
*
@@ -70,7 +70,7 @@
/**
* JSP Tag <b>comment</b>, used to set the comment of a cookie.
* <p>
- * Must be nested within an <b>addcookie</b> tag.
+ * Must be nested within an <b>addCookie</b> tag.
* <p>
* The cookie comment is set to the content of the body of the <b>comment</b> tag.
* <p>
@@ -107,18 +107,18 @@
{
// Use the body of the tag as cookie comment
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the cookie
// comment
body.clearBody();
- // Get the parent addcookie tag
+ // Get the parent addCookie tag
AddCookieTag ac = null;
try {
ac = (AddCookieTag)this.findAncestorWithClass(this,
Class.forName("org.apache.taglibs.response.AddCookieTag"));
} catch(Exception e) {
- throw new JspException("Response comment tag must be nested inside an addcookie tag.");
+ throw new JspException("Response comment tag must be nested inside an addCookie tag.");
}
// set the cookie comment
1.3 +7 -7 jakarta-taglibs/response/src/org/apache/taglibs/response/CookieDomainTag.java
Index: CookieDomainTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieDomainTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CookieDomainTag.java 2000/11/11 15:49:22 1.2
+++ CookieDomainTag.java 2001/07/15 16:21:23 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieDomainTag.java,v 1.2 2000/11/11 15:49:22 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:49:22 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieDomainTag.java,v 1.3 2001/07/15 16:21:23 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:23 $
*
* ====================================================================
*
@@ -70,7 +70,7 @@
/**
* JSP Tag <b>domain</b>, used to set the domain of a cookie.
* <p>
- * Must be nested within an <b>addcookie</b> tag.
+ * Must be nested within an <b>addCookie</b> tag.
* <p>
* The cookie domain is set to the content of the body of the <b>domain</b> tag.
* <p>
@@ -107,18 +107,18 @@
{
// Use the body of the tag as cookie domain
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the cookie
// domain
body.clearBody();
- // Get the parent addcookie tag
+ // Get the parent addCookie tag
AddCookieTag ac = null;
try {
ac = (AddCookieTag)this.findAncestorWithClass(this,
Class.forName("org.apache.taglibs.response.AddCookieTag"));
} catch(Exception e) {
- throw new JspException("Response domain tag must be nested inside an addcookie tag.");
+ throw new JspException("Response domain tag must be nested inside an addCookie tag.");
}
// set the cookie domain
1.4 +23 -16 jakarta-taglibs/response/src/org/apache/taglibs/response/CookieMaxAgeTag.java
Index: CookieMaxAgeTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieMaxAgeTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CookieMaxAgeTag.java 2000/11/11 15:49:29 1.3
+++ CookieMaxAgeTag.java 2001/07/15 16:21:23 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieMaxAgeTag.java,v 1.3 2000/11/11 15:49:29 glenn Exp $
- * $Revision: 1.3 $
- * $Date: 2000/11/11 15:49:29 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieMaxAgeTag.java,v 1.4 2001/07/15 16:21:23 glenn Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/07/15 16:21:23 $
*
* ====================================================================
*
@@ -68,18 +68,18 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>maxage</b>, used to set the maxage of a cookie.
+ * JSP Tag <b>maxAge</b>, used to set the maxAge of a cookie.
* <p>
- * Must be nested within an <b>addcookie</b> tag.
+ * Must be nested within an <b>addCookie</b> tag.
* <p>
- * The cookie maxage is set to the content of the body of the <b>maxage</b> tag.
+ * The cookie maxAge is set to the content of the body of the <b>maxAge</b> tag.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>maxage</name>
+ * <name>maxAge</name>
* <tagclass>org.apache.taglibs.response.CookieMaxAgeTag</tagclass>
* <bodycontent>JSP</bodycontent>
- * <info>Set a cookie maxage.</info>
+ * <info>Set a cookie maxAge.</info>
* </pre>
*
* @author Glenn Nielsen
@@ -99,30 +99,37 @@
}
/**
- * Read the body of the maxage tag to obtain the cookie maxage.
+ * Read the body of the maxAge tag to obtain the cookie maxAge.
*
* @return SKIP_BODY
*/
public final int doAfterBody() throws JspException
{
- // Use the body of the tag as cookie maxage
+ // Use the body of the tag as cookie maxAge
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the cookie
- // maxage
+ // maxAge
body.clearBody();
- // Get the parent addcookie tag
+ // Get the parent addCookie tag
AddCookieTag ac = null;
try {
ac = (AddCookieTag)this.findAncestorWithClass(this,
Class.forName("org.apache.taglibs.response.AddCookieTag"));
} catch(Exception e) {
- throw new JspException("Response maxage tag must be nested inside an addcookie tag.");
+ throw new JspException("Response maxAge tag must be nested inside an addCookie tag.");
}
- // set the cookie maxage
- ac.setMaxage(s);
+ int maxage = 0;
+ try {
+ maxage = Integer.valueOf(s).intValue();
+ } catch(NumberFormatException e) {
+ throw new JspException("Response tag maxAge value must be an integer.");
+ }
+
+ // set the cookie maxAge
+ ac.setMaxAge(maxage);
return SKIP_BODY;
}
1.3 +7 -7 jakarta-taglibs/response/src/org/apache/taglibs/response/CookiePathTag.java
Index: CookiePathTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookiePathTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CookiePathTag.java 2000/11/11 15:49:35 1.2
+++ CookiePathTag.java 2001/07/15 16:21:23 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookiePathTag.java,v 1.2 2000/11/11 15:49:35 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:49:35 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookiePathTag.java,v 1.3 2001/07/15 16:21:23 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:23 $
*
* ====================================================================
*
@@ -70,7 +70,7 @@
/**
* JSP Tag <b>path</b>, used to set the path of a cookie.
* <p>
- * Must be nested within an <b>addcookie</b> tag.
+ * Must be nested within an <b>addCookie</b> tag.
* <p>
* The cookie path is set to the content of the body of the <b>path</b> tag.
* <p>
@@ -107,18 +107,18 @@
{
// Use the body of the tag as cookie path
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the cookie
// path
body.clearBody();
- // Get the parent addcookie tag
+ // Get the parent addCookie tag
AddCookieTag ac = null;
try {
ac = (AddCookieTag)this.findAncestorWithClass(this,
Class.forName("org.apache.taglibs.response.AddCookieTag"));
} catch(Exception e) {
- throw new JspException("Response path tag must be nested inside an addcookie tag.");
+ throw new JspException("Response path tag must be nested inside an addCookie tag.");
}
// set the cookie path
1.3 +7 -7 jakarta-taglibs/response/src/org/apache/taglibs/response/CookieSecureTag.java
Index: CookieSecureTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieSecureTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CookieSecureTag.java 2000/11/11 15:49:41 1.2
+++ CookieSecureTag.java 2001/07/15 16:21:24 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieSecureTag.java,v 1.2 2000/11/11 15:49:41 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:49:41 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieSecureTag.java,v 1.3 2001/07/15 16:21:24 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:24 $
*
* ====================================================================
*
@@ -70,7 +70,7 @@
/**
* JSP Tag <b>secure</b>, used to set the secure of a cookie.
* <p>
- * Must be nested within an <b>addcookie</b> tag.
+ * Must be nested within an <b>addCookie</b> tag.
* <p>
* The cookie secure is set to the content of the body of the <b>secure</b> tag.
* <p>
@@ -112,17 +112,17 @@
// secure
body.clearBody();
- // Get the parent addcookie tag
+ // Get the parent addCookie tag
AddCookieTag ac = null;
try {
ac = (AddCookieTag)this.findAncestorWithClass(this,
Class.forName("org.apache.taglibs.response.AddCookieTag"));
} catch(Exception e) {
- throw new JspException("Response secure tag must be nested inside an addcookie tag.");
+ throw new JspException("Response secure tag must be nested inside an addCookie tag.");
}
// set the cookie secure
- ac.setSecure(s);
+ ac.setSecure(Boolean.valueOf(s).booleanValue());
return SKIP_BODY;
}
1.3 +7 -7 jakarta-taglibs/response/src/org/apache/taglibs/response/CookieValueTag.java
Index: CookieValueTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieValueTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CookieValueTag.java 2000/11/11 15:49:47 1.2
+++ CookieValueTag.java 2001/07/15 16:21:24 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieValueTag.java,v 1.2 2000/11/11 15:49:47 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:49:47 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieValueTag.java,v 1.3 2001/07/15 16:21:24 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:24 $
*
* ====================================================================
*
@@ -70,7 +70,7 @@
/**
* JSP Tag <b>value</b>, used to set the value of a cookie.
* <p>
- * Must be nested within an <b>addcookie</b> tag.
+ * Must be nested within an <b>addCookie</b> tag.
* <p>
* The cookie value is set to the content of the body of the <b>value</b> tag.
* <p>
@@ -107,18 +107,18 @@
{
// Use the body of the tag as cookie value
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the cookie
// value
body.clearBody();
- // Get the parent addcookie tag
+ // Get the parent addCookie tag
AddCookieTag ac = null;
try {
ac = (AddCookieTag)this.findAncestorWithClass(this,
Class.forName("org.apache.taglibs.response.AddCookieTag"));
} catch(Exception e) {
- throw new JspException("Response value tag must be nested inside an addcookie tag.");
+ throw new JspException("Response value tag must be nested inside an addCookie tag.");
}
// set the cookie value
1.3 +15 -8 jakarta-taglibs/response/src/org/apache/taglibs/response/CookieVersionTag.java
Index: CookieVersionTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieVersionTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CookieVersionTag.java 2000/11/11 15:49:56 1.2
+++ CookieVersionTag.java 2001/07/15 16:21:24 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieVersionTag.java,v 1.2 2000/11/11 15:49:56 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:49:56 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/CookieVersionTag.java,v 1.3 2001/07/15 16:21:24 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:24 $
*
* ====================================================================
*
@@ -70,7 +70,7 @@
/**
* JSP Tag <b>version</b>, used to set the version of a cookie.
* <p>
- * Must be nested within an <b>addcookie</b> tag.
+ * Must be nested within an <b>addCookie</b> tag.
* <p>
* The cookie version is set to the content of the body of the <b>version</b> tag.
* <p>
@@ -107,22 +107,29 @@
{
// Use the body of the tag as cookie version
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the cookie
// version
body.clearBody();
- // Get the parent addcookie tag
+ // Get the parent addCookie tag
AddCookieTag ac = null;
try {
ac = (AddCookieTag)this.findAncestorWithClass(this,
Class.forName("org.apache.taglibs.response.AddCookieTag"));
} catch(Exception e) {
- throw new JspException("Response version tag must be nested inside an addcookie tag.");
+ throw new JspException("Response version tag must be nested inside an addCookie tag.");
}
+ int version = 0;
+ try {
+ version = Integer.valueOf(s).intValue();
+ } catch(NumberFormatException e) {
+ throw new JspException("Response tag version value must be an integer.");
+ }
+
// set the cookie version
- ac.setVersion(s);
+ ac.setVersion(version);
return SKIP_BODY;
}
1.3 +8 -8 jakarta-taglibs/response/src/org/apache/taglibs/response/EncodeRedirectURLTag.java
Index: EncodeRedirectURLTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/EncodeRedirectURLTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- EncodeRedirectURLTag.java 2000/11/11 15:50:10 1.2
+++ EncodeRedirectURLTag.java 2001/07/15 16:21:24 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/EncodeRedirectURLTag.java,v 1.2 2000/11/11 15:50:10 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:50:10 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/EncodeRedirectURLTag.java,v 1.3 2001/07/15 16:21:24 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:24 $
*
* ====================================================================
*
@@ -68,15 +68,15 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>encoderedirecturl</b>, used to encode a URL with the session id
+ * JSP Tag <b>encodeRedirectUrl</b>, used to encode a URL with the session id
* if necessary.
* <p>
- * The <b>encoderedirecturl</b> tag gets the URL to encode from the body of the tag,
+ * The <b>encodeRedirectUrl</b> tag gets the URL to encode from the body of the tag,
* and outputs it after encoding it.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>encoderedirecturl</name>
+ * <name>encodeRedirectUrl</name>
* <tagclass>org.apache.taglibs.response.EncodeRedirectURLTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Encode a URL with the JSESSIONID for use with sendredirect.</info>
@@ -100,7 +100,7 @@
}
/**
- * Read the body of the encoderedirecturl tag to obtain the URL to encode,
+ * Read the body of the encodeRedirectUrl tag to obtain the URL to encode,
* then encode the URL and output it back to the page.
*
* @return SKIP_BODY
@@ -109,7 +109,7 @@
{
// Use the body of the tag as header value
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the header
// value
body.clearBody();
1.3 +8 -8 jakarta-taglibs/response/src/org/apache/taglibs/response/EncodeURLTag.java
Index: EncodeURLTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/EncodeURLTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- EncodeURLTag.java 2000/11/11 15:50:18 1.2
+++ EncodeURLTag.java 2001/07/15 16:21:24 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/EncodeURLTag.java,v 1.2 2000/11/11 15:50:18 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:50:18 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/EncodeURLTag.java,v 1.3 2001/07/15 16:21:24 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:24 $
*
* ====================================================================
*
@@ -68,15 +68,15 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>encodeurl</b>, used to encode a URL with the session id
+ * JSP Tag <b>encodeUrl</b>, used to encode a URL with the session id
* if necessary.
* <p>
- * The <b>encodeurl</b> tag gets the URL to encode from the body of the tag,
+ * The <b>encodeUrl</b> tag gets the URL to encode from the body of the tag,
* and outputs it after encoding it.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>encodeurl</name>
+ * <name>encodeUrl</name>
* <tagclass>org.apache.taglibs.response.EncodeURLTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Encode a URL with the JSESSIONID if necessary.</info>
@@ -100,7 +100,7 @@
}
/**
- * Read the body of the encodeurl tag to obtain the URL to encode,
+ * Read the body of the encodeUrl tag to obtain the URL to encode,
* then encode the URL and output it back to the page.
*
* @return SKIP_BODY
@@ -109,7 +109,7 @@
{
// Use the body of the tag as header value
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the header
// value
body.clearBody();
1.3 +6 -6 jakarta-taglibs/response/src/org/apache/taglibs/response/FlushBufferTag.java
Index: FlushBufferTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/FlushBufferTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FlushBufferTag.java 2000/11/11 15:50:26 1.2
+++ FlushBufferTag.java 2001/07/15 16:21:24 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/FlushBufferTag.java,v 1.2 2000/11/11 15:50:26 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:50:26 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/FlushBufferTag.java,v 1.3 2001/07/15 16:21:24 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:24 $
*
* ====================================================================
*
@@ -69,11 +69,11 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>flushbuffer</b>, used to flush the output buffer to the client.
+ * JSP Tag <b>flushBuffer</b>, used to flush the output buffer to the client.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>flushbuffer</name>
+ * <name>flushBuffer</name>
* <tagclass>org.apache.taglibs.response.FlushBufferTag</tagclass>
* <bodycontent>empty</bodycontent>
* <info>Forces any content in the buffer to be written to the client.</info>
@@ -95,7 +95,7 @@
try {
pageContext.getResponse().flushBuffer();
} catch(IOException e) {
- throw new JspException("Response flushbuffer tag failed: " +
+ throw new JspException("Response flushBuffer tag failed: " +
e.getMessage());
}
return EVAL_PAGE;
1.3 +14 -17 jakarta-taglibs/response/src/org/apache/taglibs/response/IsCommittedTag.java
Index: IsCommittedTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/IsCommittedTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IsCommittedTag.java 2000/11/11 15:50:35 1.2
+++ IsCommittedTag.java 2001/07/15 16:21:24 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/IsCommittedTag.java,v 1.2 2000/11/11 15:50:35 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:50:35 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/IsCommittedTag.java,v 1.3 2001/07/15 16:21:24 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:24 $
*
* ====================================================================
*
@@ -68,18 +68,18 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>iscommitted</b>, used to determine if the Http Response
+ * JSP Tag <b>isCommitted</b>, used to determine if the Http Response
* contains the header named <b>name</b>.
* <p>
* Includes the body of the tag if the header exists.
* <p>
* You can set the optional tag attribute <b>value</b> to <b>true</b> or
- * <b>false</b>. The body of the tag is included if iscommitted matches
+ * <b>false</b>. The body of the tag is included if isCommitted matches
* the value.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>iscommitted</name>
+ * <name>isCommitted</name>
* <tagclass>org.apache.taglibs.response.IsCommittedTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Tests whether the HTTP Response has been committed to the client.</info>
@@ -95,34 +95,31 @@
public class IsCommittedTag extends TagSupport
{
- private Boolean value = null;
+ private boolean value = true;
/**
* Tests whether the HTTP Response has been committed to the client.
*
- * @return SKIP_BODY if iscommitted doesn't match value, EVAL_BODY_INCLUDE if iscommitted matches value
+ * @return SKIP_BODY if isCommitted doesn't match value, EVAL_BODY_INCLUDE if isCommitted matches value
*/
public final int doStartTag() throws JspException
{
boolean result = pageContext.getResponse().isCommitted();
- 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 +31 -30 jakarta-taglibs/response/src/org/apache/taglibs/response/SendErrorTag.java
Index: SendErrorTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SendErrorTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SendErrorTag.java 2000/11/11 15:50:43 1.2
+++ SendErrorTag.java 2001/07/15 16:21:24 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SendErrorTag.java,v 1.2 2000/11/11 15:50:43 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:50:43 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SendErrorTag.java,v 1.3 2001/07/15 16:21:24 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:24 $
*
* ====================================================================
*
@@ -71,9 +71,9 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>senderror</b>, used to send error as the HTTP Response.
+ * JSP Tag <b>sendError</b>, used to send error as the HTTP Response.
* <p>
- * The <b>senderror</b> tag can use an optional error message that it
+ * The <b>sendError</b> tag can use an optional error message that it
* gets from the body of the tag.
* <p>
* The required attribute <b>error</b> must be set to an HTTP error
@@ -84,7 +84,7 @@
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>senderror</name>
+ * <name>sendError</name>
* <tagclass>org.apache.taglibs.response.SendErrorTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Return an HTTP error as the HTTP Response.</info>
@@ -105,7 +105,7 @@
public class SendErrorTag extends BodyTagSupport
{
- private int error = 0;
+ private String error;
private boolean reset = false;
/**
@@ -119,15 +119,16 @@
}
/**
- * Read the body of the senderror tag to obtain the error message.
+ * Read the body of the sendError tag to obtain the error message.
*
* @return SKIP_BODY
*/
public final int doAfterBody() throws JspException
{
// Use the body of the tag as header value
+ int error_code = 0;
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the header
// value
body.clearBody();
@@ -136,16 +137,28 @@
pageContext.getResponse().reset();
try {
+ HttpServletResponse resp = null;
+ Field ec = null;
+ resp = (HttpServletResponse)pageContext.getResponse();
+ Class rc = resp.getClass();
+ ec = rc.getField(error);
+ error_code = ec.getInt(resp);
+ } catch(Exception e) {
+ throw new JspException(
+ "Response sendError tag could not find error code: " + error);
+ }
+
+ try {
if( s.length() > 0 )
- ((HttpServletResponse)pageContext.getResponse()).sendError(error,s);
+ ((HttpServletResponse)pageContext.getResponse()).sendError(error_code,s);
else
- ((HttpServletResponse)pageContext.getResponse()).sendError(error);
+ ((HttpServletResponse)pageContext.getResponse()).sendError(error_code);
} catch(IOException e) {
throw new JspException(
- "Response senderror tag failed: " + e.getMessage());
+ "Response sendError tag failed: " + e.getMessage());
} catch(IllegalStateException e) {
throw new JspException(
- "Response senderror tag failed " + e.getMessage());
+ "Response sendError tag failed " + e.getMessage());
}
return SKIP_BODY;
@@ -171,31 +184,19 @@
*
* @param String error code, i.e. <b>SC_UNATHORIZED</b>
*/
- public final void setError(String err) throws JspException
+ public final void setError(String err)
{
- HttpServletResponse resp = null;
- Field ec = null;
-
- try {
- resp = (HttpServletResponse)pageContext.getResponse();
- Class rc = resp.getClass();
- ec = rc.getField(err);
- error = ec.getInt(resp);
- } catch(Exception e) {
- throw new JspException(
- "Response senderror tag could not find error code: " + err);
- }
+ error = err;
}
/**
* Optional attribute that flags whether the buffer, headers,
* and status code should be reset.
*
- * @param String <b>true</b> or <b>false</b>
+ * @param boolean <b>true</b> or <b>false</b>
*/
- public final void setReset(String res)
+ public final void setReset(boolean reset)
{
- if( res.equals("true") )
- reset = true;
+ this.reset = reset;
}
}
1.3 +10 -10 jakarta-taglibs/response/src/org/apache/taglibs/response/SendRedirectTag.java
Index: SendRedirectTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SendRedirectTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SendRedirectTag.java 2000/11/11 15:50:50 1.2
+++ SendRedirectTag.java 2001/07/15 16:21:25 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SendRedirectTag.java,v 1.2 2000/11/11 15:50:50 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:50:50 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SendRedirectTag.java,v 1.3 2001/07/15 16:21:25 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:25 $
*
* ====================================================================
*
@@ -69,15 +69,15 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>sendredirect</b>, used to send a redirect to a URL
+ * JSP Tag <b>sendRedirect</b>, used to send a redirect to a URL
* as the HTTP Response.
* <p>
- * The <b>sendredirect</b> tag gets the URL to redirect to from the body
+ * The <b>sendRedirect</b> tag gets the URL to redirect to from the body
* of the tag.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>sendredirect</name>
+ * <name>sendRedirect</name>
* <tagclass>org.apache.taglibs.response.SendRedirectTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Send a redirect to a URL as the HTTP Response.</info>
@@ -100,7 +100,7 @@
}
/**
- * Read the body of the sendredirect tag to obtain the URL to redirect to.
+ * Read the body of the sendRedirect tag to obtain the URL to redirect to.
*
* @return SKIP_BODY
*/
@@ -108,7 +108,7 @@
{
// Use the body of the tag as URL to redirect to
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the URL
// value
body.clearBody();
@@ -117,11 +117,11 @@
((HttpServletResponse)pageContext.getResponse()).sendRedirect(s);
} catch(IOException e) {
throw new JspException(
- "Response sendredirect tag could not return the redirect: " +
+ "Response sendRedirect tag could not return the redirect: " +
e.getMessage());
} catch(IllegalStateException e) {
throw new JspException(
- "Response sendredirect tag could not return the redirect: " +
+ "Response sendRedirect tag could not return the redirect: " +
e.getMessage());
}
1.3 +8 -8 jakarta-taglibs/response/src/org/apache/taglibs/response/SetContentTypeTag.java
Index: SetContentTypeTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetContentTypeTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SetContentTypeTag.java 2000/11/11 15:51:00 1.2
+++ SetContentTypeTag.java 2001/07/15 16:21:25 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetContentTypeTag.java,v 1.2 2000/11/11 15:51:00 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:51:00 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetContentTypeTag.java,v 1.3 2001/07/15 16:21:25 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:25 $
*
* ====================================================================
*
@@ -68,14 +68,14 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>setcontenttype</b>, used to set the content type for an
+ * JSP Tag <b>setContentType</b>, used to set the content type for an
* HTTP Response.
* <p>
- * The content type is set to the content of the body of the <b>setcontenttype</b> tag.
+ * The content type is set to the content of the body of the <b>setContentType</b> tag.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>setcontenttype</name>
+ * <name>setContentType</name>
* <tagclass>org.apache.taglibs.response.SetContentTypeTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Sets the content type of the response being sent to the client.</info>
@@ -98,7 +98,7 @@
}
/**
- * Read the body of the setcontenttype tag to obtain the content type.
+ * Read the body of the setContentType tag to obtain the content type.
*
* @return SKIP_BODY
*/
@@ -106,7 +106,7 @@
{
// Use the body of the tag as content type
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the
// content type
body.clearBody();
1.3 +9 -9 jakarta-taglibs/response/src/org/apache/taglibs/response/SetDateHeaderTag.java
Index: SetDateHeaderTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetDateHeaderTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SetDateHeaderTag.java 2000/11/11 15:51:08 1.2
+++ SetDateHeaderTag.java 2001/07/15 16:21:25 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetDateHeaderTag.java,v 1.2 2000/11/11 15:51:08 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:51:08 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetDateHeaderTag.java,v 1.3 2001/07/15 16:21:25 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:25 $
*
* ====================================================================
*
@@ -68,13 +68,13 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>setdateheader</b>, used to add a header for the HTTP Response.
+ * JSP Tag <b>setDateHeader</b>, used to add a header for the HTTP Response.
* <p>
- * The header value is set to the content of the body of the <b>setdateheader</b> tag.
+ * The header value is set to the content of the body of the <b>setDateHeader</b> tag.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>setdateheader</name>
+ * <name>setDateHeader</name>
* <tagclass>org.apache.taglibs.response.SetDateHeaderTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Set a single HTTP date header.</info>
@@ -98,7 +98,7 @@
}
/**
- * Read the body of the setdateheader tag to obtain the header value.
+ * Read the body of the setDateHeader tag to obtain the header value.
*
* @return SKIP_BODY
*/
@@ -106,7 +106,7 @@
{
// Use the body of the tag as header value
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the header
// value
body.clearBody();
@@ -115,7 +115,7 @@
try {
value = Long.valueOf(s).longValue();
} catch(NumberFormatException e) {
- throw new JspException("Response tag setdateheader: " +
+ throw new JspException("Response tag setDateHeader: " +
e.getMessage());
}
1.3 +8 -8 jakarta-taglibs/response/src/org/apache/taglibs/response/SetHeaderTag.java
Index: SetHeaderTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetHeaderTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SetHeaderTag.java 2000/11/11 15:51:16 1.2
+++ SetHeaderTag.java 2001/07/15 16:21:25 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetHeaderTag.java,v 1.2 2000/11/11 15:51:16 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:51:16 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetHeaderTag.java,v 1.3 2001/07/15 16:21:25 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:25 $
*
* ====================================================================
*
@@ -68,13 +68,13 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>setheader</b>, used to set a header for the HTTP Response.
+ * JSP Tag <b>setHeader</b>, used to set a header for the HTTP Response.
* <p>
- * The header value is set to the content of the body of the <b>setheader</b> tag.
+ * The header value is set to the content of the body of the <b>setHeader</b> tag.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>setheader</name>
+ * <name>setHeader</name>
* <tagclass>org.apache.taglibs.response.SetHeaderTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Set a single HTTP header.</info>
@@ -98,7 +98,7 @@
}
/**
- * Read the body of the setheader tag to obtain the header value.
+ * Read the body of the setHeader tag to obtain the header value.
*
* @return SKIP_BODY
*/
@@ -106,7 +106,7 @@
{
// Use the body of the tag as header value
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the header
// value
body.clearBody();
1.3 +9 -9 jakarta-taglibs/response/src/org/apache/taglibs/response/SetIntHeaderTag.java
Index: SetIntHeaderTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetIntHeaderTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SetIntHeaderTag.java 2000/11/11 15:51:24 1.2
+++ SetIntHeaderTag.java 2001/07/15 16:21:25 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetIntHeaderTag.java,v 1.2 2000/11/11 15:51:24 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:51:24 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetIntHeaderTag.java,v 1.3 2001/07/15 16:21:25 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:25 $
*
* ====================================================================
*
@@ -68,13 +68,13 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>setintheader</b>, used to add a header for the HTTP Response.
+ * JSP Tag <b>setIntHeader</b>, used to add a header for the HTTP Response.
* <p>
- * The header value is set to the content of the body of the <b>setintheader</b> tag.
+ * The header value is set to the content of the body of the <b>setIntHeader</b> tag.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>setintheader</name>
+ * <name>setIntHeader</name>
* <tagclass>org.apache.taglibs.response.SetIntHeaderTag</tagclass>
* <bodycontent>JSP</bodycontent>
* <info>Set a single HTTP integer header.</info>
@@ -98,7 +98,7 @@
}
/**
- * Read the body of the setintheader tag to obtain the header value.
+ * Read the body of the setIntHeader tag to obtain the header value.
*
* @return SKIP_BODY
*/
@@ -106,7 +106,7 @@
{
// Use the body of the tag as header value
BodyContent body = getBodyContent();
- String s = body.getString();
+ String s = body.getString().trim();
// Clear the body since we only used it as input for the header
// value
body.clearBody();
@@ -115,7 +115,7 @@
try {
value = Integer.valueOf(s).intValue();
} catch(NumberFormatException e) {
- throw new JspException("Response tag setintheader: " +
+ throw new JspException("Response tag setIntHeader: " +
e.getMessage());
}
1.3 +23 -20 jakarta-taglibs/response/src/org/apache/taglibs/response/SetStatusTag.java
Index: SetStatusTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetStatusTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SetStatusTag.java 2000/11/11 15:51:33 1.2
+++ SetStatusTag.java 2001/07/15 16:21:25 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetStatusTag.java,v 1.2 2000/11/11 15:51:33 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:51:33 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SetStatusTag.java,v 1.3 2001/07/15 16:21:25 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:25 $
*
* ====================================================================
*
@@ -71,11 +71,11 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>setstatus</b>, used to set the status code for the HTTP Response.
+ * JSP Tag <b>setStatus</b>, used to set the status code for the HTTP Response.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>setstatus</name>
+ * <name>setStatus</name>
* <tagclass>org.apache.taglibs.response.SetStatusTag</tagclass>
* <bodycontent>empty</bodycontent>
* <info>Set the status code for the HTTP Response.</info>
@@ -91,7 +91,7 @@
public class SetStatusTag extends TagSupport
{
- private int status = 0;
+ private String status;
/**
* Method called at end of tag which sets the HTTP Response status code.
@@ -100,7 +100,21 @@
*/
public final int doEndTag() throws JspException
{
- ((HttpServletResponse)pageContext.getResponse()).setStatus(status);
+ int status_code = 0;
+ HttpServletResponse resp = null;
+ Field ec = null;
+
+ try {
+ resp = (HttpServletResponse)pageContext.getResponse();
+ Class rc = resp.getClass();
+ ec = rc.getField(status);
+ status_code = ec.getInt(resp);
+ } catch(Exception e) {
+ throw new JspException(
+ "Response setStatus tag could not find status code: " + status);
+ }
+
+ ((HttpServletResponse)pageContext.getResponse()).setStatus(status_code);
return EVAL_PAGE;
}
@@ -113,19 +127,8 @@
*
* @param String Status Code name, e.g. "SC_OK"
*/
- public final void setStatus(String stat) throws JspException
+ public final void setStatus(String stat)
{
- HttpServletResponse resp = null;
- Field ec = null;
-
- try {
- resp = (HttpServletResponse)pageContext.getResponse();
- Class rc = resp.getClass();
- ec = rc.getField(stat);
- status = ec.getInt(resp);
- } catch(Exception e) {
- throw new JspException(
- "Response setstatus tag could not find status code: " + stat);
- }
+ status = stat;
}
}
1.3 +5 -5 jakarta-taglibs/response/src/org/apache/taglibs/response/SkipPageTag.java
Index: SkipPageTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SkipPageTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SkipPageTag.java 2000/11/11 15:51:41 1.2
+++ SkipPageTag.java 2001/07/15 16:21:25 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SkipPageTag.java,v 1.2 2000/11/11 15:51:41 glenn Exp $
- * $Revision: 1.2 $
- * $Date: 2000/11/11 15:51:41 $
+ * $Header: /home/cvs/jakarta-taglibs/response/src/org/apache/taglibs/response/SkipPageTag.java,v 1.3 2001/07/15 16:21:25 glenn Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/07/15 16:21:25 $
*
* ====================================================================
*
@@ -69,11 +69,11 @@
import javax.servlet.jsp.tagext.*;
/**
- * JSP Tag <b>skippage</b>, used to the remainder of the JSP page.
+ * JSP Tag <b>skipPage</b>, used to the remainder of the JSP page.
* <p>
* JSP Tag Lib Descriptor
* <p><pre>
- * <name>skippage</name>
+ * <name>skipPage</name>
* <tagclass>org.apache.taglibs.response.SkipPageTag</tagclass>
* <bodycontent>empty</bodycontent>
* <info>Skips the remainder of the JSP page.</info>