NetCharts Server

netcharts.server.util
Class DefaultPageCreator

java.lang.Object
  |
  +--netcharts.server.util.PageCreator
        |
        +--netcharts.server.util.DefaultPageCreator
All Implemented Interfaces:
netcharts.server.util.PageCreator.Processor

public class DefaultPageCreator
extends PageCreator
implements netcharts.server.util.PageCreator.Processor

Utility class for adding basic drill down and popup label capability to simple servlets. Servlets that use this class get called twice in order to completely render a page containing a chart image. The first pass creates the chart image and image map and returns an HTML page. The second pass returns the actual image data. Servlets which use this class should have a doGet() method of the following form:

	// If the browser is asking for the image data after loading
	// the HMTL we sent it, then send the image data
	if(DefaultPageCreator.isSecondPass(request))
	{
		DefaultPageCreator.writeImage(request, response);
	}
	else
	{
		// Create the chart
		ServerGeneratedPage sgp = ServerGeneratedChartProxy.getServerGeneratedPage("/charts/Examples/Templates/BarChart0.cdx?type=PNG");

		// Get a HTML page that implements drill down and write it
		// out to the browser
		String page = DefaultPageCreator.getDrillDownPage(sgp, request);
		response.getWriter().write(page);
	}
 


Field Summary
static java.lang.String DEFAULT_SERVLET_NAME
           
 
Fields inherited from class netcharts.server.util.PageCreator
ACCESSIBLE_IMAGE_PAGE, ACCESSIBLE_PAGE, ALT_VAR, DEFAULT_ALT_TEMPLATE, DEFAULT_URL, DRILLDOWN_PAGE, HEIGHT_VAR, IMAGE_PAGE, IMAGE_PARAMETER, MAP_VAR, MAPNAME_VAR, MIN_DRILLDOWN_PAGE, SRC_VAR, WIDTH_VAR
 
Method Summary
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, boolean fullPage, javax.servlet.http.HttpServletRequest request)
          Get the HTML which allows drill down and popup labels on the given chart.
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, boolean fullPage, javax.servlet.http.HttpServletRequest request, boolean useImageWriter)
          Get the HTML which allows drill down and popup labels on the given chart.
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, boolean fullPage, javax.servlet.http.HttpServletRequest request, java.lang.String defaultImageMapURL)
          Get the HTML which allows drill down and popup labels on the given chart.
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, boolean fullPage, javax.servlet.http.HttpServletRequest request, java.lang.String defaultImageMapURL, boolean accessible, java.lang.String altTemplate, java.lang.String chartDescription)
          Get the HTML which allows drill down and popup labels on the given chart.
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, boolean fullPage, javax.servlet.http.HttpServletRequest request, java.lang.String defaultImageMapURL, boolean accessible, java.lang.String altTemplate, java.lang.String chartDescription, boolean includeSessionId)
           
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, boolean fullPage, javax.servlet.http.HttpServletRequest request, java.lang.String defaultImageMapURL, boolean accessible, java.lang.String altTemplate, java.lang.String chartDescription, java.lang.String encoding)
          Deprecated. Encoding no longer needed, instead use getDrillDownPage(ServerGeneratedImage, boolean, HttpServletRequest, String, boolean, String, String)
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, javax.servlet.http.HttpServletRequest request)
          Get the HTML which allows drill down and popup labels on the given chart.
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, javax.servlet.http.HttpServletRequest request, boolean useImageWriter)
          Get the HTML which allows drill down and popup labels on the given chart.
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, javax.servlet.http.HttpServletRequest request, boolean useImageWriter, java.lang.String defaultImageMapURL)
          Get the HTML which allows drill down and popup labels on the given chart.
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, java.lang.String servletName, boolean fullPage, javax.servlet.http.HttpServletRequest request)
          Get the HTML which allows drill down and popup labels on the given chart.
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, java.lang.String servletName, boolean fullPage, javax.servlet.http.HttpServletRequest request, java.lang.String defaultImageMapURL)
          Get the HTML which allows drill down and popup labels on the given chart.
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, java.lang.String servletName, boolean fullPage, javax.servlet.http.HttpServletRequest request, java.lang.String defaultImageMapURL, boolean accessible, java.lang.String altTemplate, java.lang.String chartDescription)
          Get the HTML which allows drill down and popup labels on the given chart.
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, java.lang.String servletName, boolean fullPage, javax.servlet.http.HttpServletRequest request, java.lang.String defaultImageMapURL, boolean accessible, java.lang.String altTemplate, java.lang.String chartDescription, java.lang.String encoding)
          Deprecated. Encoding is no longer needed, instead use getDrillDownPage(ServerGeneratedImage, String, boolean, HttpServletRequest, String, boolean, String, String)
static java.lang.String getDrillDownPage(ServerGeneratedImage chart, java.lang.String servletName, boolean fullPage, javax.servlet.http.HttpServletRequest request, java.lang.String defaultImageMapURL, java.lang.String encoding)
          Deprecated. Encoding is no longer needed, instead use getDrillDownPage(ServerGeneratedImage, String, boolean, HttpServletRequest, String)
static java.lang.String getImagePage(ServerGeneratedImage chart, javax.servlet.http.HttpServletRequest request, boolean accessible, java.lang.String chartDescription)
          Get the HTML which only shows the image of the given chart.
static java.lang.String getImagePage(ServerGeneratedImage chart, javax.servlet.http.HttpServletRequest request, boolean accessible, java.lang.String chartDescription, java.lang.String encoding)
          Deprecated. Encoding no longer needed, instead use getImagePage(ServerGeneratedImage, HttpServletRequest, boolean, String)
static java.lang.String getImagePage(ServerGeneratedImage chart, java.lang.String servletName, javax.servlet.http.HttpServletRequest request, boolean accessible, java.lang.String chartDescription)
          Get the HTML which only shows the image of the given chart.
static java.lang.String getImagePage(ServerGeneratedImage chart, java.lang.String servletName, javax.servlet.http.HttpServletRequest request, boolean accessible, java.lang.String chartDescription, java.lang.String encoding)
          Deprecated. Encoding no longer needed, instead use getImagePage(ServerGeneratedImage, String, HttpServletRequest, boolean, String)
static java.lang.String getSessionIdParameter(javax.servlet.http.HttpServletRequest request)
           
static boolean isSecondPass(javax.servlet.http.HttpServletRequest request)
          Check to see if the given request is actually the browser asking for the image data (2nd pass).
 void process(ServerGeneratedImage chart, java.lang.String imgSRC, boolean fullPage, java.lang.String defaultImageMapURL, java.lang.Object arg)
           
static boolean writeImage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Write the image data to the browser.
 
Methods inherited from class netcharts.server.util.PageCreator
getDrillDownPage, getDrillDownPage, getDrillDownPage, getDrillDownPage, getDrillDownPage, getDrillDownPage, getImagePage, getImagePage, getRolloverJavaScript
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SERVLET_NAME

public static java.lang.String DEFAULT_SERVLET_NAME
Method Detail

isSecondPass

public static boolean isSecondPass(javax.servlet.http.HttpServletRequest request)
Check to see if the given request is actually the browser asking for the image data (2nd pass). The first pass returns the HTML and the second pass needs to return the image data.
Parameters:
request - The current request handed to the servlet.
Returns:
true if this request is the browser asking for image data, false otherwise.

writeImage

public static boolean writeImage(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
Write the image data to the browser.
Parameters:
request - The current request handed to the servlet.
response - The current response handed to the servlet.
Returns:
true if writing the image was successful, false otherwise.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                javax.servlet.http.HttpServletRequest request)
Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object. By default the browser will ask the current servlet for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
request - The current request handed to the servlet.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request)
Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object. By default the browser will ask the current servlet for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
fullPage - Specifies whether or not to return the full HTML code or just the image related elements only.
request - The current request handed to the servlet.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request,
                                                java.lang.String defaultImageMapURL)
Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object. By default the browser will ask the current servlet for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
fullPage - Specifies whether or not to return the full HTML code or just the image related elements only.
request - The current request handed to the servlet.
defaultImageMapURL - The URL to use when creating imagemap HREF attributes.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request,
                                                java.lang.String defaultImageMapURL,
                                                boolean accessible,
                                                java.lang.String altTemplate,
                                                java.lang.String chartDescription,
                                                java.lang.String encoding)
Deprecated. Encoding no longer needed, instead use getDrillDownPage(ServerGeneratedImage, boolean, HttpServletRequest, String, boolean, String, String)

Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object. By default the browser will ask the current servlet for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
fullPage - Specifies whether or not to return the full HTML code or just the image related elements only.
request - The current request handed to the servlet.
defaultImageMapURL - The URL to use when creating imagemap HREF attributes.
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.
encoding - The encoding used by the server to convert Strings to bytes.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request,
                                                java.lang.String defaultImageMapURL,
                                                boolean accessible,
                                                java.lang.String altTemplate,
                                                java.lang.String chartDescription)
Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object. By default the browser will ask the current servlet for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
fullPage - Specifies whether or not to return the full HTML code or just the image related elements only.
request - The current request handed to the servlet.
defaultImageMapURL - The URL to use when creating imagemap HREF attributes.
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:
A String containing HTML which supports drill down and popup labels on an image of the given chart.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request,
                                                java.lang.String defaultImageMapURL,
                                                boolean accessible,
                                                java.lang.String altTemplate,
                                                java.lang.String chartDescription,
                                                boolean includeSessionId)

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                javax.servlet.http.HttpServletRequest request,
                                                boolean useImageWriter)
Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object.
Parameters:
chart - The chart to convert to an image.
request - The current request handed to the servlet.
useImageWriter - Whether or not to use the ImageWriter servlet contained within this NetCharts Server context.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                javax.servlet.http.HttpServletRequest request,
                                                boolean useImageWriter,
                                                java.lang.String defaultImageMapURL)
Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object.
Parameters:
chart - The chart to convert to an image.
request - The current request handed to the servlet.
useImageWriter - Whether or not to use the ImageWriter servlet contained within this NetCharts Server context.
defaultImageMapURL - The URL to use when creating imagemap HREF attributes.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request,
                                                boolean useImageWriter)
Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object.
Parameters:
chart - The chart to convert to an image.
fullPage - Specifies whether or not to return the full HTML code or just the image related elements only.
request - The current request handed to the servlet.
useImageWriter - Whether or not to use the ImageWriter servlet contained within this NetCharts Server context.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                java.lang.String servletName,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request)
Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object. The browser will ask the servlet specifed in the servletName parameter for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
servletName - The servlet the browser should ask for the image.
fullPage - Specifies whether or not to return the full HTML code or just the image related elements only.
request - The current request handed to the servlet.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart. data after it reads the HTML.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                java.lang.String servletName,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request,
                                                java.lang.String defaultImageMapURL)
Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object. The browser will ask the servlet specifed in the servletName parameter for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
servletName - The servlet the browser should ask for the image.
fullPage - Specifies whether or not to return the full HTML code or just the image related elements only.
request - The current request handed to the servlet.
defaultImageMapURL - The URL to use when creating imagemap HREF attributes.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart. data after it reads the HTML.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                java.lang.String servletName,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request,
                                                java.lang.String defaultImageMapURL,
                                                java.lang.String encoding)
Deprecated. Encoding is no longer needed, instead use getDrillDownPage(ServerGeneratedImage, String, boolean, HttpServletRequest, String)

Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object. The browser will ask the servlet specifed in the servletName parameter for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
servletName - The servlet the browser should ask for the image.
fullPage - Specifies whether or not to return the full HTML code or just the image related elements only.
request - The current request handed to the servlet.
defaultImageMapURL - The URL to use when creating imagemap HREF attributes.
encoding - The encoding used by the server to convert Strings to bytes.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart. data after it reads the HTML.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                java.lang.String servletName,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request,
                                                java.lang.String defaultImageMapURL,
                                                boolean accessible,
                                                java.lang.String altTemplate,
                                                java.lang.String chartDescription,
                                                java.lang.String encoding)
Deprecated. Encoding is no longer needed, instead use getDrillDownPage(ServerGeneratedImage, String, boolean, HttpServletRequest, String, boolean, String, String)

Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object. The browser will ask the servlet specifed in the servletName parameter for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
servletName - The servlet the browser should ask for the image.
fullPage - Specifies whether or not to return the full HTML code or just the image related elements only.
request - The current request handed to the servlet.
defaultImageMapURL - The URL to use when creating imagemap HREF attributes.
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.
encoding - The encoding used by the server to convert Strings to bytes.
Returns:
A String containing HTML which supports drill down and popup labels on an image of the given chart. data after it reads the HTML.

getDrillDownPage

public static java.lang.String getDrillDownPage(ServerGeneratedImage chart,
                                                java.lang.String servletName,
                                                boolean fullPage,
                                                javax.servlet.http.HttpServletRequest request,
                                                java.lang.String defaultImageMapURL,
                                                boolean accessible,
                                                java.lang.String altTemplate,
                                                java.lang.String chartDescription)
Get the HTML which allows drill down and popup labels on the given chart. This should be written to the browser via the response object. The browser will ask the servlet specifed in the servletName parameter for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
servletName - The servlet the browser should ask for the image.
fullPage - Specifies whether or not to return the full HTML code or just the image related elements only.
request - The current request handed to the servlet.
defaultImageMapURL - The URL to use when creating imagemap HREF attributes.
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:
A String containing HTML which supports drill down and popup labels on an image of the given chart. data after it reads the HTML.

getImagePage

public static java.lang.String getImagePage(ServerGeneratedImage chart,
                                            javax.servlet.http.HttpServletRequest request,
                                            boolean accessible,
                                            java.lang.String chartDescription,
                                            java.lang.String encoding)
Deprecated. Encoding no longer needed, instead use getImagePage(ServerGeneratedImage, HttpServletRequest, boolean, String)

Get the HTML which only shows the image of the given chart. This should be written to the browser via the response object. The browser will ask the servlet specifed in the servletName parameter for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
request - The current request handed to the servlet.
accessible - Whether accessibility features (like alt tags) should be used in the page.
chartDescription - The description to be used in the alt tag on chart images.
encoding - The encoding used by the server to convert Strings to bytes.
Returns:
A String containing HTML which only shows the image of the given chart.

getImagePage

public static java.lang.String getImagePage(ServerGeneratedImage chart,
                                            javax.servlet.http.HttpServletRequest request,
                                            boolean accessible,
                                            java.lang.String chartDescription)
Get the HTML which only shows the image of the given chart. This should be written to the browser via the response object. The browser will ask the servlet specifed in the servletName parameter for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
request - The current request handed to the servlet.
accessible - Whether accessibility features (like alt tags) should be used in the page.
chartDescription - The description to be used in the alt tag on chart images.
Returns:
A String containing HTML which only shows the image of the given chart.

getImagePage

public static java.lang.String getImagePage(ServerGeneratedImage chart,
                                            java.lang.String servletName,
                                            javax.servlet.http.HttpServletRequest request,
                                            boolean accessible,
                                            java.lang.String chartDescription,
                                            java.lang.String encoding)
Deprecated. Encoding no longer needed, instead use getImagePage(ServerGeneratedImage, String, HttpServletRequest, boolean, String)

Get the HTML which only shows the image of the given chart. This should be written to the browser via the response object. The browser will ask the servlet specifed in the servletName parameter for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
servletName - The servlet the browser should ask for the image.
request - The current request handed to the servlet.
accessible - Whether accessibility features (like alt tags) should be used in the page.
chartDescription - The description to be used in the alt tag on chart images.
encoding - The encoding used by the server to convert Strings to bytes.
Returns:
A String containing HTML which only shows the image of the given chart.

getImagePage

public static java.lang.String getImagePage(ServerGeneratedImage chart,
                                            java.lang.String servletName,
                                            javax.servlet.http.HttpServletRequest request,
                                            boolean accessible,
                                            java.lang.String chartDescription)
Get the HTML which only shows the image of the given chart. This should be written to the browser via the response object. The browser will ask the servlet specifed in the servletName parameter for the image data after it reads the HTML.
Parameters:
chart - The chart to convert to an image.
servletName - The servlet the browser should ask for the image.
request - The current request handed to the servlet.
accessible - Whether accessibility features (like alt tags) should be used in the page.
chartDescription - The description to be used in the alt tag on chart images.
Returns:
A String containing HTML which only shows the image of the given chart.

process

public void process(ServerGeneratedImage chart,
                    java.lang.String imgSRC,
                    boolean fullPage,
                    java.lang.String defaultImageMapURL,
                    java.lang.Object arg)
Specified by:
process in interface netcharts.server.util.PageCreator.Processor

getSessionIdParameter

public static java.lang.String getSessionIdParameter(javax.servlet.http.HttpServletRequest request)

NetCharts Server


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

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

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

Last Modified: Jun 14, 2007