Klasse URLRenderData
- Alle implementierten Schnittstellen:
RenderData
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);
...
Notes for overriding
- The methods of this class must be thread safe except for the methods
getExportChunkCountandgetNextExportChunk. - Each ReportView can have its own instance of RenderData, so the different RenderData methods may be called simultaneously for different ReportViews and different RenderData instances.
- Seit:
- 7.0
-
Feldübersicht
Von Schnittstelle geerbte Felder RenderData
CASE_SENSITIVE, REGULAR_EXPRESSION, WHOLE_WORD -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungURLRenderData(String requestURL) Creates a URLRenderData object with the given URL as the location to connect to to fetch the report.URLRenderData(URL url) Creates a URLRenderData object with the given URL as the location to connect to to fetch the report. -
Methodenübersicht
Modifikator und TypMethodeBeschreibungReturns the cookie set for the next connections made by URLRenderData.getCopy()"Clones" this RenderData object with all its properties and returns the copy.intgetExportChunkCount(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[]Returns the group tree which can be sent to the java viewer as a byte array.byte[]Returns the next chunk of the exported report if there is at least one more chunk available.intReturns 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.final PropertiesReturns the Properties object used by this RenderData object.Returns the URL this report is to be found at, without any attached properties.final StringgetReportProperty(String key) Returns the chosen property value which has been set either via setReportProperty or otherwise.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.booleanReturns whether or not GET requests are set as forced.booleanCheck if the rendering of the report ran into a page limit.booleanReturns the property "promptOnRefresh", that is, whether prompts are to be shown whenever new data is fetched from the server.byte[]refreshPageData(int page) Enforces the whole report to be re-rendered on server side and returns the refreshed binary data of one page for the Java Viewer.voidNotifies 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[]Searches the given phrase in the report, starting at a certain page and using the search options given in the flags.voidSets the cookie for the next connections made by URLRenderData.voidsetForceUseGET(boolean force) If you set this to true, the URL request will never send parameters as POST parameters but only as a GET request.voidsetHostnameVerifier(HostnameVerifier hostnameVerifier) Sets aHostnameVerifierthat is used if the report has an HTTPS url.voidsetPromptOnRefresh(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.voidsetReportLocation(String url) Sets the URL to connect to to fetch the report, e.g. http://localhost:9000/?final voidsetReportProperty(String key, String value) Sets the given property for the report.voidsetReportTitle(String title) Sets the title of the report.voidsetSslSocketFactory(SSLSocketFactory sslSocketFactory) Sets aSSLSocketFactorythat is used if the report has an HTTPS url.voidstop()Sends the command "stop" to the server.
-
Konstruktordetails
-
URLRenderData
Creates a URLRenderData object with the given URL as the location to connect to to fetch the report. Note that any properties should be URL-encoded with the UTF-8 code page. Properties within this URL (such as "http://server:9000/?report=report1.rpt&prompt0=12&init=pdf") are extracted and placed into this RenderData object's properties, which can be retrieved using getProperties.- Parameter:
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!- Seit:
- 7.0
- Siehe auch:
-
URLRenderData
Creates a URLRenderData object with the given URL as the location to connect to to fetch the report. Note that any properties should be encoded within the URL in the UTF-8 code page. Properties within this URL (such as "http://server:9000/?report=report1.rpt&prompt0=12&init=pdf") are extracted and placed into this RenderData object's properties, which can be retrieved using getProperties.- Parameter:
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!- Seit:
- 7.0
- Siehe auch:
-
-
Methodendetails
-
setReportLocation
Sets the URL to connect to to fetch the report, e.g. http://localhost:9000/?report=C:/report1.rpt Note that any properties should be URL-encoded in the UTF-8 code page. Properties within this URL (such as "http://server:9000/?report=report1.rpt&prompt0=12&init=pdf") are extracted and placed into this RenderData object's properties, which can be retrieved using getProperties. The location may not be null.- Angegeben von:
setReportLocationin SchnittstelleRenderData- Parameter:
url- URL to connect to to fetch the report (Properties should be URL-encoded in the UTF-8 code page). May not be null.- Seit:
- 7.0
- Siehe auch:
-
getReportLocation
Returns the URL this report is to be found at, without any attached properties. That is, this need not return the same URL as was given in setReportLocation, however it should return a URL at which the same report is found. This will never be null. An uninitialized location will be returned as an empty string.- Angegeben von:
getReportLocationin SchnittstelleRenderData- Gibt zurück:
- The URL the report is to be found at. No properties are attached.
- Seit:
- 7.0
- Siehe auch:
-
getPageData
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. This is for performance reasons, so that the page count does not need to be requested.- Angegeben von:
getPageDatain SchnittstelleRenderData- Parameter:
page- Number of page to fetch data for, 1-based.- Gibt zurück:
- Serialized page data for the chosen page.
- Löst aus:
ViewerException- If the given page index is less than 1- Seit:
- 7.0
- Siehe auch:
-
refreshPageData
Enforces the whole report to be re-rendered on server side and returns the refreshed binary data of one page for the Java Viewer. This page is rendered anew rather than possibly taking a cached version.- Angegeben von:
refreshPageDatain SchnittstelleRenderData- Parameter:
page- 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.- Gibt zurück:
- the binary data for the Java Viewer
- Löst aus:
ViewerException- If there are connection problems or other issues while fetching the data- Seit:
- 7.0
- Siehe auch:
-
getPageCount
Returns the number of pages in the report.
This method blocks until the rendering process is finished. This is useful if you use i-net Clear Reports with external result sets or connections and you want to know when the rendering process is finished and you can close these external result sets or connections - once this method returns, the rendering process is finished. 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.- Angegeben von:
getPageCountin SchnittstelleRenderData- Gibt zurück:
- number of pages (1-based)
- Löst aus:
ViewerException- If there are rendering problems, etc.- Seit:
- 7.0
- Siehe auch:
-
isPageLimitExceeded
Check if the rendering of the report ran into a page limit. This means does not all possible pages exist.- Angegeben von:
isPageLimitExceededin SchnittstelleRenderData- Gibt zurück:
- true, if there is a limit
- Löst aus:
ViewerException- If there are rendering problems, etc.- Seit:
- 10.0
-
getNextExportChunk
Returns the next chunk of the exported report if there is at least one more chunk available. It is required that getExportChunkCount(Properties) has been called once for this report.
This method blocks until the rendering process of the requested chunk or the complete report is finished.- Angegeben von:
getNextExportChunkin SchnittstelleRenderData- Gibt zurück:
- Next chunk of the report, or null if the export is finished.
- Löst aus:
ViewerException- If there are connection problems or other issues while fetching the data- Seit:
- 7.0
- Siehe auch:
-
getExportChunkCount
Returns the total number of export "chunks" for the report for the specified export format.
A "chunk" is a unit of export data which can be retrieved using getNextExportChunk(). This method blocks until the rendering process is finished on the server. 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.
In case of gzip compression, the number of chunks can not be determined and "0" is returned. The chunks can be retrieved in a loop until getNextExportChunk() returns NULL.- Angegeben von:
getExportChunkCountin SchnittstelleRenderData- Parameter:
expProps- 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:
"pdf" - pdf file
"rtf" - rtf file
"xls" - xls file
"csv" - csv file
"ps" - ps file
"xml" -xml file
"htm" - html files, The file name is the base filename, because there are more files with links.
For a complete list of report URL properties see the documentation.- Gibt zurück:
- Total number of export "chunks" (i.e. units) which can be fetched using getNextExportChunk()
- Löst aus:
ViewerException- If there are connection problems or other issues while fetching the data- Seit:
- 7.0
- Siehe auch:
-
getGroupTree
Returns the group tree which can be sent to the java viewer as a byte array. 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.- Angegeben von:
getGroupTreein SchnittstelleRenderData- Gibt zurück:
- byte[] Group Tree as byte array, encoded by i-net Clear Reports.
- Löst aus:
ViewerException- If there are connection problems or other issues while fetching the data- Seit:
- 7.0
-
setReportTitle
Sets the title of the report. This title is what would be typically displayed in a title bar, e.g. "Employee Report 2005". Note that if this is not manually set, the title will be whatever the report has set as its title. If a title is set, it overrides the "actual" report title.- Angegeben von:
setReportTitlein SchnittstelleRenderData- Parameter:
title- Title of the report as simple string.- Seit:
- 7.0
-
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. "Employee Report 2005". This will return null if no title was manually set.- Angegeben von:
getReportTitlein SchnittstelleRenderData- Gibt zurück:
- Title of report
- Seit:
- 7.0
-
setReportProperty
Sets the given property for the report. See https://docs.inetsoftware.de/reporting/help/report-url-parameters for a list of possible properties to set here and what they mean.
Setting null as the value will cause the removal of the property. If a prompt property is to be explicitly set to the value "null", simply set the string "formula:null" as the value.- Angegeben von:
setReportPropertyin SchnittstelleRenderData- Parameter:
key- Name of property to set, will be converted to lower casevalue- Value of property to set, null to remove this property- Seit:
- 7.0
-
getProperties
Returns the Properties object used by this RenderData object. Note this is NOT a clone but rather the exact object used by RenderData - any changes made to this Properties object will influence the RenderData. See https://docs.inetsoftware.de/reporting/help/report-url-parameters for a list of possible properties to set here and what they mean.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.
- Angegeben von:
getPropertiesin SchnittstelleRenderData- Gibt zurück:
- Properties object used by RenderData, never null
- Seit:
- 7.0
-
getReportProperty
Returns the chosen property value which has been set either via setReportProperty or otherwise.- Angegeben von:
getReportPropertyin SchnittstelleRenderData- Parameter:
key- Name of property to get value for- Gibt zurück:
- Value of property with the given name
- Seit:
- 7.0
-
setPromptOnRefresh
public 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.- Angegeben von:
setPromptOnRefreshin SchnittstelleRenderData- Parameter:
promptOnRefresh- Value to set for this property- Seit:
- 7.0
-
isPromptOnRefresh
public boolean isPromptOnRefresh()Returns the property "promptOnRefresh", that is, whether prompts are to be shown whenever new data is fetched from the server.- Angegeben von:
isPromptOnRefreshin SchnittstelleRenderData- Gibt zurück:
- The property "promptOnRefresh"
- Seit:
- 7.0
-
getCopy
"Clones" this RenderData object with all its properties and returns the copy. Useful for deriving from existing RenderData objects by copying them and adding or changing properties. This method is called by the viewer for drilling down, for example - the drilldown property is set on the copy while all other properties remain the same, and the copy is used to open a new report view.- Angegeben von:
getCopyin SchnittstelleRenderData- Gibt zurück:
- A cloned copy of this RenderData object with all its properties.
- Seit:
- 7.0
- Siehe auch:
-
stop
public void stop()Sends the command "stop" to the server. Note that as of i-net Crystal-Clear 7.0, this has no effect.- Angegeben von:
stopin SchnittstelleRenderData- Seit:
- 7.0
- Siehe auch:
-
search
Searches the given phrase in the report, starting at a certain page and using the search options given in the flags. These flags are: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.
- Angegeben von:
searchin SchnittstelleRenderData- Parameter:
phrase- 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)- Gibt zurück:
- Search result by the server, encoded in the i-net Clear Reports protocol.
- Seit:
- 7.0
- Siehe auch:
-
getFontData
public byte[] getFontData(int fontID) Returns the byte array of the embedded font at the specified fontId, which is encoded in the Viewer's protocol. You need not and should not call this method yourself - rather the Viewer will call this method on its own when an embedded font needs to be fetched for the report.The fontID is 1-based.
nullwill 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.- Angegeben von:
getFontDatain SchnittstelleRenderData- Parameter:
fontID- ID of font as specified in the i-net Clear Reports protocol- Gibt zurück:
- Partial or whole font with the ID, and with the most current version of this font known to the server.
- Seit:
- 7.0
-
resetServerCacheTimeout
public 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. This method does NOT cause the report to be re-rendered under any circumstance, rather it resets the cache timeout on the server if there is one.This method will be called in regular intervals (default is every 5 minutes) by its corresponding ReportView(s).
- Angegeben von:
resetServerCacheTimeoutin SchnittstelleRenderData- Seit:
- 7.8
-
setForceUseGET
public 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. This is useful if your server cannot handle POST parameters, or if there are other connection problems causing trouble with POST parameters. Note that this may cause problems if there are too many parameters.- Parameter:
force- Whether or not to force the use of a GET request- Seit:
- 7.4
- Siehe auch:
-
isForceUseGET
public boolean isForceUseGET()Returns whether or not GET requests are set as forced.- Gibt zurück:
- whether or not GET requests are set as forced.
- Seit:
- 7.4
- Siehe auch:
-
setCookie
Sets the cookie for the next connections made by URLRenderData. If a connection has already been opened by URLRenderData, this will not change the cookie of that connection.- Parameter:
cookie- Cookie to set for the connection If null, removes any cookie set for URLRenderData.- Seit:
- 7.5
-
getCookie
Returns the cookie set for the next connections made by URLRenderData. Can return null if no cookie has been set.- Gibt zurück:
- The cookie set for the next connections made by URLRenderData.
- Seit:
- 7.5
-
setSslSocketFactory
Sets aSSLSocketFactorythat is used if the report has an HTTPS url. An own factory can e.g. accept self-signed certificates.- Parameter:
sslSocketFactory- theSSLSocketFactoryto be set for HTTPS connection. Set tonull(default) to use the default factory.- Seit:
- 9.2
-
setHostnameVerifier
Sets aHostnameVerifierthat is used if the report has an HTTPS url. An own verifier can e.g. accept self-signed certificates for other hostnames.- Parameter:
hostnameVerifier- theHostnameVerifierto be set for HTTPS connection. Set tonull(default) to use the default verifier.- Seit:
- 9.2
-