HTTP Request Method Overview

You can request images from PopChart Server directly using HTTP requests. For example, if you're currently sitting at a computer that's running PopChart Server, you can request one of the example PopChart images by entering the following URL into the address line of your browser:

http://localhost:2001/?@_FILEexamples/apfiles/bar.pcxml

By making this URL the source of an <img>, <object>, or <embed> tag (depending on the format of the image you want to display), you can easily embed the image into any web page. For this reason, using HTTP requests to communicate with PopChart Server is often referred to as the Image-URL method.

For any HTTP request to PopChart Server, there are two important parts: the address of the server (in this case http://localhost:2001) and the query string (which begins with @_FILE). The query string contains a list of server commands, such as @_FILE, which instruct PopChart Server on how to format the image it returns.

On the surface, this method of communicating with PopChart Server may appear simpler than the PopChart Embedder. However, when you start trying to use some of the more advanced features of PopChart Server, such as Best-Image Fallback and descriptive text, using this method can result in some very complicated and confusing HTML. Additionally, some functionality, such as integrated database-querying, HTML tables, and image maps, is only available using the PopChart Embedder.

We highly recommend that you use the PopChart Embedder method of communicating with PopChart Server. However, we also support using HTTP requests. In fact, there may be certain situations where HTTP requests are more appropriate than the PopChart Embedder.

There are two distinct strategies for embedding a PopChart image in a web page when requesting images via the HTTP request method:

Client-Side Server Commands

You can place all of the server commands necessary to generate your PopChart image directly in your web page. When a client views this web page and requests the appropriate image from PopChart Server, PopChart Server will find all of the information it needs to generate the image directly in the HTTP request.

Example 12 illustrates a typical process flow when using this strategy.

This process can be broken down into the following steps:

1. The Web Application Server retrieves data from the database.

2. The Web Application Server builds an HTML page that will embed the PopChart image. All of the data and commands needed to create the graph are will be included in the HTML page within either the image tag or JavaScript code.

3. The HTML page is served to the web client (browser).

4. Seeing the appropriate tag in the HTML page, the browser requests an image from PopChart Server. All of the data and commands are embedded in the image source URL.

5. PopChart Server uses the commands and data from the HTTP request to create a graph image and sends it back to the browser.

6. The browser displays the PopChart image.

Server-Side Server Commands

Rather than have the client send all of the server commands directly to PopChart Server, it is often more convenient to have the client send PopChart Server a server-side location where it can find the necessary server commands. You can store the server commands directly on PopChart Server (Server-Side Command File) or have PopChart Server request the commands from another application server (App Server Call Back).

Note: Server-side command files and app server call back can also be used with PopChart Embedder, but this is not often the case.

Example 13 illustrates a typical process flow when using this strategy with App Server Call Back:

This process can be broken down into the following steps:

1. The Web Application Server builds an HTML page that will embed the PopChart image. Within the embedding image tag there will be a server command that informs PopChart Server of the Application Server call back URL.

2. The HTML page is served to the web client (browser).

3. Seeing the appropriate tag in the HTML page, the browser requests an image from PopChart Server. The request includes the Application Server call-back URL.

4. PopChart Server "calls back" to the specified Application Server to get the data and commands needed to create the PopChart image.

5. The Application Server retrieves data from a database.

6. The data and commands are sent to PopChart Server.

7. PopChart Server creates an image and sends it back to the browser.

8. The browser displays the PopChart image.