# Architecture

This section introduces the Viewer Java SDK, and describes the components it interacts with in order to create HTML and DHTML report views. An overview of how the complete system fits together is followed by details of the Viewer Java SDK itself.

Click the appropriate link to jump to that section:

- System overview
- Viewer Java SDK overview

## System overview

The Viewer Java SDK works together with the Java Reporting Component to allow reports to be viewed through a web browser. The Java Reporting Component is an all-Java component that enables the viewer to render Crystal Reports.

The diagram below illustrates the relationship between the Java Viewer SDK the Java Reporting Component, and other Crystal products:

Click the appropriate link to learn more about that component:

- Java Application Server
- Viewer Java SDK
- Java Reporting Component

#### Components

##### Java Application Server

The Java Application Server hosts the web applications that you write. These applications consist of one or more Java Server Pages (JSP) that contain code which uses the Java classes from Crystal Reports for BEA WebLogic Workshop and the Viewer Java SDK. In response to requests from a user's web browser, the server processes your JSPs to serve HTML and DHTML Crystal report views.

##### Viewer Java SDK

The Viewer Java SDK supplies the Java classes that enable you to programmatically generate HTML or DHTML for web delivery of Crystal report content. The viewer can be customized according to your needs, giving you full control over its display characteristics. Furthermore, the SDK allows you to programmatically export reports to a variety of formats.

See Viewer Java SDK overview for more information.

##### Java Reporting Component

The Java Reporting Component handles the report rendering process. It runs entirely on a Java Application Server and doesn't require any additional components, such as a Crystal Enterprise server or Report Application Server to run. It communicates with the viewer and data sources to produce HTML and DHTML Crystal report views.

## Viewer Java SDK overview

The Viewer Java SDK allows you to build customized report viewers for displaying reports as HTML and Dynamic HTML (DHTML). It works together with the Java Reporting Component to allow Crystal reports to be viewed through a web browser using only a Java application server. As a web application developer, you can include the viewer in your Java Server Pages (JSP) and programmatically manipulate them to produce the output that you require. This allows you to minimize the time spent on presentation and formatting code by leveraging the viewer's ability to use existing reports to render formatted HTML.

The Viewer Java SDK allows you to control how a report is displayed and the features that are available to the user. It also allows you to connect to several report sources, allowing you to view reports included with your web application, as well as reports obtained from a Crystal Enterprise system or Report Application Server.

Besides providing a solution for report viewing, the Java Viewer SDK also allows you to add report exporting functionality to your web applications. This means that you can programmatically export Crystal reports to a range of different formats.

See Viewer Functionality for a complete description of the features that are available with the viewer, a list of the export formats supported, as well as typical usage scenarios for the viewer.

Click the appropriate link to jump to that section:

- Report sources
- Java Reporting Component

### Report sources

A report source is an object used by the viewer to display the contents of the report. It is a pointer to the report instance that the viewer renders in HTML, and it provides the viewer with the means to query for report data, page information, and other internal report information.

The primary report source you will use with Crystal Reports for BEA WebLogic Workshop is the Java Reporting Component. This is an all-Java report source that is deployable with your web applications.

Although only the Java Reporting Component is provided with Crystal Reports for BEA WebLogic Workshop, other report sources can be used if you have Crystal Enterprise or a Report Application Server. With Crystal Enterprise and the Report Application Server, the Page Server and RAS server report sources are available. This allows the viewer to display reports that are accessible through a Crystal Enterprise Page Server or a RAS server. These report sources are not 100% Java-based solutions, as the underlying report rendering facilities are not written in Java. They do, however, provide additional features that are not available with the Java Reporting Component.

Some of the advantages of using a Page Server include support for caching, higher throughput, and greater scalability. Advantages of using a RAS server include support for report creation and modification, as well as additional viewers.

### Java Reporting Component

When creating a Java Reporting Component report source, the report's path can be specified in several different ways:

- File path

  This is an absolute path that specifies a report located on the machine running the Java Reporting Component.

  For example, `C:\reports\sample.rpt`.

- UNC address

  This specifies a report file that is accessible through a network resource.

  For example, `\\hostname\sample.rpt`.

- Relative file path

  For example, `reports\sample.rpt` refers to a directory called reports in the same directory as the Java Reporting Component.

- Relative URL

  This is a URL that is specified relative to the location of the Java Reporting Component.

  For example, `../reports/sample.rpt` resolves to `/WEB-INF/reports/sample.rpt` where the Java Reporting Component JAR file is in `/WEB-INF/lib`.

#### Java Reporting Component configuration

The behavior of relative paths can be modified by specifying the value of the reportlocation tag in the CrystalReportEngine-config.xml, which is located in your WEB-INF directory. The value of reportlocation must specify a location as an absolute path or as a path relative to the location of the Java Reporting Component, which is by default `WEB-INF/lib`. The value of the reportlocation tag becomes the new root directory that is used to determine the location of a report.

The CrystalReportEngine-config.xml file also allows you to configure the time out interval that determines when inactive report sources are freed up. This is necessary as inactive report sources still consume system resources such as database connections, server memory, and disk space used by temporary files. The time-out interval can be specified by setting the value of the timeout tag in the CrystalReportEngine-config.xml file. By default, the timeout interval is 10 minutes. The timeout interval only applies to inactive reports—reports that are being processed are not timed out as a result of exceeding this value. Each time a report source request is successfully completed, the timeout timer is reset. If a report source is not used within the timeout interval, it is freed up and its resources are made available to other processes.

Crystal Decisions http://www.crystaldecisions.com/ Support services http://support.crystaldecisions.com/