You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
14.[REST Server Information](#rest-server-information).
110
-
15.[Internalization](#internalization).
112
+
15.[Bundles service](#bundles-service).
111
113
16.[Exception handling](#exception-handling).
112
114
17.[Asynchronous API](#asynchronous-api).
113
115
18.[Getting serialized content from response](#getting-serialized-content-from-response).
@@ -151,6 +153,12 @@ TrustManager[] trustManagers = new TrustManager[1];
151
153
trustManagers[0] = x509TrustManager;
152
154
configuration.setTrustManagers(trustManagers);
153
155
```
156
+
####X-HTTP-Method override
157
+
To avoid situation, when your proxies or web services do not support arbitrary HTTP methods or newer HTTP methods, you can use “restricted mode”. In this mode `JaperserverRestClient` sends requests through POST method and set the `X-HTTP-Method-Override` header with value of intended HTTP method. To use this mode you should set flag `RestrictedHttpMethods`:
If you do not use the "restricted mode", POST or GET methods and server returns the response with 411 error code, `JaperserverRestClient` resend this request through POST method with the X-HTTP-Method-Override header automatically.
154
162
####Client instantiation:
155
163
Here everything is easy, you need just to pass `configuration` to `JasperserverRestClient` constructor.
`JasperserverRestClient` supports three authentication types: REST, SPRING and BASIC.
169
-
`REST` type of authentication means that your credentials are sent through `/rest/login`, and in the `SPRING` mode – through `/j_security_check directly/`. Using these types you obtain JSESSIONID cookie of authenticated session after sending credentials.
176
+
`JasperserverRestClient` supports two authentication types: SPRING and BASIC.
177
+
`SPRING` type of authentication means that your credentials are sent as a form to `/j_security_check directly/` uri. Using these types you obtain JSESSIONID cookie of authenticated session after sending credentials.
170
178
In the `BASIC` mode `JasperserverRestClient` uses basic authentication (sends encrypted credentials with each request).
171
-
Client uses `REST` authentication by default but you can change the mode using follow code:
179
+
Client uses `SPRING` authentication by default but you can specify authentication type in RestClientConfiguration instance:
Or specify authentication type in RestClientConfiguration instance (for details, read section [Configuration](https://github.com/Jaspersoft/jrs-rest-java-client/blob/master/README.md#configuration).
176
-
Please notice, the basic authentication is not stateless and it is valid till method logout() is called or the application is restarted.
177
-
183
+
Or set authentication type in configuration file (for details, read section [Configuration](https://github.com/Jaspersoft/jrs-rest-java-client/blob/master/README.md#configuration)).
184
+
Please notice, the basic authentication is not stateless and it is valid till method logout() is called or the application is restarted and you can not use this authentication type for Report Service authentication (for details, read section [Configuration](https://github.com/Jaspersoft/jrs-rest-java-client/blob/master/README.md#report-services)).
185
+
###Anonymous session
186
+
For some Jasperserver services authentication is not required (for example, settings service and server info service), so you can use anonymous session:
.parameter("Cascading_name_single_select", "A & U Stalker Telecommunications, Inc")
225
+
.run();
226
+
```
227
+
Also you can use this method to run report with several values for the same parameter. In this case new values of the parameter are added to the previous ones (new values do not replace previous values of the parameter):
Please notice, if you pass zero as number of page, you will get all pages of report.
205
241
In this mode you don't need to work in one session. In the above code we specified report URI, format in which we want to get a report and some report parameters. As we a result we got `InputStream` instance. In synchronous mode as a response you get a report itself while in asynchronous you get just a descriptor with report ID which you can use to download report afer it will be ready.
206
242
207
243
In order to run a report in asynchronous mode, you need firstly build `ReportExecutionRequest` instance and specify all the parameters needed to launch a report. The response from the server is the `ReportExecutionDescriptor` instance which contains the request ID needed to track the execution until completion and others report parameters. Here's the code to run a report:
@@ -211,7 +247,7 @@ ReportExecutionRequest request = new ReportExecutionRequest();
In the above code we've created `ReportExecutionRequest` instance and sent it to JR server through the `newReportExecutionRequest` method. As a response we've got `OperationResult` instance which contains HTTP response wrapper and instance of `ReportExecutionDescriptor` which we can get with `operationResult.getEntity()`.
After running a report and downloading its content in a given format, you can request the same report in other formats. As with exporting report formats through the user interface, the report does not run again because the export process is independent of the report.
@@ -402,7 +446,8 @@ To create an organization, put all information in an organization descriptor, an
402
446
```java
403
447
Organization organization =newOrganization();
404
448
organization.setAlias("myOrg1");
405
-
449
+
```
450
+
``java
406
451
OperationResult<Organization> result = session
407
452
.organizationsService()
408
453
.organizations()
@@ -842,18 +887,25 @@ Settings Service
842
887
843
888
It provides method that allow you to get server specific settings, required by UI to work with the server in sync. There can be formats and patterns, modes for some modules etc.
844
889
845
-
####Getting settings
846
-
To get settings, use the `getEntity()` method and specify the group of settings in the `group()` method. The method `getEntity()` returns map of settings where the keys in the map are names of the settings and values can be any objects.
847
-
890
+
####Getting server specific settings
891
+
To get settings, use the `getEntity()` method and specify the group of settings in the `group()` method and class of entity as shown below. The method `getEntity()` returns instance of specified class:
848
892
```java
849
893
finalMap settings = session
850
894
.settingsService()
851
895
.settings()
852
-
.group(group)
896
+
.group(group, Map.class)
853
897
.getEntity();
854
898
855
899
```
856
-
Supported groups are:
900
+
Please notice, you can get settings of user’s time zones in this way as List only:
901
+
```java
902
+
finalList settings = session
903
+
.settingsService()
904
+
.settings()
905
+
.group("userTimeZones", List.class)
906
+
.getEntity();
907
+
```
908
+
Supported groups of settings are:
857
909
858
910
1. “request”. Settings related to current AJAX request configuration. Returned settings are: maxInactiveInterval, contextPath;
859
911
@@ -877,6 +929,42 @@ Supported groups are:
877
929
878
930
11. “adhocview”. Different configuration dictionary values and lists for ad hoc. Configuration of settings depends on configuration of Jaspersoft server.
879
931
932
+
There is another way to get settings using specified methods for groups of settings that return specific object of settings:
933
+
```java
934
+
FinalRequestSettings settings = session
935
+
.settingsService()
936
+
.settings()
937
+
.ofRequestGroup()
938
+
.getEntity();
939
+
```
940
+
Pleace notice, you should use List interface to get user’s time zones setting in this way:
941
+
```java
942
+
finalList<UserTimeZone> settings = session
943
+
.settingsService()
944
+
.settings()
945
+
.ofUserTimeZonesGroup()
946
+
.getEntity();
947
+
```
948
+
Or you can get List of specified DTO for user’s time zones using GenericType class:
@@ -1484,13 +1572,13 @@ OperationResult<String> result = client
1484
1572
1485
1573
String edition = result.getEntity();
1486
1574
```
1487
-
###Internalization
1575
+
###Bundles service
1488
1576
Use bundles service to get bundles of internalization properties for particular or default user’s locale as JSON. To get all bundles for particular locale(foe example, "de") use the code below:
1489
1577
```java
1490
1578
finalJSONObject bundles = session
1491
1579
.bundlesService()
1492
1580
.forLocale("de")
1493
-
.bundles()
1581
+
.allBundles()
1494
1582
.getEntity();
1495
1583
```
1496
1584
If you pass `null` in `.forLocale()` method, you will get bundles for your default locale.
@@ -1499,7 +1587,7 @@ To get bundle by name you should specified locale in `.forLocale()` method and n
Copy file name to clipboardExpand all lines: src/integration-test/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/attributes/ServerAttributesServiceIT.java
Copy file name to clipboardExpand all lines: src/integration-test/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/authority/users/UsersServiceIT.java
Copy file name to clipboardExpand all lines: src/integration-test/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/bundles/BundlesServiceIT.java
0 commit comments