The repository services can also be used to read and write Domains. Like JasperReport resources, Domains are complex resources that contain other files. The files that make up a Domain are its Domain schema, its optional security files, and its optional language bundles. You can find the name and location of these files by requesting the Domain itself. For example, the following request shows the contents of the Supermart Domain:
GET http://localhost:8080/jasperserver-pro/rest/resource/Domains/supermartDomain
All repository URIs sent and received are relative the organization of the user ID that performs the REST operation. The URIs in this section assume the user is an organization admin such as jasperadmin. |
Looking carefully through the resulting descriptor, we find the relevant information:
The files contained in this Domain are:
• | /Domains/supermartDomain_files/supermartDomain_schema |
• | /Domains/supermartDomain_files/supermartDomain_domain_security |
• | /Domains/supermartDomain_files/supermart_domain.properties |
• | /Domains/supermartDomain_files/supermart_domain_en_US.properties |
• | ... |
To download these files, use the same syntax as for downloading file resource contents:
GET http://localhost:8080/jasperserver-pro/rest/resource/Domains/supermartDomain_files/
supermartDomain_schema?fileData=true
Domain schema files, security files, and language bundles have a special syntax described in the JasperReports Server User Guide. To process these files automatically, you would need to write your own parser.
If you have valid schema files, security files, and language bundles, you can also create Domain resources in the repository using the PUT method described in section Creating a Resource. The following procedure outlines the step required to create a Domain resource programmatically through the REST API:
1. | Create the resource descriptor for the Domain using the descriptor shown above as an example. Make sure the files are referenced correctly in the descriptor. |
2. | Create the PUT request to the resource service using the resource descriptor created in the previous step. |
3. | Add the files to the request as multi-part request. For example use the class org.apache.http.entity.mime. MultipartEntity to build a multi-part request. Add each file as a separate part to the request. |
4. | Send the multi-part request to JasperReports Server. |
5. | Process the response to verify the request was successful. |
Recommended Comments
There are no comments to display.