com.crystaldecisions.report.web
Class ServerControl

java.lang.Object
  extended bycom.crystaldecisions.report.web.ServerControl
Direct Known Subclasses:
ReportServerControl

public abstract class ServerControl
extends java.lang.Object

This is an abstract class. Use the derived classes such as CrystalReportViewer and ReportServerControl.


Constructor Summary
ServerControl()
           
 
Method Summary
 int getHeight()
          Returns the viewer height.
 java.lang.String getHtmlContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext context)
          This method handles the user's request to generate the HTML for the report and returns the HTML as a String.
 int getLeft()
          Returns the value for the position of the left side of the viewer.
 java.lang.String getName()
          Returns the name of the viewer control.
 java.util.Locale getProductLocale()
           Gets the locale setting used to display all text and formatting generated by the viewer (such as the toolbar).
 int getTop()
          Returns the value for the position of the top of the viewer.
 java.lang.String getURI()
          Returns the Universal Resource Identifier for the web page containing the viewer.
 java.lang.String getViewState()
          Returns the view state.
 int getWidth()
          Returns the viewer width.
 boolean isIgnoreViewStateOnLoad()
          Returns whether the view state is ignored when loading the viewer.
 boolean isOwnForm()
          Returns whether or not the viewer control owns the form.
 boolean isOwnPage()
          Sets whether the viewer control owns the page.
 void processHttpRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext context, java.io.Writer out)
          Handles the user's request to generate the HTML for the report and writes the HTML directly to the response object.
 void setHeight(int newM_Height)
          Sets the viewer height.
 void setIgnoreViewStateOnLoad(boolean newIgnoreViewStateOnLoad)
          Sets whether to ignore the view state when loading the viewer.
 void setLeft(int newM_Left)
          Sets the position for the left side of the viewer.
 void setName(java.lang.String newName)
          Sets the name for the viewer control.
 void setOwnForm(boolean newOwnForm)
          Sets whether the viewer control owns the form.
 void setOwnPage(boolean newOwnPage)
          Sets whether the viewer control owns the page.
 void setProductLocale(java.util.Locale locale)
           Sets the locale setting used to display all text and formatting generated by the viewer (such as the toolbar).
 void setTop(int newM_Top)
          Sets the value for the position of the top of the viewer.
 void setURI(java.lang.String newURI)
          Sets the Universal Resource Identifier for the report.
 void setViewState(java.lang.String viewState)
          The ViewState is an encoded string that represents the current state of the report.
 void setWidth(int newM_Width)
          Sets the width of the viewer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerControl

public ServerControl()
Method Detail

getHeight

public int getHeight()

Returns the viewer height.

Returns:
The height of the viewer as an int. The unit is browser-dependent.
See Also:
setHeight

getHtmlContent

public final java.lang.String getHtmlContent(javax.servlet.http.HttpServletRequest request,
                                             javax.servlet.http.HttpServletResponse response,
                                             javax.servlet.ServletContext context)
                                      throws ReportSDKExceptionBase

This method handles the user's request to generate the HTML for the report and returns the HTML as a String.

Note: Either the getHtmlContent method or the processHttpRequest method can be used to handle the user's request to generate the HTML for the report, depending on how you write your JSP. If the viewer's content is displayed more than once, then the getHtmlContent method is more efficient, because the request is processed once and the resulting HTML string can be used multiple times. In this case, you must set the content type of the HTML, as recommended in the table. Additionally, using getHtmlContent sets setOwnPage to false and disables exporting and printing.

Viewing format Recommended HTML content type
Standard web reporting "text/html; charset=UTF-8"
Mobile "text/html" or "text/vnd.wap.wml"
PDA "text/html; charset=UTF-8"

Note: Mobile and PDA content types are not supported by the Java Reporting Component.

Note: The getHtmlContent method cannot be used with the export control.

Parameters:
request - A HttpServletRequest object containing the values passed to the server during an Http request.
response - A HttpServletResponse object that receives the HTML output and sends it to the client.
context - A ServletContext object that specifies the servlet context.
Returns:
The HTML content as a String.
Throws:
ReportSDKExceptionBase

getLeft

public int getLeft()

Returns the value for the position of the left side of the viewer.

Returns:
The position of the left side of the viewer as an int. The unit is browser-dependent.
See Also:
setLeft

getName

public java.lang.String getName()

Returns the name of the viewer control. By default the viewer control is named CrystalViewer.

Returns:
The name of the viewer control as a String.
See Also:
setName

getTop

public int getTop()

Returns the value for the position of the top of the viewer.

Returns:
The position of the top of the viewer as an int for. The unit is browser-dependent.
See Also:
setTop

getURI

public java.lang.String getURI()

Returns the Universal Resource Identifier for the web page containing the viewer.

Returns:
The Universal Resource Identifier for the report as a String.
See Also:
setURI

getViewState

public java.lang.String getViewState()

Returns the view state. This is an encoded string that represents the current state of the report. The ViewState is used in order to perform client-side caching of information about the current state of the report. By default, the viewer will manage the ViewState unless isOwnForm is set to false.

Returns:
An encoded String that represents the current state of the report.
See Also:
setOwnForm, isOwnForm, setViewState

getWidth

public int getWidth()

Returns the viewer width.

Returns:
The viewer width as an int. The unit is browser-dependent.
See Also:
setWidth

isIgnoreViewStateOnLoad

public boolean isIgnoreViewStateOnLoad()

Returns whether the view state is ignored when loading the viewer. You would want this to be set to true if the viewer is loaded in order to display a different page of the report.

Returns:
true if the view state is ignored and false otherwise.
See Also:
setIgnoreViewStateOnLoad

isOwnForm

public boolean isOwnForm()

Returns whether or not the viewer control owns the form. If the server control owns the form it is able to get and set values for the form. In particular, by owning the form, the viewer control creates the ViewState object that is used in order to perform client-side caching of information about the current state of the report.

If this is set to false, it is the host's responsibility to use getViewState() and store the returned view state in a location that will be accessible in the subsequent request. The host must then use setViewState before calling processHttpRequest to restore the state of the viewer object.

Returns:
true if the server control owns the form and false otherwise. By default, this value is true.
See Also:
setViewState, getViewState, setOwnForm

isOwnPage

public boolean isOwnPage()

Sets whether the viewer control owns the page. Setting isOwnPage to true provides several benefits, by allowing the viewer to completely handle the surrounding HTML content. Allowing the viewer to handle the surrounding HTML content reduces the amount of code you need to add to your JSP page and allows the viewer to automatically determine certain settings:

Set this attribute to false if the page is within a portal or if there is any other content on the page.

Note: If isOwnPage is false, the surrounding <HTML> tags and content-type and charset directives need to be manually set. Additionally, when isOwnPage is false, the printing and exporting features are disabled.

Returns:
true if the viewer owns the page and false otherwise.
See Also:
setOwnPage

processHttpRequest

public final void processHttpRequest(javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response,
                                     javax.servlet.ServletContext context,
                                     java.io.Writer out)
                              throws ReportSDKExceptionBase

Handles the user's request to generate the HTML for the report and writes the HTML directly to the response object.

Note: Either the getHtmlContent method or the processHttpRequest method can be used to handle the user's request to generate the HTML for the report, depending on how you write your JSP. If the viewer's content is to be displayed more than once, then the getHtmlContent method is more efficient, because the request is processed once and the resulting HTML string can be used multiple times. However, using getHtmlContent sets setOwnPage to false and disables exporting and printing.

Note: If you provide your own writer then you must set the charset and the content-type. For improved performance, you may wish to wrap your writer in a java.io.BufferedWriter.

Note: The processHttpRequest method cannot be used with the export control.

Parameters:
response - A HttpServletResponse object that receives the HTML output and sends it to the client.
context - A ServletContext object that specifies the servlet context.
request - The HttpServletRequest object containing the values passed to the server during an Http request.
out - A Writer object. This value is set to null unless you are providing your own writer.
Throws:
ReportSDKExceptionBase

setHeight

public void setHeight(int newM_Height)

Sets the viewer height.

Note: Together, the setHeight and setWidth methods control the viewable size of the viewer. The default value is 0 (zero). If these methods are set to zero, the viewable size of the viewer is calculated based on the report the user is viewing.

If the setBestFitPage method is set to true, the values of the setHeight and setWidth methods are ignored.

The interactive viewer always ignores the values of the setHeight and setWidth methods.

Parameters:
newM_Height - An int that specifies the height of the viewer. The unit is browser-dependent.
See Also:
getHeight

setIgnoreViewStateOnLoad

public void setIgnoreViewStateOnLoad(boolean newIgnoreViewStateOnLoad)

Sets whether to ignore the view state when loading the viewer. You would want this to be set to true, if the viewer is loaded in order to display a different page of the report.

Note: If this property is set to true, the viewer will behave as though the report is being viewed at its initial state. For example, pressing next page will always navigate to page 2, if the initial view of the report began on page 1.

Parameters:
newIgnoreViewStateOnLoad - true to make the viewer ignore the ViewState when loading.
See Also:
isIgnoreViewStateOnLoad

setLeft

public void setLeft(int newM_Left)

Sets the position for the left side of the viewer.

Parameters:
newM_Left - An int that specifies the position for the left side of the viewer. The unit is browser-dependent.
See Also:
getLeft

setName

public void setName(java.lang.String newName)

Sets the name for the viewer control. By default the viewer control is named CrystalViewer.

Note: The Crystal Report Server Control supports multiple versions of the viewer co-existing in the same web page, as long as each viewer has a unique name. If the Name property is set to a non-empty value, it is used as the ObjectID in the query string. The ObjectID identifies the viewer that will handle a request.

Due to the internal uses of this property, any special characters (including punctuation, spacing, and Unicode characters) are stripped from the value when it is set. When using multiple viewers on the same page, you must ensure that the viewer names will still be unique even after these changes are made.

Displaying multiple viewers on the same page is not supported by the interactive viewer. As such, the interactive viewer should not be displayed on the same page as another viewer (including another interactive viewer). Additionally, the CrystalReportExportControl does not support multiple controls on the same page.

Parameters:
newName - The String that specifies the name of the viewer control.
See Also:
getName

setOwnForm

public void setOwnForm(boolean newOwnForm)

Sets whether the viewer control owns the form. If the server control owns the form it is able to get and set values for the form. In particular, by owning the form, the viewer control is able to cache its state to the client side.

If this is set to false, it is the host's responsibility to use getViewState() and store the returned view state in a location that will be accessible in the subsequent request. The host must then use setViewState before calling processHttpRequest to restore the state of the viewer object.

Parameters:
newOwnForm - true if the server control owns the form and false otherwise. By default, this value is true.
See Also:
setViewState, getViewState, isOwnForm

setOwnPage

public void setOwnPage(boolean newOwnPage)

Sets whether the viewer control owns the page. Setting setOwnPage to true provides several benefits, by allowing the viewer to completely handle the surrounding HTML content. Allowing the viewer to handle the surrounding HTML content reduces the amount of code you need to add to your JSP page and allows the viewer to automatically determine certain settings:
- It allows the viewer to choose which page start and end tags to use based on what device is being used to view the page. For example, it writes out the HTML start tag for web browsers and WML start tag for mobile devices.
- It correctly sets the content-type and charset information for the page. This ensures that pages containing international characters is displayed correctly.
- It automatically enables export and print button support in the viewer.

Set this attribute to false if the page is within a portal or if there is any other content on the page. If you have multiple viewers on a single page, you must set this property to false and manually configure the code page, content type and character set.

Note: If setOwnPage is false, the surrounding HTML tags and content-type and charset directives need to be manually set. Additionally, when setOwnPage is false, the printing and exporting features are disabled.

Parameters:
newOwnPage - true to make the viewer object own the page. The default value is true.
See Also:
isOwnPage

setTop

public void setTop(int newM_Top)

Sets the value for the position of the top of the viewer.

Parameters:
newM_Top - An int value for the position of the top of the viewer. The unit is browser-dependent.
See Also:
getTop

setURI

public void setURI(java.lang.String newURI)

Sets the Universal Resource Identifier for the report.

Note: For a standard HTML browser, you can have the viewer post a query string (such as, http://www.myweburl.com/myviewerpage.asp?myvar=myvalue) to the web server by setting the URI property. This method may not work for some wireless devices.

Parameters:
newURI - A String that specifies the Universal Resource Identifier for the report.
See Also:
getURI

setViewState

public void setViewState(java.lang.String viewState)

The ViewState is an encoded string that represents the current state of the report. The ViewState is used in order to perform client-side caching of information about the current state of the report. By default, the viewer will manage the ViewState unless isOwnForm is set to false.

Note: Since the internal format of the view state string is subject to change, it is recommended that you do not parse the view state string.

Parameters:
viewState - An encoded String that represents the current state of the report.
See Also:
getViewState, setOwnForm, isOwnForm

setWidth

public void setWidth(int newM_Width)

Sets the width of the viewer.

Note: Together, the setHeight and setWidth methods control the viewable size of the viewer. The default value is 0 (zero). If these methods are set to zero, the viewable size of the viewer is calculated based on the report the user is viewing.

If the setBestFitPage method is set to true, the values of the setHeight and setWidth methods are ignored.

The interactive viewer always ignores the values of the setHeight and setWidth methods.

Parameters:
newM_Width - An int value for the width of the viewer. The unit is browser-dependent.
See Also:
getWidth

getProductLocale

public java.util.Locale getProductLocale()

Gets the locale setting used to display all text and formatting generated by the viewer (such as the toolbar). The productLocale setting does not apply to text associated with the report content (the browser locale is used to determine how to format report-related text). Additionally, the productLocale setting does not apply to the groupTree text.

Returns:
the locale as a java.util.Locale object.

setProductLocale

public void setProductLocale(java.util.Locale locale)

Sets the locale setting used to display all text and formatting generated by the viewer (such as the toolbar). The productLocale setting does not apply to text associated with the report content (the browser locale is used to determine how to format report-related text). Additionally, the productLocale setting does not apply to the groupTree text.