NetCharts Pro

netcharts.pro.util
Class NFServletUtil

java.lang.Object
  |
  +--netcharts.pro.util.NFServletUtil

public class NFServletUtil
extends java.lang.Object

NFServletUtil provides methods to make server side generation of chart images and images maps easier. In order to explain the process, first we will explain the terminology:

An image, as we use it here, is essentially a picture of a chart in time. The picture is encoding into bytes using a particular mime type. (by default "image/png").

An image map is what gives the image dynamic behavior. It identifies regions of the chart image that support rollover popup messages or "drilldown" hyperlink behavior. In addition to these "regions", the image map contains a URL for the image itself.

Image and image map generation occurs in two stages. In the first stage, the image is generated along with the image map. The servlet then returns just the image map. The browser then parses the image map and requests the image using the URL in the image map.

Finally, please note that the methods in this class are intended to simplify the image/image map features that NetCharts Pro provides. A great deal of flexibility is available by explicitly managing the process using the methods in the NFImageGeneration class.


Field Summary
static java.lang.String ACCESSIBLE_PAGE
          The location of the default accessibility enhanced template.
static java.lang.String DEFAULT_ALT_TEMPLATE
          The default template to use in the alt attribute for accessibility enhanced pages.
static java.lang.String DEFAULT_MIME_TYPE
          The default MIME type used when generating image.
static java.lang.String DEFAULT_URL
          The default URL for active labels.
static java.lang.String DRILLDOWN_PAGE
          The location of the default drilldown template.
static java.lang.String IMAGE_PARAMETER
          The parameter appended to img elements identifying the HTTP session variable used to hold the binary image data.
static java.lang.String MIME_TYPE_BMP
          image/bmp
static java.lang.String MIME_TYPE_JPG
          image/jpg
static java.lang.String MIME_TYPE_PICT
          image/pict
static java.lang.String MIME_TYPE_PNG
          image/png
static java.lang.String MIME_TYPE_TGA
          image/tga
static java.lang.String MIME_TYPE_TIFF
          image/tiff
static java.lang.String MIME_TYPE_WBMP
          image/wbmp
static java.lang.String MIME_TYPE_XBM
          image/xbm
static java.lang.String MIME_TYPE_XPM
          image/xpm
static java.lang.String MIN_DRILLDOWN_PAGE
          The location of the default minimum drilldown template.
 
Constructor Summary
NFServletUtil()
           
 
Method Summary
static java.lang.String getDrillDownPage(NFGraph chart, netcharts.pro.util.HttpServletRequest request)
          Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
static java.lang.String getDrillDownPage(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType)
          Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
static java.lang.String getDrillDownPage(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType, boolean fullPage)
          Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
static java.lang.String getDrillDownPage(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType, boolean fullPage, java.lang.String servletName)
          Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
static java.lang.String getDrillDownPage(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType, boolean fullPage, java.lang.String servletName, boolean accessible, java.lang.String altTemplate, java.lang.String chartDescription)
          Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
static java.lang.String getDrillDownPage(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType, boolean fullPage, java.lang.String servletName, boolean accessible, java.lang.String altTemplate, java.lang.String chartDescription, java.lang.String defaultHref)
          Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
static java.lang.String getDrillDownPage(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType, boolean fullPage, java.lang.String servletName, java.lang.String defaultHref)
          Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
static java.lang.String getDrillDownPage(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType, java.lang.String defaultHref)
          Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
static java.lang.String getImageSrcTag(NFGraph chart, netcharts.pro.util.HttpServletRequest request)
          Generates an image from the given chart and returns an HTML image src tag that provides a reference to the page.
static java.lang.String getImageSrcTag(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType)
          Generates an image from the given chart and returns an HTML image src tag that provides a reference to the page.
static java.lang.String getImageSrcTag(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType, boolean accessible, java.lang.String chartDescription)
          Generates an image from the given chart and returns an HTML image src tag that provides a reference to the page.
static java.lang.String getImageSrcTag(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType, java.lang.String servletName)
          Generates an image from the given chart and returns an HTML image src tag that provides a reference to the servlet specified.
static java.lang.String getImageSrcTag(NFGraph chart, netcharts.pro.util.HttpServletRequest request, java.lang.String mimeType, java.lang.String servletName, boolean accessible, java.lang.String chartDescription)
          Generates an image from the given chart and returns an HTML image src tag that provides a reference to the servlet specified.
static java.lang.String getRolloverJavaScript()
          Return the JavaScript and <div> tag used for chart interactivity.
static boolean isSecondPass(netcharts.pro.util.HttpServletRequest request)
          Determines if this is the second pass, or image retrieval call, to this servlet.
static boolean writeImage(netcharts.pro.util.HttpServletRequest request, netcharts.pro.util.HttpServletResponse response)
          Retrieves the image from the session and writes it to the response output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMAGE_PARAMETER

public static final java.lang.String IMAGE_PARAMETER
The parameter appended to img elements identifying the HTTP session variable used to hold the binary image data.

DRILLDOWN_PAGE

public static final java.lang.String DRILLDOWN_PAGE
The location of the default drilldown template.

MIN_DRILLDOWN_PAGE

public static final java.lang.String MIN_DRILLDOWN_PAGE
The location of the default minimum drilldown template.

ACCESSIBLE_PAGE

public static final java.lang.String ACCESSIBLE_PAGE
The location of the default accessibility enhanced template.

DEFAULT_ALT_TEMPLATE

public static final java.lang.String DEFAULT_ALT_TEMPLATE
The default template to use in the alt attribute for accessibility enhanced pages.

DEFAULT_URL

public static final java.lang.String DEFAULT_URL
The default URL for active labels.

MIME_TYPE_PNG

public static final java.lang.String MIME_TYPE_PNG
image/png

MIME_TYPE_TIFF

public static final java.lang.String MIME_TYPE_TIFF
image/tiff

MIME_TYPE_JPG

public static final java.lang.String MIME_TYPE_JPG
image/jpg

MIME_TYPE_BMP

public static final java.lang.String MIME_TYPE_BMP
image/bmp

MIME_TYPE_TGA

public static final java.lang.String MIME_TYPE_TGA
image/tga

MIME_TYPE_XPM

public static final java.lang.String MIME_TYPE_XPM
image/xpm

MIME_TYPE_XBM

public static final java.lang.String MIME_TYPE_XBM
image/xbm

MIME_TYPE_PICT

public static final java.lang.String MIME_TYPE_PICT
image/pict

MIME_TYPE_WBMP

public static final java.lang.String MIME_TYPE_WBMP
image/wbmp

DEFAULT_MIME_TYPE

public static final java.lang.String DEFAULT_MIME_TYPE
The default MIME type used when generating image. Equal to MIME_TYPE_PNG.
Constructor Detail

NFServletUtil

public NFServletUtil()
Method Detail

getRolloverJavaScript

public static java.lang.String getRolloverJavaScript()
Return the JavaScript and <div> tag used for chart interactivity. This can be used to introduce the script code at any time during the page creation process. Commonly used when the final resultant page contains charts within tables.
Returns:
The JavaScript and <div> tag used for interactivity.

isSecondPass

public static boolean isSecondPass(netcharts.pro.util.HttpServletRequest request)
Determines if this is the second pass, or image retrieval call, to this servlet.
Parameters:
request - The servlet request. If this is the second pass, the servlet request will have a image ID set as a session variable.
Returns:
true if this is the second call.

writeImage

public static boolean writeImage(netcharts.pro.util.HttpServletRequest request,
                                 netcharts.pro.util.HttpServletResponse response)
Retrieves the image from the session and writes it to the response output stream.
Parameters:
request - The servlet request. This is expected to contain the unique image ID generated during the call to "getDrillDownPage()"
response - The output
Returns:
true if the image was written, false if not.

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                netcharts.pro.util.HttpServletRequest request)
                                         throws java.lang.Exception
Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
Returns:
HTML image map or error message if template image map cannot be found.

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                netcharts.pro.util.HttpServletRequest request,
                                                java.lang.String mimeType)
                                         throws java.lang.Exception
Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
Returns:
HTML image map or error message if template image map cannot be found.

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                netcharts.pro.util.HttpServletRequest request,
                                                java.lang.String mimeType,
                                                java.lang.String defaultHref)
                                         throws java.lang.Exception
Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
defaultHref - Href to use if one isn't defined for the area tag.
Returns:
HTML image map or error message if template image map cannot be found.

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                netcharts.pro.util.HttpServletRequest request,
                                                java.lang.String mimeType,
                                                boolean fullPage)
                                         throws java.lang.Exception
Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
fullPage - Whether the full script should be included within the return.
Returns:
HTML image map or error message if template image map cannot be found.

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                netcharts.pro.util.HttpServletRequest request,
                                                java.lang.String mimeType,
                                                boolean fullPage,
                                                java.lang.String servletName)
                                         throws java.lang.Exception
Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
fullPage - Whether the full script should be included within the return.
servletName - The name of the servlet to put into the image map to retrieve the image.
Returns:
HTML image map or error message if template image map cannot be found.

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                netcharts.pro.util.HttpServletRequest request,
                                                java.lang.String mimeType,
                                                boolean fullPage,
                                                java.lang.String servletName,
                                                java.lang.String defaultHref)
                                         throws java.lang.Exception
Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
fullPage - Whether the full script should be included within the return.
servletName - The name of the servlet to put into the image map to retrieve the image.
defaultHref - Href to use if one isn't defined for the area tag.
Returns:
HTML image map or error message if template image map cannot be found.

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                netcharts.pro.util.HttpServletRequest request,
                                                java.lang.String mimeType,
                                                boolean fullPage,
                                                java.lang.String servletName,
                                                boolean accessible,
                                                java.lang.String altTemplate,
                                                java.lang.String chartDescription)
                                         throws java.lang.Exception
Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
fullPage - Whether the full script should be included within the return.
servletName - The name of the servlet to put into the image map to retrieve the image.
accessible - Whether accessibility features (like alt tags) should be used in the drill down page instead of javascript based popup labels
altTemplate - The text template used to construct alt tags on the active regions of a drill down image (map area tags).
chartDescription - The description to be used in the alt tag on chart images.
Returns:
HTML image map or error message if template image map cannot be found.

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                netcharts.pro.util.HttpServletRequest request,
                                                java.lang.String mimeType,
                                                boolean fullPage,
                                                java.lang.String servletName,
                                                boolean accessible,
                                                java.lang.String altTemplate,
                                                java.lang.String chartDescription,
                                                java.lang.String defaultHref)
                                         throws java.lang.Exception
Generates an image from the given chart and returns an HTML image map that provides a reference to the page as well as javascript code to manage rollover and drilldown behavior.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
fullPage - Whether the full script should be included within the return.
servletName - The name of the servlet to put into the image map to retrieve the image.
accessible - Whether accessibility features (like alt tags) should be used in the drill down page instead of javascript based popup labels
altTemplate - The text template used to construct alt tags on the active regions of a drill down image (map area tags).
chartDescription - The description to be used in the alt tag on chart images.
defaultHref - Href to use if one isn't defined for the area tag.
Returns:
HTML image map or error message if template image map cannot be found.

getImageSrcTag

public static java.lang.String getImageSrcTag(NFGraph chart,
                                              netcharts.pro.util.HttpServletRequest request)
                                       throws java.lang.Exception
Generates an image from the given chart and returns an HTML image src tag that provides a reference to the page.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
Returns:
HTML image src tag or error message if template image map cannot be found.

getImageSrcTag

public static java.lang.String getImageSrcTag(NFGraph chart,
                                              netcharts.pro.util.HttpServletRequest request,
                                              java.lang.String mimeType)
                                       throws java.lang.Exception
Generates an image from the given chart and returns an HTML image src tag that provides a reference to the page.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
Returns:
HTML image src tag or error message if template image map cannot be found.

getImageSrcTag

public static java.lang.String getImageSrcTag(NFGraph chart,
                                              netcharts.pro.util.HttpServletRequest request,
                                              java.lang.String mimeType,
                                              java.lang.String servletName)
                                       throws java.lang.Exception
Generates an image from the given chart and returns an HTML image src tag that provides a reference to the servlet specified.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
servletName - The name of the servlet to put into the image map to retrieve the image.
Returns:
HTML image src tag or error message if template image map cannot be found.

getImageSrcTag

public static java.lang.String getImageSrcTag(NFGraph chart,
                                              netcharts.pro.util.HttpServletRequest request,
                                              java.lang.String mimeType,
                                              boolean accessible,
                                              java.lang.String chartDescription)
                                       throws java.lang.Exception
Generates an image from the given chart and returns an HTML image src tag that provides a reference to the page.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
accessible - Whether accessibility features (like alt tags) should be used in the drill down page instead of javascript based popup labels
chartDescription - The description to be used in the alt tag on chart images.
Returns:
HTML image src tag or error message if template image map cannot be found.

getImageSrcTag

public static java.lang.String getImageSrcTag(NFGraph chart,
                                              netcharts.pro.util.HttpServletRequest request,
                                              java.lang.String mimeType,
                                              java.lang.String servletName,
                                              boolean accessible,
                                              java.lang.String chartDescription)
                                       throws java.lang.Exception
Generates an image from the given chart and returns an HTML image src tag that provides a reference to the servlet specified.
Parameters:
chart - The chart object to create the image and image map for.
request - The servlet request. Session information about the image will be written here.
mimeType - The image MIME type of the image to produce.
servletName - The name of the servlet to put into the image map to retrieve the image.
accessible - Whether accessibility features (like alt tags) should be used in the drill down page instead of javascript based popup labels
chartDescription - The description to be used in the alt tag on chart images.
Returns:
HTML image src tag or error message if template image map cannot be found.

NetCharts Pro


Visual Mining, Inc.
15825 Shady Grove Rd.
Suite 20
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2005
All Rights Reserved.

NetCharts Pro TM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Feb 1, 2005