org.apache.taglibs.request
Class HeadersTag

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

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

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

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

Loops through all the headers received by the HttpServletRequest.

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

JSP Tag Lib Descriptor

 <name>headers</name>
 <tagclass>org.apache.taglibs.request.HeadersTag</tagclass>
 <teiclass>org.apache.taglibs.request.HeadersTEI</teiclass>
 <bodycontent>JSP</bodycontent>
 <info>Loop through all headers, or get the properties of a single header.</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
HeadersTag()
           
 
Method Summary
 int doAfterBody()
          Method called at end of each headers tag body.
 int doEndTag()
          Method called at end of Tag
 int doStartTag()
          Gets the headers that came with the request or header with name.
 java.lang.String getDateHeader()
          Returns the value of a date header as the number of ms since the epoch.
 java.lang.String getHeader()
          Returns the value of the header.
 java.lang.String getIntHeader()
          Returns the value of a header as an integer.
 java.lang.String getName()
          Returns the name of the header.
 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

HeadersTag

public HeadersTag()
Method Detail

doStartTag

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

Returns:
SKIP_BODY if no headers or header with name is not found, EVAL_BODY_TAG if header exists
Throws:
javax.servlet.jsp.JspException

doAfterBody

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

Returns:
EVAL_BODY_TAG if there is another header, or SKIP_BODY if there are no more headers or this is a named header
Throws:
javax.servlet.jsp.JspException

doEndTag

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

Returns:
EVAL_PAGE
Throws:
javax.servlet.jsp.JspException

setName

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


getName

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

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

Returns:
String - header name

getHeader

public final java.lang.String getHeader()
Returns the value of the header.

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

Returns:
String - value of the header

getDateHeader

public final java.lang.String getDateHeader()
Returns the value of a date header as the number of ms since the epoch.

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

Returns:
String - value of a date header

getIntHeader

public final java.lang.String getIntHeader()
Returns the value of a header as an integer.

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

Returns:
String - value of an integer header


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