|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.inet.viewer.URLRenderData
public class URLRenderData
An implementation of RenderData for a URL connection to the i-net Clear Reports server.
The report properties are attached via URL, a connection is made to the server and the
report data is fetched.
Here are a couple of very simple examples of what could be done by creating
certain URLRenderData objects and manipulating them.
Create a URLRenderData, set two prompt values, and export the report to PDF
URLRenderData data = new URLRenderData("http://server:9000/?report=C:/report.rpt");
File file = new File("C:/test.pdf");
FileOutputStream fos = new FileOutputStream(file);
Properties props = data.getProperties();
props.setProperty( "export_fmt", "pdf" );
props.setProperty( "file", "c:/test.pdf" );
int count = data.getExportChunkCount( props );
for(int i=1;count == 0 || i<=count;i++){ // count can be 0 if there is gzip compression
byte[] pageData = data.getNextExportChunk();
if( pageData != null ) {
fos.write( pageData );
} else {
break;
}
}
fos.close();
Create a URLRenderData and pass it to the constructor of a ReportView as a data source
URLRenderData data = new URLRenderData("http://server:9000/?report=C:/abc.rpt");
SwingReportViewer viewer = new SwingReportViewer();
viewer.addNewReportView(data);
...
getExportChunkCount and getNextExportChunk.
| Field Summary |
|---|
| Fields inherited from interface com.inet.viewer.RenderData |
|---|
CASE_SENSITIVE, REGULAR_EXPRESSION, WHOLE_WORD |
| Constructor Summary | |
|---|---|
URLRenderData(java.lang.String requestURL)
Creates a URLRenderData object with the given URL as the location to connect to to fetch the report. |
|
URLRenderData(java.net.URL url)
Creates a URLRenderData object with the given URL as the location to connect to to fetch the report. |
|
| Method Summary | |
|---|---|
java.lang.String |
getCookie()
Returns the cookie set for the next connections made by URLRenderData. |
RenderData |
getCopy()
"Clones" this RenderData object with all its properties and returns the copy. |
int |
getExportChunkCount(java.util.Properties expProps)
Returns the total number of export "chunks" for the report for the specified export format. |
byte[] |
getFontData(int fontID)
Returns the byte array of the embedded font at the specified fontId, which is encoded in the Viewer's protocol. |
byte[] |
getGroupTree()
Returns the group tree which can be sent to the java viewer as a byte array. |
byte[] |
getNextExportChunk()
Returns the next chunk of the exported report if there is at least one more chunk available. |
int |
getPageCount()
Returns the number of pages in the report. |
byte[] |
getPageData(int page)
Any page number greater than 0 is viewed as valid - if the page number is higher than the number of pages in the report, this will return the data from the last page. |
java.util.Properties |
getProperties()
Returns the Properties object used by this RenderData object. |
java.lang.String |
getReportLocation()
Returns the URL this report is to be found at, without any attached properties. |
java.lang.String |
getReportProperty(java.lang.String key)
Returns the chosen property value which has been set either via setReportProperty or otherwise. |
java.lang.String |
getReportTitle()
Returns the manually set title of the report if there is one, that is, what would be typically displayed in a title bar, e.g. |
boolean |
isForceUseGET()
Returns whether or not GET requests are set as forced. |
boolean |
isPageLimitExceeded()
Check if the rendering of the report ran into a page limit. |
boolean |
isPromptOnRefresh()
Returns the property "promptOnRefresh", that is, whether prompts are to be shown whenever new data is fetched from the server. |
byte[] |
refreshPageData(int page)
Returns the binary data of one page for the Java Viewer, however, it causes the page to be rendered anew rather than possibly taking a cached version. |
void |
resetServerCacheTimeout()
Notifies the server that the report with the currently set properties is still being viewed and therefore should not be removed from the cache yet if there is one. |
byte[] |
search(java.lang.String phrase,
int startPage,
int flags)
Searches the given phrase in the report, starting at a certain page and using the search options given in the flags. |
void |
setCookie(java.lang.String cookie)
Sets the cookie for the next connections made by URLRenderData. |
void |
setForceUseGET(boolean force)
If you set this to true, the URL request will never send parameters as POST parameters but only as a GET request. |
void |
setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
Sets a HostnameVerifier that is used if the report has an HTTPS url. |
void |
setPromptOnRefresh(boolean promptOnRefresh)
Sets the property "promptOnRefresh", that is, whether prompts are to be shown whenever the report is refreshed, that is, whenever new data is fetched from the server. |
void |
setReportLocation(java.lang.String url)
Sets the URL to connect to to fetch the report, e.g. http://localhost:9000/? |
void |
setReportProperty(java.lang.String key,
java.lang.String value)
Sets the given property for the report. |
void |
setReportTitle(java.lang.String title)
Sets the title of the report. |
void |
setSslSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory)
Sets a SSLSocketFactory that is used if the report has an HTTPS url. |
void |
stop()
Sends the command "stop" to the server. |
| Constructor Detail |
|---|
public URLRenderData(java.lang.String requestURL)
requestURL - URL to connect to to fetch the report (Properties should be URL-encoded with the UTF-8 code page)
If this is null, before connecting to fetch a report, setReportLocation must be called!RenderData.setReportLocation(java.lang.String),
URLRenderData(URL)public URLRenderData(java.net.URL url)
url - URL to connect to to fetch the report (Properties should be URL-encoded in the UTF-8 code page.)
If this is null, before connecting to fetch a report, setReportLocation must be called!RenderData.setReportLocation(java.lang.String),
URLRenderData(String)| Method Detail |
|---|
public void setReportLocation(java.lang.String url)
setReportLocation in interface RenderDataurl - URL to connect to to fetch the report (Properties should be URL-encoded in the UTF-8 code page). May not be null.RenderData.setReportLocation(java.lang.String)public java.lang.String getReportLocation()
getReportLocation in interface RenderDataRenderData.getReportLocation()
public byte[] getPageData(int page)
throws ViewerException
getPageData in interface RenderDatapage - Number of page to fetch data for, 1-based.
ViewerException - If the given page index is less than 1RenderData.getPageData(int)
public byte[] refreshPageData(int page)
throws ViewerException
refreshPageData in interface RenderDatapage - The number of the page. The first page is 1, the second is 2, ... .
If the page number is bigger than the page count the data from the last page will be returned.
ViewerException - If there are connection problems or other issues while
fetching the dataRenderData.getPageCount()
public int getPageCount()
throws ViewerException
getPageCount in interface RenderDataViewerException - If there are rendering problems, etc.RenderData.getPageData(int)
public boolean isPageLimitExceeded()
throws ViewerException
isPageLimitExceeded in interface RenderDataViewerException - If there are rendering problems, etc.
public byte[] getNextExportChunk()
throws ViewerException
getNextExportChunk in interface RenderDataViewerException - If there are connection problems or other issues while fetching the dataRenderData.getExportChunkCount(Properties)
public int getExportChunkCount(java.util.Properties expProps)
throws ViewerException
getExportChunkCount in interface RenderDataexpProps - Properties to be appended to the current report properties for this export.
The properties should contain at least the export format with the key "export_fmt". The following
formats are valid:ViewerException - If there are connection problems or other issues while fetching the dataRenderData.getNextExportChunk(),
RenderData.getProperties()
public byte[] getGroupTree()
throws ViewerException
getGroupTree in interface RenderDataViewerException - If there are connection problems or other issues while fetching the datapublic void setReportTitle(java.lang.String title)
setReportTitle in interface RenderDatatitle - Title of the report as simple string.public java.lang.String getReportTitle()
getReportTitle in interface RenderData
public final void setReportProperty(java.lang.String key,
java.lang.String value)
setReportProperty in interface RenderDatakey - Name of property to set, will be converted to lower casevalue - Value of property to set, null to remove this propertypublic final java.util.Properties getProperties()
Note also that any key values should be set in lower case. This Properties object will never be null, at most it will be empty.
getProperties in interface RenderDatapublic final java.lang.String getReportProperty(java.lang.String key)
getReportProperty in interface RenderDatakey - Name of property to get value for
public void setPromptOnRefresh(boolean promptOnRefresh)
setPromptOnRefresh in interface RenderDatapromptOnRefresh - Value to set for this propertypublic boolean isPromptOnRefresh()
isPromptOnRefresh in interface RenderDatapublic RenderData getCopy()
getCopy in interface RenderDataReportViewer.addNewReportView(RenderData),
RenderData.getProperties()public void stop()
stop in interface RenderDataRenderData.stop()
public byte[] search(java.lang.String phrase,
int startPage,
int flags)
WHOLE_WORD : search only the word in its entirety, not parts of words.
CASE_SENSITIVE : observe upper and lower cases in the search, that is "Search" != "search"
REGULAR_EXPRESSION : The search phrase is to be handled as a regular expression (using Java's Regex
methods for the search).
Desired flags should be connected by the OR operator "|". So, for example, to search with the flags WHOLE_WORD and CASE_SENSITIVE, simply use WHOLE_WORD | CASE_SENSITIVE as the flags option.
Note that phrases going over more than one page will not be found, nor will text parts with formatting inside the word itself, such as this word. Note that this method is thread-safe, that is, two or more threads concurrently calling this method and the other thread-safe methods in RenderData should cause no problems.
search in interface RenderDataphrase - Word or phrase to search. Should be a regular expression if this flag is set.startPage - Page to start searching on (1-based)flags - Desired search options (see above)
RenderData.WHOLE_WORD,
RenderData.CASE_SENSITIVE,
RenderData.REGULAR_EXPRESSIONpublic byte[] getFontData(int fontID)
The fontID is 1-based. null will be returned if there are no fonts embedded for the
report of this Engine. If fontID is greater than the number of embedded
fonts available it will return the last font available. This method is the mirror method to com.inet.report.Engine.getFontData(int),
so implementations can either call that if an engine is available, or a running i-net Clear Reports server
also returns the font data with an HTTP request of the form
"http://server:9000/?report=report.rpt&export_fmt=font&page=FONTID&cmd=get_pg" where FONTID is replaced with the given font ID.
Note that this method is thread-safe, that is, two or more threads concurrently calling
this method and the other thread-safe methods in RenderData should cause no problems.
getFontData in interface RenderDatafontID - ID of font as specified in the i-net Clear Reports protocol
public void resetServerCacheTimeout()
This method will be called in regular intervals (default is every 5 minutes) by its corresponding ReportView(s).
resetServerCacheTimeout in interface RenderDatapublic void setForceUseGET(boolean force)
force - Whether or not to force the use of a GET requestisForceUseGET()public boolean isForceUseGET()
setForceUseGET(boolean)public void setCookie(java.lang.String cookie)
cookie - Cookie to set for the connection If null, removes any cookie
set for URLRenderData.public java.lang.String getCookie()
public void setSslSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory)
SSLSocketFactory that is used if the report has an HTTPS url. An own factory can e.g. accept
self-signed certificates.
sslSocketFactory - the SSLSocketFactory to be set for HTTPS connection. Set to null
(default) to use the default factory.public void setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
HostnameVerifier that is used if the report has an HTTPS url. An own verifier can e.g. accept
self-signed certificates for other hostnames.
hostnameVerifier - the HostnameVerifier to be set for HTTPS connection. Set to null
(default) to use the default verifier.
|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||