org.apache.taglibs.scrape
Class PageTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.apache.taglibs.scrape.PageTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag

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

PageTag - JSP tag page is used for generating an http request to a web page, it then scrapes the page for user specified text and stores the results from the scrape for later retrieval by another tag.

JSP Tag Lib Descriptor

 
 <name>page</name>
 <tagclass>org.apache.taglibs.scrape.PageTag</tagclass>
 <bodycontent>JSP</bodycontent>
 <info>Set the page that will be scraped</info>

 <attribute>
          >name>url</name>
          <required>false</required>
          <rtexprval>false</rtsprval>
 </attribute>
 <attribute>
        < name>time</name>
        <required>false</required>
        <rtexprval>false</rtexprval>
 </attribute>
 <attribute>
          >name>useProxy</name>
          <required>false</required>
          <rtexprval>false</rtsprval>
 </attribute>
 <attribute>
          >name>proxyPort</name>
          <required>false</required>
          <rtexprval>false</rtsprval>
 </attribute>
 <attribute>
        < name>proxyServer</name>
        <required>false</required>
        <rtexprval>false</rtexprval>
 </attribute>
 <attribute>
          >name>proxyName</name>
          <required>false</required>
          <rtexprval>false</rtsprval>
 </attribute>
 <attribute>
        < name>proxyPass</name>
        <required>false</required>
        <rtexprval>false</rtexprval>
 </attribute>
 <attribute>
        < name>proxyEncode</name>
        <required>false</required>
        <rtexprval>false</rtexprval>
 </attribute>
 <attribute>
        < name>charset</name>
        <required>false</required>
        <rtexprval>true</rtexprval>
 </attribute>
 

Version:
1.0
Author:
Rich Catlett
See Also:
PageData, ScrapeData, Serialized Form

Field Summary
 
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
PageTag()
           
 
Method Summary
 int doEndTag()
          implementation of method from the Tag interface that tells the JSP what to do upon encountering the end tag for this tag
 int doStartTag()
          implementation of method from the tag interface that tells the JSP what to do upon encounteringa the start tag for this tag
 void getPage()
          method gets the page object from the from the static hashmap keyed to the url
 void setCharset(java.lang.String value)
          set the value of the charset to be used
 void setClientPass(java.lang.String value)
          set the pass word to access the client keystore
 void setHeader(java.lang.String name, java.lang.String value)
          set the name and value of any extra headers to be sent
 void setProxyName(java.lang.String value)
          set the value of the username for authentication to the proxy server
 void setProxyPass(java.lang.String value)
          set the value of the password for authentication to the proxy server
 void setProxyPort(java.lang.String value)
          set the value of proxy port
 void setProxyServer(java.lang.String value)
          set the value of proxy server
 void setScrape(java.lang.String id, java.lang.String begin, java.lang.String end, java.lang.String anchors, java.lang.String strip)
          method sets the scrapedata object in the hashmap scrapes in the application scope pagedata object
 void setTime(java.lang.String wait)
          sets the time user would like the tag to wait before making a new http connection default is 10 minutes.
 void setUrl(java.lang.String url)
          sets the url for the http request.
 void setuseProxy(java.lang.String value)
          set the value of proxy port
 
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
 

Constructor Detail

PageTag

public PageTag()
Method Detail

doStartTag

public final int doStartTag()
                     throws javax.servlet.jsp.JspException
implementation of method from the tag interface that tells the JSP what to do upon encounteringa the start tag for this tag

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
integer value that tells the JSP engine to evaluate the body of this tag
Throws:
javax.servlet.jsp.JspException - thrown when an error occurs with client request processing

doEndTag

public final int doEndTag()
                   throws javax.servlet.jsp.JspException
implementation of method from the Tag interface that tells the JSP what to do upon encountering the end tag for this tag

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
integer value telling the JSP engine to evaluate the rest of the jsp page
Throws:
javax.servlet.jsp.JspException - thrown when error occurs in processing the body of this method

getPage

public final void getPage()
method gets the page object from the from the static hashmap keyed to the url


setTime

public final void setTime(java.lang.String wait)
                   throws javax.servlet.jsp.JspException
sets the time user would like the tag to wait before making a new http connection default is 10 minutes. method is used by the JSP container to set the time attribute given in the page tag

Parameters:
string - time in minutes must be greater than 10
Throws:
javax.servlet.jsp.JspException

setUrl

public final void setUrl(java.lang.String url)
                  throws javax.servlet.jsp.JspException
sets the url for the http request. method is used by the JSP container to set the time attribute given in the page tag

Parameters:
url - the url for the http request
Throws:
javax.servlet.jsp.JspException

setuseProxy

public final void setuseProxy(java.lang.String value)
                       throws javax.servlet.jsp.JspException
set the value of proxy port

Parameters:
value - the proxy port to use for the connection as a String
Throws:
javax.servlet.jsp.JspException

setProxyPort

public final void setProxyPort(java.lang.String value)
                        throws javax.servlet.jsp.JspException
set the value of proxy port

Parameters:
value - the proxy port to use for the connection as a String
Throws:
javax.servlet.jsp.JspException

setProxyServer

public final void setProxyServer(java.lang.String value)
set the value of proxy server

Parameters:
value - the proxy server to use for the connection

setProxyPass

public final void setProxyPass(java.lang.String value)
set the value of the password for authentication to the proxy server

Parameters:
value - the proxy port to use for the connection as a String

setProxyName

public final void setProxyName(java.lang.String value)
set the value of the username for authentication to the proxy server

Parameters:
value - the proxy server to use for the connection

setClientPass

public final void setClientPass(java.lang.String value)
set the pass word to access the client keystore

Parameters:
value - password to the client keystore

setHeader

public final void setHeader(java.lang.String name,
                            java.lang.String value)
set the name and value of any extra headers to be sent

Parameters:
name - string that is the name of an extra header to be sent
value - string that is the value of an extra header to be sent

setCharset

public final void setCharset(java.lang.String value)
set the value of the charset to be used

Parameters:
value - charset to be used to scrape the page

setScrape

public final void setScrape(java.lang.String id,
                            java.lang.String begin,
                            java.lang.String end,
                            java.lang.String anchors,
                            java.lang.String strip)
                     throws javax.servlet.jsp.JspException
method sets the scrapedata object in the hashmap scrapes in the application scope pagedata object

Parameters:
id - unique identifier of the scrape the following attributes define
begin - beginning anchor for the scrape refered to by id
end - ending anchor for the scrape refered to by id
anchors - boolean flag that determines if begin and end anchors are part of the result
strip - boolean flag that determines if tags are to be striped from the result
Throws:
javax.servlet.jsp.JspException


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