org.apache.taglibs.request
Class CookiesTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.apache.taglibs.request.CookiesTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag

public class CookiesTag
extends javax.servlet.jsp.tagext.BodyTagSupport

JSP Tag cookies, used to get HttpServletRequest cookie information using the standard JSP <jsp:getProperty> tag.

The script variable of name id is availble only within the body of the cookies tag.

Loops through all the cookies received by the HttpServletRequest.

If the optional attribute name is present only the cookie of that name is retreived.

JSP Tag Lib Descriptor

 <name>cookies</name>
 <tagclass>org.apache.taglibs.request.CookiesTag</tagclass>
 <teiclass>org.apache.taglibs.request.CookiesTEI</teiclass>
 <bodycontent>JSP</bodycontent>
 <info>Loop through all cookies or get a single cookie.</info>
   <attribute>
     <name>id</name>
     <required>true</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>name</name>
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
 

Author:
Glenn Nielsen
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
CookiesTag()
           
 
Method Summary
 int doAfterBody()
          Method called at end of each cookies tag.
 int doEndTag()
          Method called at end of Tag
 int doStartTag()
          Gets the cookies that came with the request or cookie with name.
 java.lang.String getComment()
          Returns the comment describing the purpose of this cookie, or "" if the cookie has no comment.
 java.lang.String getDomain()
          Returns the domain name set for this cookie.
 java.lang.String getMaxAge()
          Returns the maximum age of the cookie, specified in seconds, By default, -1 indicating the cookie will persist until browser shutdown.
 java.lang.String getName()
          Returns the name of the cookie.
 java.lang.String getPath()
          Returns the path on the server to which the browser returns this cookie.
 java.lang.String getSecure()
          Returns "1" if the browser is sending cookies only over a secure protocol, or "0" if the browser can send cookies using any protocol.
 java.lang.String getValue()
          Returns the value of the cookie.
 java.lang.String getVersion()
          Returns the version of the protocol this cookie complies with.
 void setName(java.lang.String str)
          Set the optional tag attribute name.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Constructor Detail

CookiesTag

public CookiesTag()
Method Detail

doStartTag

public final int doStartTag()
                     throws javax.servlet.jsp.JspException
Gets the cookies that came with the request or cookie with name.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
SKIP_BODY if no cookies or cookie with name is not found, EVAL_BODY_TAG if cookie exists
Throws:
javax.servlet.jsp.JspException

doAfterBody

public final int doAfterBody()
                      throws javax.servlet.jsp.JspException
Method called at end of each cookies tag.

Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_BODY_TAG if there is another cookie, or SKIP_BODY if there are no more cookies or this is a named cookie
Throws:
javax.servlet.jsp.JspException

doEndTag

public final int doEndTag()
                   throws javax.servlet.jsp.JspException
Method called at end of Tag

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_PAGE
Throws:
javax.servlet.jsp.JspException

setName

public final void setName(java.lang.String str)
Set the optional tag attribute name.

Parameters:
String - name of cookie

getComment

public final java.lang.String getComment()
Returns the comment describing the purpose of this cookie, or "" if the cookie has no comment.

<jsp:getProperty name="id" property="comment"/>

Returns:
String - cookie comment

getDomain

public final java.lang.String getDomain()
Returns the domain name set for this cookie.

<jsp:getProperty name="id" property="domain"/>

Returns:
String - cookie domain

getMaxAge

public final java.lang.String getMaxAge()
Returns the maximum age of the cookie, specified in seconds, By default, -1 indicating the cookie will persist until browser shutdown.

<jsp:getProperty name="id" property="maxAge"/>

Returns:
String - cookie max age

getName

public final java.lang.String getName()
Returns the name of the cookie.

<jsp:getProperty name="id" property="name"/>

Returns:
String - cookie name

getPath

public final java.lang.String getPath()
Returns the path on the server to which the browser returns this cookie.

<jsp:getProperty name="id" property="path"/>

Returns:
String - cookie path on the server

getValue

public final java.lang.String getValue()
Returns the value of the cookie.

<jsp:getProperty name="id" property="value"/>

Returns:
String - cookie value

getSecure

public final java.lang.String getSecure()
Returns "1" if the browser is sending cookies only over a secure protocol, or "0" if the browser can send cookies using any protocol.

<jsp:getProperty name="id" property="secure"/>

Returns:
String - "1" if the cookies are secure, "0" if not

getVersion

public final java.lang.String getVersion()
Returns the version of the protocol this cookie complies with.

<jsp:getProperty name="id" property="version"/>

Returns:
String - cookie version


Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.