Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.taglibs.response
Class AddCookieTag  view AddCookieTag download AddCookieTag.java

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byorg.apache.taglibs.response.AddCookieTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class AddCookieTag
extends javax.servlet.jsp.tagext.TagSupport

JSP Tag addCookie, used to add a cookie to the Http Response.

The script variable for the name of the cookie is required.

Cookie attributes such as the comment, value, etc. can be set statically by using the corresponding addCookie tag attribute. Or dynamically using the corresponding tag in the body of the addCookie tag.

JSP Tag Lib Descriptor

 <name>addCookie</name>
 <tagclass>org.apache.taglibs.response.AddCookieTag</tagclass>
 <bodycontent>JSP</bodycontent>
 <info>Add a cookie to an Http Response.</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>comment</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>domain</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>maxAge</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>path</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>secure</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>version</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
 


Field Summary
private  java.lang.String comment
           
private  javax.servlet.http.Cookie cookie
           
private  java.lang.String domain
           
private  int maxAge
           
private  java.lang.String name
           
private  java.lang.String path
           
private  boolean secure
           
private  java.lang.String value
           
private  int version
           
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
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
AddCookieTag()
           
 
Method Summary
 int doEndTag()
          Method called at end of Tag used to set cookie attributes and add the cookie to the Http Response.
 int doStartTag()
          Method called at start of addCookie tag to create cookie
 void setComment(java.lang.String com)
          Optional attribute, specifies a comment that describes a cookie's purpose.
 void setDomain(java.lang.String dom)
          Optional attribute, specifies the domain within which this cookie should be presented.
 void setMaxAge(int max)
          Optional attribute, sets the maximum age of the cookie in seconds.
 void setName(java.lang.String nam)
          Required attribute, name of the cookie.
 void setPath(java.lang.String pth)
          Optional attribute, specifies a path for the cookie to which the client should return the cookie.
 void setSecure(boolean flag)
          Optional attribute, indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL.
 void setValue(java.lang.String val)
          Optional attribute, assigns a value to a cookie.
 void setVersion(int version)
          Optional attribute, sets the version of the cookie protocol this cookie complies with.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cookie

private javax.servlet.http.Cookie cookie

name

private java.lang.String name

value

private java.lang.String value

comment

private java.lang.String comment

domain

private java.lang.String domain

maxAge

private int maxAge

path

private java.lang.String path

secure

private boolean secure

version

private int version
Constructor Detail

AddCookieTag

public AddCookieTag()
Method Detail

doStartTag

public final int doStartTag()
                     throws javax.servlet.jsp.JspException
Method called at start of addCookie tag to create cookie


doEndTag

public final int doEndTag()
                   throws javax.servlet.jsp.JspException
Method called at end of Tag used to set cookie attributes and add the cookie to the Http Response.


setComment

public final void setComment(java.lang.String com)
Optional attribute, specifies a comment that describes a cookie's purpose.


setDomain

public final void setDomain(java.lang.String dom)
Optional attribute, specifies the domain within which this cookie should be presented.


setMaxAge

public final void setMaxAge(int max)
Optional attribute, sets the maximum age of the cookie in seconds.


setName

public final void setName(java.lang.String nam)
Required attribute, name of the cookie.


setPath

public final void setPath(java.lang.String pth)
Optional attribute, specifies a path for the cookie to which the client should return the cookie.


setValue

public final void setValue(java.lang.String val)
Optional attribute, assigns a value to a cookie.


setSecure

public final void setSecure(boolean flag)
Optional attribute, indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL. Set to true or false. Default value is false.


setVersion

public final void setVersion(int version)
Optional attribute, sets the version of the cookie protocol this cookie complies with.