org.opengts.util
Class HTMLTools

java.lang.Object
  extended by org.opengts.util.HTMLTools

public class HTMLTools
extends java.lang.Object

Various HTML and HTTP utilities


Nested Class Summary
static class HTMLTools.HttpBufferedInputStream
          A BufferedInputStream class that retains a handle to the HttpURLConnection instance
static class HTMLTools.HttpIOException
          HttpIOException class
Wrapper for IOException when due to an HttpURLConnection error.
static class HTMLTools.TagBlock
          Custom TagBlock class
static class HTMLTools.TagWrap
          Custom tag wrapper class
 
Field Summary
static java.lang.String AMP
           
static java.lang.String BR
           
static java.lang.String CHARSET_UTF8
           
static java.lang.String CONTENT_FORM_MULTIPART
           
static java.lang.String CONTENT_FORM_URLENCODED
           
static java.lang.String CONTENT_TYPE_BINARY
           
static java.lang.String CONTENT_TYPE_BMP
           
static java.lang.String CONTENT_TYPE_CSV
           
static java.lang.String CONTENT_TYPE_CSV_OLD
           
static java.lang.String CONTENT_TYPE_DOC
           
static java.lang.String CONTENT_TYPE_ENTITY_CSV
           
static java.lang.String CONTENT_TYPE_GIF
           
static java.lang.String CONTENT_TYPE_HTML
           
static java.lang.String CONTENT_TYPE_JAD
           
static java.lang.String CONTENT_TYPE_JAR
           
static java.lang.String CONTENT_TYPE_JPEG
           
static java.lang.String CONTENT_TYPE_JSON
           
static java.lang.String CONTENT_TYPE_KML
           
static java.lang.String CONTENT_TYPE_KML_XML
           
static java.lang.String CONTENT_TYPE_KMZ
           
static java.lang.String CONTENT_TYPE_MOV
           
static java.lang.String CONTENT_TYPE_MPEG
           
static java.lang.String CONTENT_TYPE_OCTET
           
static java.lang.String CONTENT_TYPE_PDF
           
static java.lang.String CONTENT_TYPE_PLAIN
           
static java.lang.String CONTENT_TYPE_PNG
           
static java.lang.String CONTENT_TYPE_PS
           
static java.lang.String CONTENT_TYPE_RTPROP
           
static java.lang.String CONTENT_TYPE_TEXT
           
static java.lang.String CONTENT_TYPE_TIFF
           
static java.lang.String CONTENT_TYPE_XLS
           
static java.lang.String CONTENT_TYPE_XLSX
           
static java.lang.String CONTENT_TYPE_XML
           
static java.lang.String CONTENT_TYPE_ZIP
           
static java.lang.String DEFAULT_USER_AGENT
           
static java.lang.String GT
           
static java.lang.String HEADER_ACCESS_CONTROL_ALLOW_ORIGIN
           
static java.lang.String HEADER_CONTENT_DISPOSITION
           
static java.lang.String HEADER_CONTENT_LENGTH
           
static java.lang.String HEADER_CONTENT_TYPE
           
static java.lang.String HEADER_COOKIE
           
static java.lang.String HEADER_HOST
           
static java.lang.String HEADER_REFERER
           
static java.lang.String HEADER_SET_COOKIE
           
static java.lang.String HEADER_SOAPACTION
           
static java.lang.String HEADER_USER_AGENT
           
static java.lang.String HR
           
static java.lang.String HTML
           
static java.lang.String LT
           
static byte[] MAGIC_BMP
           
static byte[] MAGIC_GIF_87a
           
static byte[] MAGIC_GIF_89a
           
static byte[] MAGIC_JAVA_CLASS
           
static byte[] MAGIC_JPEG
           
static byte[] MAGIC_JPEG_C
           
static byte[] MAGIC_PNG
           
static byte[] MAGIC_TIFF_II
           
static byte[] MAGIC_TIFF_MM
           
static java.lang.String PROP_HTMLTools_MIME_
           
static java.lang.String PROP_User_Agent
           
static java.lang.String QUOTE
           
static java.lang.String REQUEST_GET
           
static java.lang.String REQUEST_POST
           
static java.lang.String SP
           
static HTMLTools.TagBlock TAG_BLOCKQUOTE
           
static HTMLTools.TagBlock TAG_BLUE
           
static HTMLTools.TagBlock TAG_BLUEBOLD
           
static HTMLTools.TagBlock TAG_BOLD
           
static HTMLTools.TagBlock TAG_BULLETLIST
           
static HTMLTools.TagBlock TAG_CENTER
           
static HTMLTools.TagBlock TAG_GREEN
           
static HTMLTools.TagBlock TAG_GREENBOLD
           
static HTMLTools.TagBlock TAG_H1
           
static HTMLTools.TagBlock TAG_H2
           
static HTMLTools.TagBlock TAG_H3
           
static HTMLTools.TagBlock TAG_HTML
           
static HTMLTools.TagBlock TAG_ITALIC
           
static HTMLTools.TagBlock TAG_LISTITEM
           
static HTMLTools.TagBlock TAG_MONOCENTER
           
static HTMLTools.TagBlock TAG_MONORIGHT
           
static HTMLTools.TagBlock TAG_MONOSPACE
           
static HTMLTools.TagBlock TAG_NUMBERLIST
           
static HTMLTools.TagBlock TAG_RED
           
static HTMLTools.TagBlock TAG_REDBOLD
           
static HTMLTools.TagBlock TAG_RIGHT
           
static HTMLTools.TagBlock TAG_SMALLCENTER
           
static HTMLTools.TagBlock TAG_SMALLFONT
           
 
Constructor Summary
HTMLTools()
           
 
Method Summary
static java.lang.String _font()
          Closes a 'span' tag used to specify 'font' style.
static java.lang.String autoRefresh(int delay, java.lang.String url)
          Returns a 'meta' tag with a 'refresh' option
static java.lang.String color(java.awt.Color color)
          Encode the specified color into a String value
static java.lang.String createIFrameTemplate(int w, int h, java.lang.String srcURL)
          Creates an IField/ILayer section.
static java.lang.StringBuffer createIFrameTemplate(int w, int h, java.lang.String srcURL, java.lang.StringBuffer sb)
          Creates an IField/ILayer section.
static java.lang.String createIFrameTemplate(java.lang.String srcURL)
          Creates an IField/ILayer section.
static java.lang.StringBuffer createIFrameTemplate(java.lang.String srcURL, java.lang.StringBuffer sb)
          Creates an IField/ILayer section.
static java.lang.String createLink(java.lang.String ref, boolean newWindow, java.lang.Object text)
          Creates/Returns a String representing a link to a URL with the specified text description and attributes.
static java.lang.String createLink(java.lang.String ref, boolean newWindow, java.lang.Object text, boolean filterText)
          Creates/Returns a String representing a link to a URL with the specified text description and attributes.
static java.lang.String createLink(java.lang.String ref, java.lang.Object text)
          Creates/Returns a String representing a link to a URL with the specified text description and attributes.
static java.lang.String decodeParameter(java.lang.String text)
          Decode URL encoded hex values from the specified String
static java.lang.String encodeParameter(java.lang.Object text)
          Encode specific characters in the specified text object
static java.lang.String endJavaScript()
          Returns a String representing an end-of-JavaScript tag
static java.lang.String font(java.lang.String family, java.lang.String style, java.lang.String variant, java.lang.String weight, int ptsize)
          Returns a 'span' wrapper with the specified 'font' specification
static java.lang.String getContentMultipartBoundary(java.lang.String ct)
          Gets the "boundary=" value
static java.lang.String getExtensionFromMimeType(java.lang.String mime, java.lang.String dft)
          Returns an extension name for the specified MIME type
static java.lang.String getHttpUserAgent()
          Gets the HTTP "User-Agent" value to use for HTTP requests.
static PixelDimension getImageDimension(byte[] D)
          Return the Image Dimension based on the data Magic Number
static java.lang.String getMimeType(java.lang.String name, java.lang.String dftType)
          Returns the requested mime type
static java.lang.String getMimeTypeCharset(java.lang.String type)
          Appends the default "charset" to mime type
static java.lang.String getMimeTypeCharset(java.lang.String type, java.lang.String charSet)
          Appends the specified "charset" to mime type
static java.lang.String getMimeTypeFromData(byte[] data)
          Return the MIME type based on the data Magic Number
static java.lang.String getMimeTypeFromData(byte[] data, java.lang.String dft)
          Return the MIME type based on the data Magic Number
static java.lang.String getMimeTypeFromExtension(java.lang.String extn)
          Returns the MIME type for the specified extension
static java.lang.String getMimeTypeFromExtension(java.lang.String extn, java.lang.String dft)
          Returns the MIME type for the specified extension
static HTMLTools.HttpBufferedInputStream inputStream_GET(java.lang.String pageURLStr, int timeoutMS)
          Returns an InputStream for reading the contents of the specified URL
static HTMLTools.HttpBufferedInputStream inputStream_GET(java.net.URL pageURL, int timeoutMS)
          Returns an InputStream for reading the contents of the specified URL
static boolean isContentMultipartForm(java.lang.String ct)
          Returns true if the content type is a multipart form
static void main(java.lang.String[] argv)
          Main entry point for testing/debugging
static java.lang.String MIME_BINARY()
          Returns "binary" MIME type
static java.lang.String MIME_BMP()
          Returns "bmp" MIME type
static java.lang.String MIME_CSV()
          Returns "csv" MIME type
static java.lang.String MIME_GIF()
          Returns "gif" MIME type
static java.lang.String MIME_HTML()
          Returns "html" MIME type
static java.lang.String MIME_JPEG()
          Returns "jpeg" MIME type
static java.lang.String MIME_JSON()
          Returns "json" MIME type
static java.lang.String MIME_KML()
          Returns "kml" MIME type
static java.lang.String MIME_MOV()
          Returns "mov" MIME type
static java.lang.String MIME_MPEG()
          Returns "mpeg" MIME type
static java.lang.String MIME_PLAIN()
          Returns "plain" MIME type
static java.lang.String MIME_PNG()
          Returns "png" MIME type
static java.lang.String MIME_TIFF()
          Returns "tiff" MIME type
static java.lang.String MIME_XLS()
          Returns "xls" MIME type
static java.lang.String MIME_XLSX()
          Returns "xlsx" MIME type
static java.lang.String MIME_XML()
          Returns "xml" MIME type
static java.lang.String MIME_XML(java.lang.String charSet)
          Returns "xml" MIME type, with added character set
static java.lang.String MIME_ZIP()
          Returns "zip" MIME type
static byte[] readPage_GET_LogError(java.lang.String pageURLStr, int timeoutMS)
          Sends a GET to the specified URL, then reads and returns the response.
static byte[] readPage_GET_LogError(java.net.URL pageURL, int timeoutMS)
          Sends a GET to the specified URL, then reads and returns the response.
static byte[] readPage_GET(java.lang.String pageURLStr, int timeoutMS)
          Sends a GET to the specified URL, then reads and returns the response
static byte[] readPage_GET(java.net.URL pageURL, int timeoutMS)
          Sends a GET to the specified URL, then reads and returns the response
static byte[] readPage_POST(java.lang.String pageURLStr, java.util.Properties headerProps, byte[] postData, int timeoutMS)
          Sends a POST to the specified URL, then reads and returns the response
static byte[] readPage_POST(java.lang.String pageURLStr, java.lang.String contentType, byte[] postData, int timeoutMS)
          Sends a POST to the specified URL, then reads and returns the response
static byte[] readPage_POST(java.net.URL pageURL, java.util.Properties headerProps, byte[] postData, int timeoutMS)
          Sends a POST to the specified URL, then reads and returns the response
static byte[] readPage_POST(java.net.URL pageURL, java.util.Properties headerProps, byte[] postData, int timeoutMS, java.util.Map<java.lang.String,java.util.List<java.lang.String>> returnFields)
          Sends a POST to the specified URL, then reads and returns the response
static byte[] readPage_POST(java.net.URL pageURL, java.lang.String contentType, byte[] postData, int timeoutMS)
          Sends a POST to the specified URL, then reads and returns the response
static void setDebugDumpHeaders(boolean dump)
          Debug: specify that header fields should be logged during "readPage_POST"/"readPage_GET"
static void setHttpUserAgent(java.lang.String userAgent)
          Sets the HTTP "User-Agent" value to use for HTTP requests.
static java.lang.String startJavaScript()
          Returns a String representing a start-of-JavaScript tag
static HTMLTools.TagBlock TAG_COLOR(java.awt.Color c)
          Returns a TagBlock 'font' wrapper with the specified color
static HTMLTools.TagBlock TAG_COLOR(java.lang.String cs)
          Returns a TagBlock 'font' wrapper with the specified color String
static HTMLTools.TagBlock TAG_LINK(java.lang.String url)
          Returns a TagBlock 'a href=' wrapper with the specified url
static HTMLTools.TagBlock TAG_LINK(java.lang.String url, boolean newWindow)
          Returns a TagBlock 'a href=' wrapper with the specified url
static HTMLTools.TagBlock TAG_TOOLTIP(java.lang.String tip)
          Returns a TagBlock 'span' wrapper with the specified title/tooltip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_HTMLTools_MIME_

public static final java.lang.String PROP_HTMLTools_MIME_
See Also:
Constant Field Values

SP

public static final java.lang.String SP
See Also:
Constant Field Values

LT

public static final java.lang.String LT
See Also:
Constant Field Values

GT

public static final java.lang.String GT
See Also:
Constant Field Values

AMP

public static final java.lang.String AMP
See Also:
Constant Field Values

QUOTE

public static final java.lang.String QUOTE
See Also:
Constant Field Values

BR

public static final java.lang.String BR
See Also:
Constant Field Values

HR

public static final java.lang.String HR
See Also:
Constant Field Values

HTML

public static final java.lang.String HTML
See Also:
Constant Field Values

REQUEST_GET

public static final java.lang.String REQUEST_GET
See Also:
Constant Field Values

REQUEST_POST

public static final java.lang.String REQUEST_POST
See Also:
Constant Field Values

MAGIC_GIF_87a

public static final byte[] MAGIC_GIF_87a

MAGIC_GIF_89a

public static final byte[] MAGIC_GIF_89a

MAGIC_JPEG

public static final byte[] MAGIC_JPEG

MAGIC_JPEG_C

public static final byte[] MAGIC_JPEG_C

MAGIC_PNG

public static final byte[] MAGIC_PNG

MAGIC_TIFF_II

public static final byte[] MAGIC_TIFF_II

MAGIC_TIFF_MM

public static final byte[] MAGIC_TIFF_MM

MAGIC_BMP

public static final byte[] MAGIC_BMP

MAGIC_JAVA_CLASS

public static final byte[] MAGIC_JAVA_CLASS

CHARSET_UTF8

public static final java.lang.String CHARSET_UTF8
See Also:
Constant Field Values

HEADER_CONTENT_TYPE

public static final java.lang.String HEADER_CONTENT_TYPE
See Also:
Constant Field Values

HEADER_CONTENT_DISPOSITION

public static final java.lang.String HEADER_CONTENT_DISPOSITION
See Also:
Constant Field Values

HEADER_CONTENT_LENGTH

public static final java.lang.String HEADER_CONTENT_LENGTH
See Also:
Constant Field Values

HEADER_USER_AGENT

public static final java.lang.String HEADER_USER_AGENT
See Also:
Constant Field Values

HEADER_REFERER

public static final java.lang.String HEADER_REFERER
See Also:
Constant Field Values

HEADER_HOST

public static final java.lang.String HEADER_HOST
See Also:
Constant Field Values

HEADER_SOAPACTION

public static final java.lang.String HEADER_SOAPACTION
See Also:
Constant Field Values

HEADER_ACCESS_CONTROL_ALLOW_ORIGIN

public static final java.lang.String HEADER_ACCESS_CONTROL_ALLOW_ORIGIN
See Also:
Constant Field Values

HEADER_SET_COOKIE

public static final java.lang.String HEADER_SET_COOKIE
See Also:
Constant Field Values

HEADER_COOKIE

public static final java.lang.String HEADER_COOKIE
See Also:
Constant Field Values

PROP_User_Agent

public static final java.lang.String PROP_User_Agent
See Also:
Constant Field Values

DEFAULT_USER_AGENT

public static final java.lang.String DEFAULT_USER_AGENT
See Also:
Constant Field Values

CONTENT_FORM_MULTIPART

public static final java.lang.String CONTENT_FORM_MULTIPART
See Also:
Constant Field Values

CONTENT_FORM_URLENCODED

public static final java.lang.String CONTENT_FORM_URLENCODED
See Also:
Constant Field Values

CONTENT_TYPE_PLAIN

public static final java.lang.String CONTENT_TYPE_PLAIN
See Also:
Constant Field Values

CONTENT_TYPE_TEXT

public static final java.lang.String CONTENT_TYPE_TEXT
See Also:
Constant Field Values

CONTENT_TYPE_XML

public static final java.lang.String CONTENT_TYPE_XML
See Also:
Constant Field Values

CONTENT_TYPE_HTML

public static final java.lang.String CONTENT_TYPE_HTML
See Also:
Constant Field Values

CONTENT_TYPE_GIF

public static final java.lang.String CONTENT_TYPE_GIF
See Also:
Constant Field Values

CONTENT_TYPE_JPEG

public static final java.lang.String CONTENT_TYPE_JPEG
See Also:
Constant Field Values

CONTENT_TYPE_PNG

public static final java.lang.String CONTENT_TYPE_PNG
See Also:
Constant Field Values

CONTENT_TYPE_TIFF

public static final java.lang.String CONTENT_TYPE_TIFF
See Also:
Constant Field Values

CONTENT_TYPE_BMP

public static final java.lang.String CONTENT_TYPE_BMP
See Also:
Constant Field Values

CONTENT_TYPE_OCTET

public static final java.lang.String CONTENT_TYPE_OCTET
See Also:
Constant Field Values

CONTENT_TYPE_BINARY

public static final java.lang.String CONTENT_TYPE_BINARY
See Also:
Constant Field Values

CONTENT_TYPE_DOC

public static final java.lang.String CONTENT_TYPE_DOC
See Also:
Constant Field Values

CONTENT_TYPE_XLS

public static final java.lang.String CONTENT_TYPE_XLS
See Also:
Constant Field Values

CONTENT_TYPE_XLSX

public static final java.lang.String CONTENT_TYPE_XLSX
See Also:
Constant Field Values

CONTENT_TYPE_CSV_OLD

public static final java.lang.String CONTENT_TYPE_CSV_OLD
See Also:
Constant Field Values

CONTENT_TYPE_CSV

public static final java.lang.String CONTENT_TYPE_CSV
See Also:
Constant Field Values

CONTENT_TYPE_PDF

public static final java.lang.String CONTENT_TYPE_PDF
See Also:
Constant Field Values

CONTENT_TYPE_PS

public static final java.lang.String CONTENT_TYPE_PS
See Also:
Constant Field Values

CONTENT_TYPE_ZIP

public static final java.lang.String CONTENT_TYPE_ZIP
See Also:
Constant Field Values

CONTENT_TYPE_JAD

public static final java.lang.String CONTENT_TYPE_JAD
See Also:
Constant Field Values

CONTENT_TYPE_JAR

public static final java.lang.String CONTENT_TYPE_JAR
See Also:
Constant Field Values

CONTENT_TYPE_KML_XML

public static final java.lang.String CONTENT_TYPE_KML_XML
See Also:
Constant Field Values

CONTENT_TYPE_KML

public static final java.lang.String CONTENT_TYPE_KML
See Also:
Constant Field Values

CONTENT_TYPE_KMZ

public static final java.lang.String CONTENT_TYPE_KMZ
See Also:
Constant Field Values

CONTENT_TYPE_JSON

public static final java.lang.String CONTENT_TYPE_JSON
See Also:
Constant Field Values

CONTENT_TYPE_MOV

public static final java.lang.String CONTENT_TYPE_MOV
See Also:
Constant Field Values

CONTENT_TYPE_MPEG

public static final java.lang.String CONTENT_TYPE_MPEG
See Also:
Constant Field Values

CONTENT_TYPE_ENTITY_CSV

public static final java.lang.String CONTENT_TYPE_ENTITY_CSV
See Also:
Constant Field Values

CONTENT_TYPE_RTPROP

public static final java.lang.String CONTENT_TYPE_RTPROP
See Also:
Constant Field Values

TAG_HTML

public static final HTMLTools.TagBlock TAG_HTML

TAG_H1

public static final HTMLTools.TagBlock TAG_H1

TAG_H2

public static final HTMLTools.TagBlock TAG_H2

TAG_H3

public static final HTMLTools.TagBlock TAG_H3

TAG_CENTER

public static final HTMLTools.TagBlock TAG_CENTER

TAG_BLOCKQUOTE

public static final HTMLTools.TagBlock TAG_BLOCKQUOTE

TAG_RIGHT

public static final HTMLTools.TagBlock TAG_RIGHT

TAG_BOLD

public static final HTMLTools.TagBlock TAG_BOLD

TAG_ITALIC

public static final HTMLTools.TagBlock TAG_ITALIC

TAG_MONOSPACE

public static final HTMLTools.TagBlock TAG_MONOSPACE

TAG_MONORIGHT

public static final HTMLTools.TagBlock TAG_MONORIGHT

TAG_MONOCENTER

public static final HTMLTools.TagBlock TAG_MONOCENTER

TAG_RED

public static final HTMLTools.TagBlock TAG_RED

TAG_REDBOLD

public static final HTMLTools.TagBlock TAG_REDBOLD

TAG_GREEN

public static final HTMLTools.TagBlock TAG_GREEN

TAG_GREENBOLD

public static final HTMLTools.TagBlock TAG_GREENBOLD

TAG_BLUE

public static final HTMLTools.TagBlock TAG_BLUE

TAG_BLUEBOLD

public static final HTMLTools.TagBlock TAG_BLUEBOLD

TAG_SMALLFONT

public static final HTMLTools.TagBlock TAG_SMALLFONT

TAG_SMALLCENTER

public static final HTMLTools.TagBlock TAG_SMALLCENTER

TAG_NUMBERLIST

public static final HTMLTools.TagBlock TAG_NUMBERLIST

TAG_BULLETLIST

public static final HTMLTools.TagBlock TAG_BULLETLIST

TAG_LISTITEM

public static final HTMLTools.TagBlock TAG_LISTITEM
Constructor Detail

HTMLTools

public HTMLTools()
Method Detail

setDebugDumpHeaders

public static void setDebugDumpHeaders(boolean dump)
Debug: specify that header fields should be logged during "readPage_POST"/"readPage_GET"


setHttpUserAgent

public static void setHttpUserAgent(java.lang.String userAgent)
Sets the HTTP "User-Agent" value to use for HTTP requests.

Parameters:
userAgent - The user-agent

getHttpUserAgent

public static java.lang.String getHttpUserAgent()
Gets the HTTP "User-Agent" value to use for HTTP requests.

Returns:
The user-agent

isContentMultipartForm

public static boolean isContentMultipartForm(java.lang.String ct)
Returns true if the content type is a multipart form

Parameters:
ct - The content type
Returns:
True if "multipart/form-data"

getContentMultipartBoundary

public static java.lang.String getContentMultipartBoundary(java.lang.String ct)
Gets the "boundary=" value

Parameters:
ct - The content type
Returns:
The "boundary=" value

MIME_ZIP

public static java.lang.String MIME_ZIP()
Returns "zip" MIME type

Returns:
"zip" MIME type

MIME_PLAIN

public static java.lang.String MIME_PLAIN()
Returns "plain" MIME type

Returns:
"plain" MIME type

MIME_HTML

public static java.lang.String MIME_HTML()
Returns "html" MIME type

Returns:
"html" MIME type

MIME_XML

public static java.lang.String MIME_XML()
Returns "xml" MIME type

Returns:
"xml" MIME type

MIME_XML

public static java.lang.String MIME_XML(java.lang.String charSet)
Returns "xml" MIME type, with added character set

Returns:
"xml" MIME type, with added character set

MIME_CSV

public static java.lang.String MIME_CSV()
Returns "csv" MIME type

Returns:
"csv" MIME type

MIME_XLS

public static java.lang.String MIME_XLS()
Returns "xls" MIME type

Returns:
"xls" MIME type

MIME_XLSX

public static java.lang.String MIME_XLSX()
Returns "xlsx" MIME type

Returns:
"xlsx" MIME type

MIME_KML

public static java.lang.String MIME_KML()
Returns "kml" MIME type

Returns:
"kml" MIME type

MIME_JSON

public static java.lang.String MIME_JSON()
Returns "json" MIME type

Returns:
"json" MIME type

MIME_BINARY

public static java.lang.String MIME_BINARY()
Returns "binary" MIME type

Returns:
"binary" MIME type

MIME_PNG

public static java.lang.String MIME_PNG()
Returns "png" MIME type

Returns:
"png" MIME type

MIME_GIF

public static java.lang.String MIME_GIF()
Returns "gif" MIME type

Returns:
"gif" MIME type

MIME_JPEG

public static java.lang.String MIME_JPEG()
Returns "jpeg" MIME type

Returns:
"jpeg" MIME type

MIME_TIFF

public static java.lang.String MIME_TIFF()
Returns "tiff" MIME type

Returns:
"tiff" MIME type

MIME_BMP

public static java.lang.String MIME_BMP()
Returns "bmp" MIME type

Returns:
"bmp" MIME type

MIME_MOV

public static java.lang.String MIME_MOV()
Returns "mov" MIME type

Returns:
"mov" MIME type

MIME_MPEG

public static java.lang.String MIME_MPEG()
Returns "mpeg" MIME type

Returns:
"mpeg" MIME type

getMimeType

public static java.lang.String getMimeType(java.lang.String name,
                                           java.lang.String dftType)
Returns the requested mime type

Parameters:
name - The name of the MIME type property key
dftType - The default MIME type to return
Returns:
The MIME type

getMimeTypeCharset

public static java.lang.String getMimeTypeCharset(java.lang.String type)
Appends the default "charset" to mime type

Parameters:
type - The Mime type
Returns:
The combined mime-type/charset

getMimeTypeCharset

public static java.lang.String getMimeTypeCharset(java.lang.String type,
                                                  java.lang.String charSet)
Appends the specified "charset" to mime type

Parameters:
type - The Mime type
charSet - The 'charset'
Returns:
The combined mime-type/charset

getMimeTypeFromExtension

public static java.lang.String getMimeTypeFromExtension(java.lang.String extn)
Returns the MIME type for the specified extension

Parameters:
extn - The extension
Returns:
The MIME type (default to CONTENT_TYPE_OCTET if the extension is not recognized)

getMimeTypeFromExtension

public static java.lang.String getMimeTypeFromExtension(java.lang.String extn,
                                                        java.lang.String dft)
Returns the MIME type for the specified extension

Parameters:
extn - The extension
dft - The default MIME type to return if the extension is not recognized
Returns:
The MIME type

getMimeTypeFromData

public static java.lang.String getMimeTypeFromData(byte[] data)
Return the MIME type based on the data Magic Number

Parameters:
data - The data buffer to test for specific Magin-Numbers
Returns:
The MIME type (default to CONTENT_TYPE_OCTET if data is not recognized)

getMimeTypeFromData

public static java.lang.String getMimeTypeFromData(byte[] data,
                                                   java.lang.String dft)
Return the MIME type based on the data Magic Number

Parameters:
data - The data buffer to test for specific Magin-Numbers
dft - The default MIME type to return if the data is not recognized
Returns:
The MIME type

getExtensionFromMimeType

public static java.lang.String getExtensionFromMimeType(java.lang.String mime,
                                                        java.lang.String dft)
Returns an extension name for the specified MIME type

Parameters:
mime - The MIME type
dft - The default extension if the MIME type is not found
Returns:
The extension

getImageDimension

public static PixelDimension getImageDimension(byte[] D)
Return the Image Dimension based on the data Magic Number

Parameters:
D - The image data buffer
Returns:
The Image dimension

TAG_COLOR

public static HTMLTools.TagBlock TAG_COLOR(java.awt.Color c)
Returns a TagBlock 'font' wrapper with the specified color

Parameters:
c - The font color
Returns:
The TagBlock 'font' wrapper

TAG_COLOR

public static HTMLTools.TagBlock TAG_COLOR(java.lang.String cs)
Returns a TagBlock 'font' wrapper with the specified color String

Parameters:
cs - The font color String
Returns:
The TagBlock 'font' wrapper

TAG_TOOLTIP

public static HTMLTools.TagBlock TAG_TOOLTIP(java.lang.String tip)
Returns a TagBlock 'span' wrapper with the specified title/tooltip

Parameters:
tip - The title/tooltip
Returns:
The TagBlock 'span' wrapper

TAG_LINK

public static HTMLTools.TagBlock TAG_LINK(java.lang.String url)
Returns a TagBlock 'a href=' wrapper with the specified url

Parameters:
url - The URL
Returns:
The TagBlock 'a' wrapper

TAG_LINK

public static HTMLTools.TagBlock TAG_LINK(java.lang.String url,
                                          boolean newWindow)
Returns a TagBlock 'a href=' wrapper with the specified url

Parameters:
url - The URL
newWindow - True to specify "target=_blank"
Returns:
The TagBlock 'a' wrapper

encodeParameter

public static java.lang.String encodeParameter(java.lang.Object text)
Encode specific characters in the specified text object

Parameters:
text - The text Object
Returns:
The encoded String

decodeParameter

public static java.lang.String decodeParameter(java.lang.String text)
Decode URL encoded hex values from the specified String

Parameters:
text - The encoded text
Returns:
The decoded String

color

public static java.lang.String color(java.awt.Color color)
Encode the specified color into a String value

Parameters:
color - The Color object
Returns:
The String representation of the color

createLink

public static java.lang.String createLink(java.lang.String ref,
                                          java.lang.Object text)
Creates/Returns a String representing a link to a URL with the specified text description and attributes.

Parameters:
ref - The referenced URL link ("target='_blank'" will be applied)
text - The link text (html filtering will be applied)
Returns:
The assembled link ('a' tag)

createLink

public static java.lang.String createLink(java.lang.String ref,
                                          boolean newWindow,
                                          java.lang.Object text)
Creates/Returns a String representing a link to a URL with the specified text description and attributes.

Parameters:
ref - The referenced URL link
newWindow - If true, "target='_blank'" will be specified
text - The link text (html filtering will be applied)
Returns:
The assembled link ('a' tag)

createLink

public static java.lang.String createLink(java.lang.String ref,
                                          boolean newWindow,
                                          java.lang.Object text,
                                          boolean filterText)
Creates/Returns a String representing a link to a URL with the specified text description and attributes.

Parameters:
ref - The referenced URL link
newWindow - If true, "target='_blank'" will be specified
text - The link text
filterText - True to apply HTML filtering to the specified text
Returns:
The assembled link ('a' tag)

font

public static java.lang.String font(java.lang.String family,
                                    java.lang.String style,
                                    java.lang.String variant,
                                    java.lang.String weight,
                                    int ptsize)
Returns a 'span' wrapper with the specified 'font' specification

Parameters:
family - The font family
style - The font style ('normal', 'italic', 'oblique')
variant - The font variant ('normal', 'small-caps')
weight - The font weight ('normal', 'bold', 'bolder', 'lighter', etc)
ptsize - The font point size
Returns:
The 'font' tag specification

_font

public static java.lang.String _font()
Closes a 'span' tag used to specify 'font' style.


startJavaScript

public static java.lang.String startJavaScript()
Returns a String representing a start-of-JavaScript tag


endJavaScript

public static java.lang.String endJavaScript()
Returns a String representing an end-of-JavaScript tag


autoRefresh

public static java.lang.String autoRefresh(int delay,
                                           java.lang.String url)
Returns a 'meta' tag with a 'refresh' option

Parameters:
delay - Delay before next update
url - The URL to jump to after the delay
Returns:
The String representing the assembled 'meta' tag

readPage_POST

public static byte[] readPage_POST(java.lang.String pageURLStr,
                                   java.lang.String contentType,
                                   byte[] postData,
                                   int timeoutMS)
                            throws java.io.IOException
Sends a POST to the specified URL, then reads and returns the response

Parameters:
pageURLStr - The URL to which the POST is sent
contentType - The MIME type of the POST data sent to the server
postData - The data sent to the server
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
Returns:
The response from the server
Throws:
java.net.NoRouteToHostException - if the remote host could not be reached
java.io.IOException - if an I/O error occurs

readPage_POST

public static byte[] readPage_POST(java.net.URL pageURL,
                                   java.lang.String contentType,
                                   byte[] postData,
                                   int timeoutMS)
                            throws java.io.IOException
Sends a POST to the specified URL, then reads and returns the response

Parameters:
pageURL - The URL to which the POST is sent
contentType - The MIME type of the POST data sent to the server
postData - The data sent to the server
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
Returns:
The response from the server
Throws:
java.net.NoRouteToHostException - if the remote host could not be reached
java.io.IOException - if an I/O error occurs

readPage_POST

public static byte[] readPage_POST(java.lang.String pageURLStr,
                                   java.util.Properties headerProps,
                                   byte[] postData,
                                   int timeoutMS)
                            throws java.io.IOException
Sends a POST to the specified URL, then reads and returns the response

Parameters:
pageURLStr - The URL to which the POST is sent
headerProps - The POST header properties
postData - The data sent to the server
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
Returns:
The response from the server
Throws:
java.net.NoRouteToHostException - if the remote host could not be reached
java.io.IOException - if an I/O error occurs

readPage_POST

public static byte[] readPage_POST(java.net.URL pageURL,
                                   java.util.Properties headerProps,
                                   byte[] postData,
                                   int timeoutMS)
                            throws java.io.IOException
Sends a POST to the specified URL, then reads and returns the response

Parameters:
pageURL - The URL to which the POST is sent
headerProps - The POST header properties
postData - The data sent to the server
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
Returns:
The response from the server
Throws:
java.net.NoRouteToHostException - if the remote host could not be reached
java.io.IOException - if an I/O error occurs

readPage_POST

public static byte[] readPage_POST(java.net.URL pageURL,
                                   java.util.Properties headerProps,
                                   byte[] postData,
                                   int timeoutMS,
                                   java.util.Map<java.lang.String,java.util.List<java.lang.String>> returnFields)
                            throws java.io.IOException
Sends a POST to the specified URL, then reads and returns the response

Parameters:
pageURL - The URL to which the POST is sent
headerProps - The POST header properties
postData - The data sent to the server
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
returnFields - The returned header fields
Returns:
The response from the server
Throws:
java.net.NoRouteToHostException - if the remote host could not be reached
java.io.IOException - if an I/O error occurs

readPage_GET

public static byte[] readPage_GET(java.lang.String pageURLStr,
                                  int timeoutMS)
                           throws java.lang.Throwable
Sends a GET to the specified URL, then reads and returns the response

Parameters:
pageURLStr - The URL to which the GET is sent
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
Returns:
The response from the server
Throws:
java.net.NoRouteToHostException - if the remote host could not be reached
java.io.IOException - if an I/O error occurs
java.lang.Throwable

readPage_GET

public static byte[] readPage_GET(java.net.URL pageURL,
                                  int timeoutMS)
                           throws java.lang.Throwable
Sends a GET to the specified URL, then reads and returns the response

Parameters:
pageURL - The URL to which the GET is sent
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
Returns:
The response from the server
Throws:
java.net.NoRouteToHostException - if the remote host could not be reached
java.io.IOException - if an I/O error occurs
java.lang.Throwable

readPage_GET_LogError

public static byte[] readPage_GET_LogError(java.lang.String pageURLStr,
                                           int timeoutMS)
Sends a GET to the specified URL, then reads and returns the response. This method will not throw any Exceptions. Instead, the returned response is null if any errors are encountered.

Parameters:
pageURLStr - The URL to which the GET is sent
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
Returns:
The response from the server

readPage_GET_LogError

public static byte[] readPage_GET_LogError(java.net.URL pageURL,
                                           int timeoutMS)
Sends a GET to the specified URL, then reads and returns the response. This method will not throw any Exceptions. Instead, the returned response is null if any errors are encountered.

Parameters:
pageURL - The URL to which the GET is sent
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
Returns:
The response from the server

inputStream_GET

public static HTMLTools.HttpBufferedInputStream inputStream_GET(java.lang.String pageURLStr,
                                                                int timeoutMS)
                                                         throws java.io.IOException
Returns an InputStream for reading the contents of the specified URL

Parameters:
pageURLStr - The URL
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
Returns:
The InputStream
Throws:
java.net.NoRouteToHostException - if the remote host could not be reached
java.io.IOException - if an I/O error occurs

inputStream_GET

public static HTMLTools.HttpBufferedInputStream inputStream_GET(java.net.URL pageURL,
                                                                int timeoutMS)
                                                         throws java.io.IOException
Returns an InputStream for reading the contents of the specified URL

Parameters:
pageURL - The URL
timeoutMS - Connection timeout in milliseconds (<=0 for indefinite timeout)
Returns:
The InputStream
Throws:
java.net.NoRouteToHostException - if the remote host could not be reached
java.io.IOException - if an I/O error occurs

createIFrameTemplate

public static java.lang.StringBuffer createIFrameTemplate(java.lang.String srcURL,
                                                          java.lang.StringBuffer sb)
Creates an IField/ILayer section.

Parameters:
srcURL - The source URL displayed within the frame
sb - The destination StringBuffer
Returns:
The StringBuffer where the created IFrame/ILayer section is placed

createIFrameTemplate

public static java.lang.String createIFrameTemplate(java.lang.String srcURL)
Creates an IField/ILayer section.

Parameters:
srcURL - The source URL displayed within the frame
Returns:
The String containing the IFrame/ILayer section

createIFrameTemplate

public static java.lang.String createIFrameTemplate(int w,
                                                    int h,
                                                    java.lang.String srcURL)
Creates an IField/ILayer section.

Parameters:
w - The width of the IFrame
h - The height of the IFrame
srcURL - The source URL displayed within the frame
Returns:
The String containing the IFrame/ILayer section

createIFrameTemplate

public static java.lang.StringBuffer createIFrameTemplate(int w,
                                                          int h,
                                                          java.lang.String srcURL,
                                                          java.lang.StringBuffer sb)
Creates an IField/ILayer section.

Parameters:
w - The width of the IFrame
h - The height of the IFrame
srcURL - The source URL displayed within the frame
sb - The destination StringBuffer
Returns:
The StringBuffer where the created IFrame/ILayer section is placed

main

public static void main(java.lang.String[] argv)
Main entry point for testing/debugging

Parameters:
argv - Comand-line arguments