BEA Systems, Inc.

WebLogic Server 5.1.0 API Reference

weblogic.html
Class MetaElement

java.lang.Object
  |
  +--weblogic.html.HtmlElement
        |
        +--weblogic.html.ElementWithAttributes
              |
              +--weblogic.html.SinglePartElement
                    |
                    +--weblogic.html.MetaElement

public class MetaElement
extends SinglePartElement

A MetaElement is used to add META information to the head portion of an HtmlPage. A META element is a name/value pair, HTTP-EQUIV/CONTENT, or NAME/CONTENT. Meta elements allow for better indexing by robot-driven search engines. They also also some control over when a browser expires content from its cache and how often the client initiates a client-side pull. This class also supports Netscape dynamic documents, which tie refresh rate to another URL.

Use the final static Strings provided with this class as arguments for the constructors. Explicit constants are not provided for the Dublin Core types (more information at OCLC or W3C) or VW96 Schema (more information at Vancouver).

MetaElements are repeatable. Add them to an HtmlPage after the HtmlPage.getHead() method with HtmlElement.addElement().

Author:
Copyright (c) 1996, by WebLogic, Inc.
Copyright © 2000 BEA Systems, Inc. All Rights Reserved.

Field Summary
static java.lang.String contentType
          Constant for "metatype" argument in this class.
static java.lang.String equivType
          Constant for "metatype" argument in this class.
static java.lang.String httpEquivContentName
          Constant for the "metaname" argument in this class.
static java.lang.String httpEquivContentStyleType
          Constant for the "metaname" argument in this class.
static java.lang.String httpEquivContentType
          Constant for the "metaname" argument in this class.
static java.lang.String httpEquivExpires
          Constant for "metaname" argument in this class.
static java.lang.String httpEquivPicsLabel
          Constant for the "metaname" argument in this class.
static java.lang.String httpEquivRefresh
          Constant for "metaname" argument in this class.
static java.lang.String httpEquivReplyTo
          Constant for "metaname" argument in this class.
static java.lang.String indexAll
          Constant for the "content" argument in this class with the "nameRobots" metaname.
static java.lang.String indexNoFollow
          Constant for the "content" argument in this class with the "nameRobots" metaname.
static java.lang.String nameAuthor
          Constant for the "metaname" argument in this class.
static java.lang.String nameDescription
          Constant for the "metaname" argument in this class.
static java.lang.String nameGenerator
          Constant for "metaname" argument in this class.
static java.lang.String nameKeywords
          Constant for the "metaname" argument in this class.
static java.lang.String nameRating
          Constant for "metaname" argument in this class.
static java.lang.String nameRevisitAfter
          Constant for "metaname" argument in this class.
static java.lang.String nameRobots
          Constant for the "metaname" argument in this class.
static java.lang.String nameType
          Constant for "metatype" argument in this class.
static java.lang.String noIndexButFollow
          Constant for the "content" argument in this class with the "nameRobots" metaname.
static java.lang.String robotsNone
          Constant for the "content" argument in this class with the "nameRobots" metaname.
static java.lang.String schemeType
          Constant for "metatype" argument in this class.
 
Fields inherited from class weblogic.html.HtmlElement
codeset, useObsolete
 
Constructor Summary
MetaElement()
          Constructs an empty MetaElement.
MetaElement(int refreshrate, java.lang.String url)
          Sets HTTP-EQUIV="Refresh" to the specified interval and sets a URL to be reloaded after the interval.
MetaElement(java.lang.String metatype, java.lang.String metaname, java.util.Date date)
          Constructs a MetaElement with the specified type and name, with the content attribute set to the specified Date object.
MetaElement(java.lang.String metatype, java.lang.String metaname, java.lang.String content)
          Constructs a MetaElement with the specified type and content.
 
Method Summary
protected  java.lang.String getHtmlCode()
           
protected  boolean printBody()
           
protected  boolean printCR()
           
protected  boolean printEndingTag()
           
 MetaElement setAuthor(java.lang.String author)
          Sets a META tag to report authorship of the document.
 MetaElement setContent(java.util.Date date)
          Internal use only.
 MetaElement setContent(java.lang.String val)
          Internal use only.
 MetaElement setDescription(java.lang.String desc)
          Sets a META tag to report a description of the document.
 MetaElement setExpDate(java.util.Date date)
          Sets the expiration date for a document.
 MetaElement setKeywords(java.lang.String keywords)
          Sets a META tag to report keywords for the document.
 MetaElement setMetaname(java.lang.String metatype, java.lang.String val)
          Internal use only.
 MetaElement setRobots(java.lang.String robots)
          Sets a META tag to report how robots should treat this document.
 
Methods inherited from class weblogic.html.SinglePartElement
getElement, printBody, printBody, printBody, setElement, setElement, widthAsLiteral
 
Methods inherited from class weblogic.html.ElementWithAttributes
addAttribute, addAttribute, escapeQuotes, getBooleanAttribute, getElementAttribute, getLocalVar, getQuotedAttribute, output, output, output, setBooleanAttribute, setBooleanAttribute, setClass, setDirection, setElementAttribute, setElementAttribute, setElementAttribute, setElementAttribute, setElementAttribute, setId, setLang, setLocalVar, setQuotedAttribute, setStyle
 
Methods inherited from class weblogic.html.HtmlElement
asAnchorElement, asBigElement, asBlockquoteElement, asBoldElement, asCenteredElement, asCiteElement, asCodeElement, asCommentElement, asDefineTermElement, asEmphasisElement, asFontElement, asFontElement, asFontElement, asHtmlContainer, asItalicElement, asKeyboardElement, asLiteralElement, asParagraphElement, asSampleElement, asSmallElement, asStrikeElement, asStrongElement, asSubscriptElement, asSuperscriptElement, asTeletypeElement, asUnderlineElement, asVariableElement, getVersion, setAnchorMode, setCodeset, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nameType

public static final java.lang.String nameType
Constant for "metatype" argument in this class. These correspond to the attributes for HTTP-EQUIV, NAME, CONTENT, and SCHEME as described in the HTML 4.0 spec.

equivType

public static final java.lang.String equivType
Constant for "metatype" argument in this class. These correspond to the attributes for HTTP-EQUIV, NAME, CONTENT, and SCHEME as described in the HTML 4.0 spec.

contentType

public static final java.lang.String contentType
Constant for "metatype" argument in this class. These correspond to the attributes for HTTP-EQUIV, NAME, CONTENT, and SCHEME as described in the HTML 4.0 spec.

schemeType

public static final java.lang.String schemeType
Constant for "metatype" argument in this class. These correspond to the attributes for HTTP-EQUIV, NAME, CONTENT, and SCHEME as described in the HTML 4.0 spec.

httpEquivContentType

public static final java.lang.String httpEquivContentType
Constant for the "metaname" argument in this class.

httpEquivContentName

public static final java.lang.String httpEquivContentName
Constant for the "metaname" argument in this class.

httpEquivContentStyleType

public static final java.lang.String httpEquivContentStyleType
Constant for the "metaname" argument in this class.

httpEquivExpires

public static final java.lang.String httpEquivExpires
Constant for "metaname" argument in this class. This binds an element to the HTTP response header "Expires".

httpEquivPicsLabel

public static final java.lang.String httpEquivPicsLabel
Constant for the "metaname" argument in this class.

httpEquivRefresh

public static final java.lang.String httpEquivRefresh
Constant for "metaname" argument in this class. This binds an element to the HTTP response header "Refresh".

httpEquivReplyTo

public static final java.lang.String httpEquivReplyTo
Constant for "metaname" argument in this class. This binds an element to the HTTP response header "Reply-to".

nameAuthor

public static final java.lang.String nameAuthor
Constant for the "metaname" argument in this class.

nameDescription

public static final java.lang.String nameDescription
Constant for the "metaname" argument in this class.

nameGenerator

public static final java.lang.String nameGenerator
Constant for "metaname" argument in this class. The generator indicates the program used to generate this document or the name of the HTML editor used.

nameKeywords

public static final java.lang.String nameKeywords
Constant for the "metaname" argument in this class.

nameRating

public static final java.lang.String nameRating
Constant for "metaname" argument in this class.

nameRevisitAfter

public static final java.lang.String nameRevisitAfter
Constant for "metaname" argument in this class.

nameRobots

public static final java.lang.String nameRobots
Constant for the "metaname" argument in this class.

indexAll

public static final java.lang.String indexAll
Constant for the "content" argument in this class with the "nameRobots" metaname. Setting a MetaElement for Robots to this value will cause the page to be indexed, and all links on the page will be followed. "All" is the default and is the same as "Index, Follow".

indexNoFollow

public static final java.lang.String indexNoFollow
Constant for the "content" argument in this class with the "nameRobots" metaname. Setting a MetaElement for Robots to this value will cause the page to be indexed, but no links on the page will be followed.

noIndexButFollow

public static final java.lang.String noIndexButFollow
Constant for the "content" argument in this class with the "nameRobots" metaname. Setting a MetaElement for Robots to this value will cause the page not to be indexed, but links on the page will be followed.

robotsNone

public static final java.lang.String robotsNone
Constant for the "content" argument in this class with the "nameRobots" metaname. Setting a MetaElement for Robots to this value will cause the robot to neither index nor follow links on this page. "None" is the same as "Noindex, Nofollow" and tells the robot to ignore the page.
Constructor Detail

MetaElement

public MetaElement()
Constructs an empty MetaElement. Use this constructor with any of the various setXXX methods in this class like this:
  page.getBody()
       .addElement(new MetaElement().setAuthor("John Smith"))
       .addElement(new MetaElement().setDescription("Genealogical tables"))
       .addElement(new MetaElement().setKeywords("genealogy, Smith family"))
       .addElement(new MetaElement().setExpDate(new java.util.Date()));

MetaElement

public MetaElement(java.lang.String metatype,
                   java.lang.String metaname,
                   java.lang.String content)
Constructs a MetaElement with the specified type and content. Use the variables supplied with this class, for "metatype" and "metaname" arguments. Alternately, you can set "metatype" to "NAME" or "HTTP-EQUIV" and "metaname" to any other valid string.

The format for the "content" argument of the metatype "httpEquivExpires" should follow IETF standard date syntax, for example:
"Tue, 20 Aug 1996 14:25:27 GMT"

Valid "content" arguments for the metatype "nameRobots" are provided in this class as final static Strings. You can pass other contents as a String, for example "NOINDEX, NOFOLLOW".

Parameters:
metatype - Name or HTTP-Equiv identifier
metaname - Value for the identifier
content - String content

MetaElement

public MetaElement(java.lang.String metatype,
                   java.lang.String metaname,
                   java.util.Date date)
Constructs a MetaElement with the specified type and name, with the content attribute set to the specified Date object.

Parameters:
metatype - Name or HTTP-Equiv identifier
metaname - Value for the identifier
date - Date object value CONTENT

MetaElement

public MetaElement(int refreshrate,
                   java.lang.String url)
Sets HTTP-EQUIV="Refresh" to the specified interval and sets a URL to be reloaded after the interval. The URL must be a fully-qualified absolute URL (for example, "http://bigbox.com/newpage.html"). This supports Netscape dynamic documents (http://home.mcom.com/assist/net_sites/pushpull.html).

Parameters:
refreshrate - Number of seconds to reload
url - Document to be reloaded
Method Detail

getHtmlCode

protected java.lang.String getHtmlCode()

Overrides:
getHtmlCode in class ElementWithAttributes

printEndingTag

protected boolean printEndingTag()

Overrides:
printEndingTag in class ElementWithAttributes

printBody

protected boolean printBody()

Overrides:
printBody in class ElementWithAttributes

printCR

protected boolean printCR()

Overrides:
printCR in class ElementWithAttributes

setAuthor

public MetaElement setAuthor(java.lang.String author)
Sets a META tag to report authorship of the document.

Parameters:
author - Author of the document
Returns:
MetaElement

setDescription

public MetaElement setDescription(java.lang.String desc)
Sets a META tag to report a description of the document.

Parameters:
description - String description of the document
Returns:
MetaElement

setKeywords

public MetaElement setKeywords(java.lang.String keywords)
Sets a META tag to report keywords for the document.

Parameters:
keywords - Comma-delimited list of keywords
Returns:
MetaElement

setRobots

public MetaElement setRobots(java.lang.String robots)
Sets a META tag to report how robots should treat this document. Valid arguments can be a string, or use a final static from this class, indexAll, indexNoFollow, noIndexButFollow, robotsNone.

Parameters:
robots - Robots action
Returns:
MetaElement

setExpDate

public MetaElement setExpDate(java.util.Date date)
Sets the expiration date for a document.

Parameters:
date - Java date
Returns:
MetaElement

setMetaname

public MetaElement setMetaname(java.lang.String metatype,
                               java.lang.String val)
Internal use only.

setContent

public MetaElement setContent(java.lang.String val)
Internal use only.

setContent

public MetaElement setContent(java.util.Date date)
Internal use only.

Documentation is available at
http://www.weblogic.com/docs51