diff --git a/src/plugins/restAPI/changelog.html b/src/plugins/restAPI/changelog.html index 940bedf43a6eb6da8785c3ba135e9215108d7ee4..14c066724b7aee4ab820f3b764d95435183d7903 100644 --- a/src/plugins/restAPI/changelog.html +++ b/src/plugins/restAPI/changelog.html @@ -44,6 +44,11 @@ REST API Plugin Changelog </h1> +<p><b>1.3.2</b> -- April 25th, 2018</p> +<ul> + <li>Added: GZIP compression</li> +</ul> + <p><b>1.3.1</b> -- April 20th, 2018</p> <ul> <li>Fixed: That created rooms were not propagated to other nodes <a href="https://issues.igniterealtime.org/browse/OF-1535">OF-1535</a></li> diff --git a/src/plugins/restAPI/plugin.xml b/src/plugins/restAPI/plugin.xml index 6f92f23ec42a5243015c024dca49f54d293bda3a..683d39663b09b2731d855b263fb9be21e055bb9f 100644 --- a/src/plugins/restAPI/plugin.xml +++ b/src/plugins/restAPI/plugin.xml @@ -5,8 +5,8 @@ <name>REST API</name> <description>Allows administration over a RESTful API.</description> <author>Roman Soldatow</author> - <version>1.3.1</version> - <date>04/20/2018</date> + <version>1.3.2</version> + <date>04/25/2018</date> <minServerVersion>4.1.0</minServerVersion> <adminconsole> <tab id="tab-server"> diff --git a/src/plugins/restAPI/pom.xml b/src/plugins/restAPI/pom.xml index 534de985ac7d383d097bf746b0d97c47b9e56e65..7d6258592e320f0311d75cc3b41eef36d20a0f23 100644 --- a/src/plugins/restAPI/pom.xml +++ b/src/plugins/restAPI/pom.xml @@ -8,7 +8,7 @@ </parent> <groupId>org.igniterealtime.openfire.plugins</groupId> <artifactId>restAPI</artifactId> - <version>1.3.1</version> + <version>1.3.2</version> <name>Rest API Plugin</name> <description>Allows administration over a RESTful API.</description> diff --git a/src/plugins/restAPI/readme.html b/src/plugins/restAPI/readme.html index 24233b2fc9ae70c8a574d9cfca5d76115cdfd492..232c8815a94fd0d5a8d37a238b56e7e3db855ab3 100644 --- a/src/plugins/restAPI/readme.html +++ b/src/plugins/restAPI/readme.html @@ -1998,8 +1998,10 @@ DELETE /chatrooms/{roomName}/{roles}/{name}</p> </blockquote> <h1 id="data-format">Data format</h1> <p>Openfire REST API provides XML and JSON as data format. The default data format is XML.<br> -To get a JSON result, please add “<strong>Accept application/json</strong>†to the request header.<br> -If you want to create a resource with JSON data format, please add “<strong>Content-Type: application/json</strong>â€.</p> +To get a JSON result, please add “<strong>Accept: application/json</strong>†to the request header.<br> +If you want to create a resource with JSON data format, please add “<strong>Content-Type: application/json</strong>â€.<br> +Since version RESP API 1.3.2 you can also use GZIP to compress the payload of the request or and the response.<br> +“<strong>Content-Encoding: gzip</strong>†for the request. “<strong>Accept-Encoding: gzip</strong>†for the response.</p> <h2 id="data-types">Data types</h2> <h3 id="user">User</h3> diff --git a/src/plugins/restAPI/src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java b/src/plugins/restAPI/src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java index 029872abc04c55106ccbb692a9275f7c1c26a3fa..733029cd7899ecca7e227c88a707afaf80133a62 100644 --- a/src/plugins/restAPI/src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java +++ b/src/plugins/restAPI/src/java/org/jivesoftware/openfire/plugin/rest/service/JerseyWrapper.java @@ -37,13 +37,16 @@ public class JerseyWrapper extends ServletContainer { /** The Constant CONTAINER_RESPONSE_FILTERS. */ private static final String CONTAINER_RESPONSE_FILTERS = "com.sun.jersey.spi.container.ContainerResponseFilters"; + + /** The Constant GZIP_FILTER. */ + private static final String GZIP_FILTER = "com.sun.jersey.api.container.filter.GZIPContentEncodingFilter"; /** The Constant RESOURCE_CONFIG_CLASS_KEY. */ private static final String RESOURCE_CONFIG_CLASS_KEY = "com.sun.jersey.config.property.resourceConfigClass"; /** The Constant RESOURCE_CONFIG_CLASS. */ private static final String RESOURCE_CONFIG_CLASS = "com.sun.jersey.api.core.PackagesResourceConfig"; - + /** The Constant SCAN_PACKAGE_DEFAULT. */ private static final String SCAN_PACKAGE_DEFAULT = JerseyWrapper.class.getPackage().getName(); @@ -73,6 +76,7 @@ public class JerseyWrapper extends ServletContainer { prc = new PackagesResourceConfig(SCAN_PACKAGE_DEFAULT); prc.setPropertiesAndFeatures(config); prc.getProperties().put(CONTAINER_RESPONSE_FILTERS, CORSFILTER); + prc.getProperties().put(CONTAINER_RESPONSE_FILTERS, GZIP_FILTER); loadAuthenticationFilter(); prc.getClasses().add(RestAPIService.class); @@ -132,7 +136,8 @@ public class JerseyWrapper extends ServletContainer { loadingStatusMessage = "No custom auth filter found for restAPI plugin! " + customAuthFilterClassName + " " + restAuthType; } - prc.getProperties().put(CONTAINER_REQUEST_FILTERS, pickedAuthFilter); + prc.getProperties().put(CONTAINER_REQUEST_FILTERS, pickedAuthFilter); + prc.getProperties().put(CONTAINER_REQUEST_FILTERS, GZIP_FILTER); return loadingStatusMessage; }