NetCharts Pro

netcharts.pro.util
Class NFServletUtil

java.lang.Object
  extended by 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 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 FILE_PARAMETER
          The parameter appended to file elements identifying the HTTP session variable used to hold the binary image data.
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_SVG
          image/svg+xml
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
 
Constructor Summary
NFServletUtil()
           
 
Method Summary
static java.lang.String getDrillDownPage(NFGraph chart, HttpServletRequest request)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getDrillDownPage(NFGraph chart, HttpServletRequest request, java.lang.String mimeType)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getDrillDownPage(NFGraph chart, HttpServletRequest request, java.lang.String mimeType, boolean fullPage)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getDrillDownPage(NFGraph chart, HttpServletRequest request, java.lang.String mimeType, boolean fullPage, java.lang.String servletName)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getDrillDownPage(NFGraph chart, HttpServletRequest request, java.lang.String mimeType, boolean fullPage, java.lang.String servletName, boolean accessible, java.lang.String altTemplate, java.lang.String chartDescription)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getDrillDownPage(NFGraph chart, 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)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getDrillDownPage(NFGraph chart, HttpServletRequest request, java.lang.String mimeType, boolean fullPage, java.lang.String servletName, java.lang.String defaultHref)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getDrillDownPage(NFGraph chart, HttpServletRequest request, java.lang.String mimeType, java.lang.String defaultHref)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getImageSrcTag(NFGraph chart, HttpServletRequest request)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getImageSrcTag(NFGraph chart, HttpServletRequest request, java.lang.String mimeType)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getImageSrcTag(NFGraph chart, HttpServletRequest request, java.lang.String mimeType, boolean accessible, java.lang.String chartDescription)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getImageSrcTag(NFGraph chart, HttpServletRequest request, java.lang.String mimeType, java.lang.String servletName)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getImageSrcTag(NFGraph chart, HttpServletRequest request, java.lang.String mimeType, java.lang.String servletName, boolean accessible, java.lang.String chartDescription)
          Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)
static java.lang.String getPage(HttpServletRequest request, NFGraph chart, NFPageParams pageParams)
          Generates an image from the given chart and returns an HTML page capable of displaying the generated image.
static java.lang.String getRolloverJavaScript()
          Deprecated. Use getScript(NFPageParams)
static java.lang.String getScript(NFPageParams params)
          Return the JavaScript and associated HTML used for chart presentation and interactivity.
static boolean isSecondPass(HttpServletRequest request)
          Deprecated. Use NFResourceServlet in your web application to handle returning image data
static boolean writeImage(HttpServletRequest request, HttpServletResponse response)
          Deprecated. Use NFResourceServlet in your web application to handle returning image data
 
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.


FILE_PARAMETER

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


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

See Also:
Constant Field Values

MIME_TYPE_TIFF

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

See Also:
Constant Field Values

MIME_TYPE_JPG

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

See Also:
Constant Field Values

MIME_TYPE_BMP

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

See Also:
Constant Field Values

MIME_TYPE_TGA

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

See Also:
Constant Field Values

MIME_TYPE_XPM

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

See Also:
Constant Field Values

MIME_TYPE_XBM

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

See Also:
Constant Field Values

MIME_TYPE_PICT

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

See Also:
Constant Field Values

MIME_TYPE_WBMP

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

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

MIME_TYPE_SVG

public static final java.lang.String MIME_TYPE_SVG
image/svg+xml

See Also:
Constant Field Values
Constructor Detail

NFServletUtil

public NFServletUtil()
Method Detail

getRolloverJavaScript

public static java.lang.String getRolloverJavaScript()
Deprecated. Use getScript(NFPageParams)

Return the JavaScript and associated HTML used for chart presentation and interactivity. This can be used to introduce the script code at any time during the page creation process.

Returns:
The JavaScript and associated HTML used for presentation and interactivity.

getScript

public static java.lang.String getScript(NFPageParams params)
Return the JavaScript and associated HTML used for chart presentation and interactivity. This can be used to introduce the script code at any time during the page creation process.

Parameters:
params - The page generation parameters
Returns:
The JavaScript and associated HTML used for presentation and interactivity.

isSecondPass

public static boolean isSecondPass(HttpServletRequest request)
Deprecated. Use NFResourceServlet in your web application to handle returning image data

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(HttpServletRequest request,
                                 HttpServletResponse response)
Deprecated. Use NFResourceServlet in your web application to handle returning image data

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,
                                                HttpServletRequest request)
                                         throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                HttpServletRequest request,
                                                java.lang.String mimeType)
                                         throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                HttpServletRequest request,
                                                java.lang.String mimeType,
                                                java.lang.String defaultHref)
                                         throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                HttpServletRequest request,
                                                java.lang.String mimeType,
                                                boolean fullPage)
                                         throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                HttpServletRequest request,
                                                java.lang.String mimeType,
                                                boolean fullPage,
                                                java.lang.String servletName)
                                         throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                HttpServletRequest request,
                                                java.lang.String mimeType,
                                                boolean fullPage,
                                                java.lang.String servletName,
                                                java.lang.String defaultHref)
                                         throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                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
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getDrillDownPage

public static java.lang.String getDrillDownPage(NFGraph chart,
                                                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
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getImageSrcTag

public static java.lang.String getImageSrcTag(NFGraph chart,
                                              HttpServletRequest request)
                                       throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getImageSrcTag

public static java.lang.String getImageSrcTag(NFGraph chart,
                                              HttpServletRequest request,
                                              java.lang.String mimeType)
                                       throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getImageSrcTag

public static java.lang.String getImageSrcTag(NFGraph chart,
                                              HttpServletRequest request,
                                              java.lang.String mimeType,
                                              java.lang.String servletName)
                                       throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getImageSrcTag

public static java.lang.String getImageSrcTag(NFGraph chart,
                                              HttpServletRequest request,
                                              java.lang.String mimeType,
                                              boolean accessible,
                                              java.lang.String chartDescription)
                                       throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getImageSrcTag

public static java.lang.String getImageSrcTag(NFGraph chart,
                                              HttpServletRequest request,
                                              java.lang.String mimeType,
                                              java.lang.String servletName,
                                              boolean accessible,
                                              java.lang.String chartDescription)
                                       throws java.lang.Exception
Deprecated. Use getPage(HttpServletRequest, NFGraph, NFPageParams)

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.
Throws:
java.lang.Exception

getPage

public static java.lang.String getPage(HttpServletRequest request,
                                       NFGraph chart,
                                       NFPageParams pageParams)
                                throws java.lang.Exception
Generates an image from the given chart and returns an HTML page capable of displaying the generated image.

Parameters:
request - The servlet request. Session information about the image will be written here.
chart - The chart object to create the image and image map for.
pageParams - The page generation parameters.
Returns:
HTML
Throws:
java.lang.Exception

NetCharts Pro


Visual Mining, Inc.
2099 Gaither Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2011
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: Jun 28, 2011