## com.crystaldecisions.report.web
Class ServerControl

    java.lang.Object
      com.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
`static java.lang.Object` | `deserializeBase64ToObject(java.lang.String base64)` For internal use only.
`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.
`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 `ViewState`.
`int` | `getWidth()` Returns the viewer width.
`boolean` | `isIgnoreViewStateOnLoad()` Returns whether the view state will be ignored when loading the viewer.
`boolean` | `isOwnForm()` Returns whether or not the viewer control owns the form.
`boolean` | `isOwnPage()` Returns whether or not 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` | `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

### deserializeBase64ToObject

    public static java.lang.Object deserializeBase64ToObject(java.lang.String base64)
                                                      throws java.io.IOException,
                                                             java.lang.ClassNotFoundException

  For internal use only.

  Throws:
    `java.io.IOException`
    `java.lang.ClassNotFoundException`

### 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 will be displayed more than once, then the `getHtmlContent` method will be 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.

  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"

  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 `ViewState`. 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 will be 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 will be 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 set persistence (form, session). The host may use `setViewState` before calling `processHttpRequest();` if not the control will obtain it from the request 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()

  Returns whether or not the viewer control owns the page. In other words, the page is not within a portal and the JSP page only contains the viewer control. If the server control owns the page, it provides the opening and closing HTML tags and it is able to get and set values for the entire page.

  Returns:
    `true` if the server control 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 will be displayed more than once, then the `getHtmlContent` method will be more efficient, because the request is processed once and the resulting HTML string can be used multiple times.

  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`.

  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.

  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.

  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.

  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. By default this is `true`. If this is set to `false`, it is the host's responsibility to `getViewState()` and set persistence (form, session). The host may setViewState before calling `processHttpRequest();` if not the control will obtain it from the request object.

  Parameters:
    `newOwnForm` - `true` to make the viewer object own the form. By default this is `true`.
  See Also:
    `setViewState`, `getViewState`, `isOwnForm`

### setOwnPage

    public void setOwnPage(boolean newOwnPage)

  Sets whether the viewer control owns the page. Set this to `false` if the page is within a portal. If the server control owns the page, it provides the opening and closing HTML tags and it is able to get and set values for the entire page.

  Note: If you set `setOwnPage` to false then you must set the `charset` and the `content-type`.

  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.

  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`.

  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.

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