You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2016/10/24 19:03:27 UTC
[9/9] incubator-geode git commit: GEODE-2014: Upgrade Swagger
libraries
GEODE-2014: Upgrade Swagger libraries
* this closes #265
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/892d6d33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/892d6d33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/892d6d33
Branch: refs/heads/develop
Commit: 892d6d33f34c917dde7142b8f49df0957f8b7ed0
Parents: 24a7204
Author: Kevin Duling <kd...@pivotal.io>
Authored: Tue Oct 18 15:54:55 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Mon Oct 24 12:00:18 2016 -0700
----------------------------------------------------------------------
.../rest/internal/web/GeodeRestClient.java | 22 +-
.../web/RestSecurityIntegrationTest.java | 24 +-
.../internal/web/SwaggerVerificationTest.java | 82 +
.../geode/internal/i18n/LocalizedStrings.java | 8 +-
geode-web-api/build.gradle | 31 +-
.../web/controllers/AbstractBaseController.java | 64 +-
.../web/controllers/BaseControllerAdvice.java | 19 +-
.../web/controllers/CommonCrudController.java | 40 +-
.../controllers/FunctionAccessController.java | 37 +-
.../web/controllers/PdxBasedCrudController.java | 27 +-
.../web/controllers/QueryAccessController.java | 43 +-
.../web/swagger/config/RestApiPathProvider.java | 96 -
.../web/swagger/config/SwaggerConfig.java | 169 +-
.../src/main/resources/swagger.properties | 2 +
geode-web-api/src/main/webapp/WEB-INF/web.xml | 2 +-
.../src/main/webapp/docs/css/reset.css | 125 -
.../src/main/webapp/docs/css/screen.css | 1221 --------
.../main/webapp/docs/images/explorer_icons.png | Bin 5763 -> 0 bytes
.../src/main/webapp/docs/images/logo_small.png | Bin 770 -> 0 bytes
.../main/webapp/docs/images/pet_store_api.png | Bin 824 -> 0 bytes
.../src/main/webapp/docs/images/throbber.gif | Bin 9257 -> 0 bytes
.../src/main/webapp/docs/images/wordnik_api.png | Bin 980 -> 0 bytes
geode-web-api/src/main/webapp/docs/index.html | 82 +-
.../src/main/webapp/docs/lib/backbone-min.js | 38 -
.../main/webapp/docs/lib/handlebars-1.0.0.js | 2278 ---------------
.../main/webapp/docs/lib/highlight.7.3.pack.js | 1 -
.../main/webapp/docs/lib/jquery-1.8.0.min.js | 2 -
.../main/webapp/docs/lib/jquery.ba-bbq.min.js | 18 -
.../main/webapp/docs/lib/jquery.slideto.min.js | 1 -
.../main/webapp/docs/lib/jquery.wiggle.min.js | 8 -
.../src/main/webapp/docs/lib/shred.bundle.js | 2765 ------------------
.../src/main/webapp/docs/lib/shred/content.js | 193 --
.../src/main/webapp/docs/lib/swagger-oauth.js | 211 --
.../src/main/webapp/docs/lib/swagger.js | 1527 ----------
.../src/main/webapp/docs/lib/underscore-min.js | 32 -
geode-web-api/src/main/webapp/docs/o2c.html | 15 -
.../src/main/webapp/docs/swagger-ui.js | 2269 --------------
.../src/main/webapp/docs/swagger-ui.min.js | 1 -
geode-web/src/main/webapp/WEB-INF/web.xml | 2 +-
gradle/dependency-versions.properties | 3 +-
40 files changed, 264 insertions(+), 11194 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/GeodeRestClient.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/GeodeRestClient.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/GeodeRestClient.java
index 4f92bfe..2889c67 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/GeodeRestClient.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/GeodeRestClient.java
@@ -15,13 +15,6 @@
package org.apache.geode.rest.internal.web;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.nio.charset.StandardCharsets;
-
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
@@ -46,6 +39,13 @@ import org.apache.http.impl.client.HttpClients;
import org.json.JSONTokener;
import org.junit.Assert;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.nio.charset.StandardCharsets;
+
public class GeodeRestClient {
public final static String PROTOCOL = "http";
@@ -86,10 +86,12 @@ public class GeodeRestClient {
return doRequest(getRequest, username, password);
}
- public HttpResponse doGet(String uri) throws MalformedURLException {
- return doGet(uri, null, null);
+ public HttpResponse doGetRequest(String url) throws MalformedURLException {
+ HttpGet getRequest = new HttpGet(url);
+ return doRequest(getRequest, null, null);
}
+
public HttpResponse doDelete(String uri, String username, String password)
throws MalformedURLException {
HttpDelete httpDelete = new HttpDelete(CONTEXT + uri);
@@ -123,7 +125,7 @@ public class GeodeRestClient {
return new JSONTokener(str.toString());
}
- private HttpResponse doRequest(HttpRequestBase request, String username, String password)
+ public HttpResponse doRequest(HttpRequestBase request, String username, String password)
throws MalformedURLException {
HttpHost targetHost = new HttpHost(HOSTNAME, restPort, PROTOCOL);
CloseableHttpClient httpclient = HttpClients.custom().build();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityIntegrationTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityIntegrationTest.java
index fc9ae95..5b3f7ce 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityIntegrationTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityIntegrationTest.java
@@ -14,11 +14,20 @@
*/
package org.apache.geode.rest.internal.web;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.util.Properties;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.internal.AvailablePortHelper;
+import org.apache.geode.security.templates.SampleSecurityManager;
+import org.apache.geode.test.dunit.rules.ServerStarter;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.test.junit.categories.SecurityTest;
import org.apache.http.HttpResponse;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -28,12 +37,7 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.springframework.http.MediaType;
-import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.security.templates.SampleSecurityManager;
-import org.apache.geode.test.dunit.rules.ServerStarter;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
+import java.util.Properties;
@Category({IntegrationTest.class, SecurityTest.class})
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/SwaggerVerificationTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/SwaggerVerificationTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/SwaggerVerificationTest.java
new file mode 100644
index 0000000..3412331
--- /dev/null
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/SwaggerVerificationTest.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.rest.internal.web;
+
+
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.geode.internal.AvailablePortHelper;
+import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.test.dunit.rules.ServerStarter;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.http.HttpResponse;
+import org.json.JSONObject;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Properties;
+
+@Category(IntegrationTest.class)
+
+public class SwaggerVerificationTest {
+
+ private static int restPort = AvailablePortHelper.getRandomAvailableTCPPort();
+ static Properties properties = new Properties() {
+ {
+ setProperty(START_DEV_REST_API, "true");
+ setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
+ setProperty(HTTP_SERVICE_PORT, restPort + "");
+ }
+ };
+
+ @ClassRule
+ public static ServerStarter serverStarter = new ServerStarter(properties);
+ private final GeodeRestClient restClient = new GeodeRestClient(restPort);
+
+ @BeforeClass
+ public static void before() throws Exception {
+ serverStarter.startServer();
+ }
+
+ @Test
+ public void isSwaggerRunning() throws Exception {
+ // Check the UI
+ HttpResponse response = restClient.doGetRequest("/geode/swagger-ui.html");
+ assertThat(GeodeRestClient.getCode(response), is(200));
+
+ // Check the JSON
+ response = restClient.doGetRequest("/geode/v2/api-docs");
+ assertThat(GeodeRestClient.getCode(response), is(200));
+ JSONObject json = new JSONObject(GeodeRestClient.getResponseBody(response));
+ assertThat(json.get("swagger"), is("2.0"));
+
+ JSONObject info = json.getJSONObject("info");
+ assertThat(info.getString("description"),
+ is(LocalizedStrings.SwaggerConfig_DESCRIPTOR.toLocalizedString()));
+ assertThat(info.getString("title"),
+ is(LocalizedStrings.SwaggerConfig_VENDOR_PRODUCT_LINE.toLocalizedString()));
+
+ JSONObject license = info.getJSONObject("license");
+ assertThat(license.getString("name"), is("Apache License, version 2.0"));
+ assertThat(license.getString("url"), is("http://www.apache.org/licenses/"));
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java b/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java
index 0e4fac2..210539b 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java
@@ -7579,12 +7579,12 @@ public class LocalizedStrings {
"Developer REST API and interface to Geode''s distributed, in-memory data grid and cache.");
public static final StringId SwaggerConfig_EULA_LINK =
new StringId(6619, "http://www.apache.org/licenses/");
- public static final StringId SwaggerConfig_SUPPORT_LINK =
- new StringId(6620, "user@geode.incubator.apache.org");
+ public static final StringId SwaggerConfig_DEVELOPER_EMAIL =
+ new StringId(6620, "dev@geode.incubator.apache.org");
public static final StringId SwaggerConfig_DOC_TITLE =
new StringId(6621, "Apache Geode Documentation");
- public static final StringId SwaggerConfig_DOC_LINK =
- new StringId(6622, "http://geode.incubator.apache.org/docs/");
+ public static final StringId SwaggerConfig_PRODUCT_LINK =
+ new StringId(6622, "http://geode.apache.org");
public static final StringId LuceneXmlParser_CLASS_0_IS_NOT_AN_INSTANCE_OF_ANALYZER =
new StringId(6623, "Class {0} is not an instance of Analyzer.");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/build.gradle
----------------------------------------------------------------------
diff --git a/geode-web-api/build.gradle b/geode-web-api/build.gradle
index e823ed3..9b15516 100755
--- a/geode-web-api/build.gradle
+++ b/geode-web-api/build.gradle
@@ -20,7 +20,7 @@ apply plugin: 'war'
dependencies {
compile 'commons-lang:commons-lang:' + project.'commons-lang.version'
- compile ('commons-fileupload:commons-fileupload:' + project.'commons-fileupload.version') {
+ compile('commons-fileupload:commons-fileupload:' + project.'commons-fileupload.version') {
exclude module: 'commons-io'
}
compile 'com.fasterxml:classmate:' + project.'classmate.version'
@@ -29,27 +29,12 @@ dependencies {
compile 'com.fasterxml.jackson.core:jackson-databind:' + project.'jackson.version'
compile 'com.fasterxml.jackson.module:jackson-module-scala_2.10:' + project.'jackson-module-scala_2.10.version'
compile 'com.google.guava:guava:' + project.'guava.version'
- compile ('com.mangofactory:swagger-springmvc:' + project.'swagger-springmvc.version') {
- exclude module: 'aopalliance'
- exclude module: 'asm'
- exclude module: 'cglib'
- exclude module: 'commons-logging'
- exclude module: 'jackson-jaxrs-json-provider'
- exclude module: 'jackson-jaxrs-json-provider'
- exclude module: 'jackson-module-jsonSchema'
- exclude module: 'joda-convert'
- exclude module: 'joda-time'
- exclude module: 'scalap'
+ compile('io.springfox:springfox-swagger2:' + project.'springfox.version') {
+ exclude module: 'slf4j-api'
+ }
+ compile('io.springfox:springfox-swagger-ui:' + project.'springfox.version') {
exclude module: 'slf4j-api'
- exclude module: 'spring-aop'
- exclude module: 'spring-beans'
- exclude module: 'spring-context'
- exclude module: 'spring-core'
- exclude module: 'spring-expression'
- exclude module: 'spring-webmvc'
- exclude module: 'spring-web'
}
- compile 'com.wordnik:swagger-annotations:' + project.'swagger.version'
compile 'org.json4s:json4s-ast_2.10:' + project.'json4s.version'
compile 'org.scala-lang:scala-library:' + project.'scala.version'
compile 'org.scala-lang:scala-reflect:' + project.'scala.version'
@@ -58,18 +43,18 @@ dependencies {
compile 'org.springframework.security:spring-security-web:' + project.'spring-security.version'
compile 'org.springframework.security:spring-security-config:' + project.'spring-security.version'
compile 'org.springframework:spring-webmvc:' + project.'springframework.version'
- compile ('org.springframework.hateoas:spring-hateoas:' + project.'spring-hateoas.version') {
+ compile('org.springframework.hateoas:spring-hateoas:' + project.'spring-hateoas.version') {
exclude module: 'aopalliance'
exclude module: 'commons-logging'
exclude module: 'objenesis'
exclude module: 'slf4j-api'
exclude module: 'spring-core'
}
- compile ('org.springframework:spring-aspects:' + project.'springframework.version') {
+ compile('org.springframework:spring-aspects:' + project.'springframework.version') {
exclude module: 'aopalliance'
exclude module: 'aspectjweaver'
}
- compile ('org.springframework:spring-oxm:' + project.'springframework.version') {
+ compile('org.springframework:spring-oxm:' + project.'springframework.version') {
exclude module: 'commons-logging'
exclude module: 'spring-core'
exclude module: 'spring-beans'
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
index 5cd090a..80297b5 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
@@ -15,43 +15,10 @@
package org.apache.geode.rest.internal.web.controllers;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.annotation.PostConstruct;
-
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.logging.log4j.Logger;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.util.Assert;
-import org.springframework.util.ClassUtils;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
-import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-
import org.apache.geode.SerializationException;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheLoaderException;
@@ -82,6 +49,37 @@ import org.apache.geode.rest.internal.web.util.IdentifiableUtils;
import org.apache.geode.rest.internal.web.util.JSONUtils;
import org.apache.geode.rest.internal.web.util.NumberUtils;
import org.apache.geode.rest.internal.web.util.ValidationUtils;
+import org.apache.logging.log4j.Logger;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.Assert;
+import org.springframework.util.ClassUtils;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.annotation.PostConstruct;
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java
index 09e6d53..8939542 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java
@@ -15,9 +15,13 @@
package org.apache.geode.rest.internal.web.controllers;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException;
+import org.apache.geode.rest.internal.web.exception.GemfireRestException;
+import org.apache.geode.rest.internal.web.exception.MalformedJsonException;
+import org.apache.geode.rest.internal.web.exception.RegionNotFoundException;
+import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
+import org.apache.geode.security.NotAuthorizedException;
import org.apache.logging.log4j.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.AccessDeniedException;
@@ -27,13 +31,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException;
-import org.apache.geode.rest.internal.web.exception.GemfireRestException;
-import org.apache.geode.rest.internal.web.exception.MalformedJsonException;
-import org.apache.geode.rest.internal.web.exception.RegionNotFoundException;
-import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
-import org.apache.geode.security.NotAuthorizedException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
index 980ee73..62ce860 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
@@ -14,24 +14,9 @@
*/
package org.apache.geode.rest.internal.web.controllers;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import com.wordnik.swagger.annotations.ApiOperation;
-import com.wordnik.swagger.annotations.ApiResponse;
-import com.wordnik.swagger.annotations.ApiResponses;
-import org.apache.logging.log4j.Logger;
-import org.json.JSONException;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
import org.apache.geode.cache.LowMemoryException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.execute.Execution;
@@ -44,6 +29,20 @@ import org.apache.geode.rest.internal.web.controllers.support.RestServersResultC
import org.apache.geode.rest.internal.web.exception.GemfireRestException;
import org.apache.geode.rest.internal.web.util.ArrayUtils;
import org.apache.geode.rest.internal.web.util.JSONUtils;
+import org.apache.logging.log4j.Logger;
+import org.json.JSONException;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
/**
* The CommonCrudController serves REST Requests related to listing regions, listing keys in region,
@@ -63,15 +62,14 @@ public abstract class CommonCrudController extends AbstractBaseController {
*/
@RequestMapping(method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
@ApiOperation(value = "list all resources (Regions)",
- notes = "List all available resources (Regions) in the GemFire cluster",
- response = void.class)
+ notes = "List all available resources (Regions) in the Geode cluster", response = void.class)
@ApiResponses({@ApiResponse(code = 200, message = "OK."),
@ApiResponse(code = 401, message = "Invalid Username or Password."),
@ApiResponse(code = 403, message = "Insufficient privileges for operation."),
@ApiResponse(code = 500, message = "GemFire throws an error or exception.")})
@PreAuthorize("@securityService.authorize('DATA', 'READ')")
public ResponseEntity<?> regions() {
- logger.debug("Listing all resources (Regions) in GemFire...");
+ logger.debug("Listing all resources (Regions) in Geode...");
final HttpHeaders headers = new HttpHeaders();
headers.setLocation(toUri());
final Set<Region<?, ?>> regions = getCache().rootRegions();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
index 4fb8411..ec05ec7 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
@@ -15,15 +15,20 @@
package org.apache.geode.rest.internal.web.controllers;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.wordnik.swagger.annotations.Api;
-import com.wordnik.swagger.annotations.ApiOperation;
-import com.wordnik.swagger.annotations.ApiResponse;
-import com.wordnik.swagger.annotations.ApiResponses;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.apache.geode.cache.LowMemoryException;
+import org.apache.geode.cache.execute.Execution;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionException;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.rest.internal.web.exception.GemfireRestException;
+import org.apache.geode.rest.internal.web.util.ArrayUtils;
+import org.apache.geode.rest.internal.web.util.JSONUtils;
import org.apache.logging.log4j.Logger;
import org.json.JSONException;
import org.springframework.http.HttpHeaders;
@@ -41,16 +46,10 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
-import org.apache.geode.cache.LowMemoryException;
-import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionException;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.rest.internal.web.exception.GemfireRestException;
-import org.apache.geode.rest.internal.web.util.ArrayUtils;
-import org.apache.geode.rest.internal.web.util.JSONUtils;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* The FunctionsController class serving REST Requests related to the function execution
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java
index 49ab5f9..2b44e54 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java
@@ -14,14 +14,16 @@
*/
package org.apache.geode.rest.internal.web.controllers;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import com.wordnik.swagger.annotations.Api;
-import com.wordnik.swagger.annotations.ApiOperation;
-import com.wordnik.swagger.annotations.ApiResponse;
-import com.wordnik.swagger.annotations.ApiResponses;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.rest.internal.web.controllers.support.JSONTypes;
+import org.apache.geode.rest.internal.web.controllers.support.RegionData;
+import org.apache.geode.rest.internal.web.controllers.support.RegionEntryData;
+import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
+import org.apache.geode.rest.internal.web.util.ArrayUtils;
import org.apache.logging.log4j.Logger;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
@@ -36,12 +38,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.rest.internal.web.controllers.support.JSONTypes;
-import org.apache.geode.rest.internal.web.controllers.support.RegionData;
-import org.apache.geode.rest.internal.web.controllers.support.RegionEntryData;
-import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
-import org.apache.geode.rest.internal.web.util.ArrayUtils;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
/**
* The PdxBasedCrudController class serving REST Requests related to the REST CRUD operation on
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/QueryAccessController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/QueryAccessController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/QueryAccessController.java
index 6942e90..4a7dfde 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/QueryAccessController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/QueryAccessController.java
@@ -15,27 +15,10 @@
package org.apache.geode.rest.internal.web.controllers;
-import java.util.concurrent.ConcurrentHashMap;
-
-import com.wordnik.swagger.annotations.Api;
-import com.wordnik.swagger.annotations.ApiOperation;
-import com.wordnik.swagger.annotations.ApiResponse;
-import com.wordnik.swagger.annotations.ApiResponses;
-import org.apache.logging.log4j.Logger;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.ResponseStatus;
-
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.query.FunctionDomainException;
import org.apache.geode.cache.query.NameResolutionException;
@@ -51,6 +34,22 @@ import org.apache.geode.rest.internal.web.exception.GemfireRestException;
import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
import org.apache.geode.rest.internal.web.util.JSONUtils;
import org.apache.geode.rest.internal.web.util.ValidationUtils;
+import org.apache.logging.log4j.Logger;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+import java.util.concurrent.ConcurrentHashMap;
/**
@@ -62,7 +61,7 @@ import org.apache.geode.rest.internal.web.util.ValidationUtils;
*/
@Controller("queryController")
-@Api(value = "queries", description = "Rest api for gemfire query execution",
+@Api(value = "queries", description = "Rest api for geode query execution",
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(QueryAccessController.REST_API_VERSION + "/queries")
@SuppressWarnings("unused")
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/RestApiPathProvider.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/RestApiPathProvider.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/RestApiPathProvider.java
deleted file mode 100644
index 307b63e..0000000
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/RestApiPathProvider.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.rest.internal.web.swagger.config;
-
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.net.SocketCreator;
-import org.apache.geode.internal.lang.StringUtils;
-import com.mangofactory.swagger.core.SwaggerPathProvider;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.Assert;
-import org.springframework.web.util.UriComponentsBuilder;
-
-import javax.servlet.ServletContext;
-import java.net.UnknownHostException;
-
-@SuppressWarnings("unused")
-public class RestApiPathProvider implements SwaggerPathProvider {
-
- @Autowired
- private ServletContext servletContext;
-
- private final String docsLocation;
-
- private SwaggerPathProvider defaultPathProvider;
-
- public RestApiPathProvider(final String docsLocation) {
- Assert.isTrue(!StringUtils.isBlank(docsLocation), "The docs location must be specified!");
-
- DistributionConfig config = InternalDistributedSystem.getAnyInstance().getConfig();
- String scheme = config.getHttpServiceSSLEnabled() ? "https" : "http";
-
- this.docsLocation =
- scheme + "://" + getBindAddressForHttpService() + ":" + config.getHttpServicePort();
- }
-
- private String getBindAddressForHttpService() {
- DistributionConfig config = InternalDistributedSystem.getAnyInstance().getConfig();
- java.lang.String bindAddress = config.getHttpServiceBindAddress();
- if (org.apache.commons.lang.StringUtils.isBlank(bindAddress)) {
- if (org.apache.commons.lang.StringUtils.isBlank(config.getServerBindAddress())) {
- if (org.apache.commons.lang.StringUtils.isBlank(config.getBindAddress())) {
- try {
- bindAddress = SocketCreator.getLocalHost().getHostAddress();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- }
- } else {
- bindAddress = config.getBindAddress();
- }
- } else {
- bindAddress = config.getServerBindAddress();
- }
- }
- return bindAddress;
- }
-
- @Override
- public String getApiResourcePrefix() {
- return defaultPathProvider.getApiResourcePrefix();
- }
-
- @Override
- public String getAppBasePath() {
- return UriComponentsBuilder.fromHttpUrl(docsLocation).path(servletContext.getContextPath())
- .build().toString();
- }
-
- @Override
- public String getSwaggerDocumentationBasePath() {
- return UriComponentsBuilder.fromHttpUrl(getAppBasePath()).pathSegment("api-docs/").build()
- .toString();
- }
-
- @Override
- public String getRequestMappingEndpoint(String requestMappingPattern) {
- return defaultPathProvider.getRequestMappingEndpoint(requestMappingPattern);
- }
-
- public void setDefaultPathProvider(final SwaggerPathProvider defaultSwaggerPathProvider) {
- this.defaultPathProvider = defaultSwaggerPathProvider;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
index 9eb9c25..c938139 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
@@ -14,159 +14,44 @@
*/
package org.apache.geode.rest.internal.web.swagger.config;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
import org.apache.geode.internal.i18n.LocalizedStrings;
-import com.mangofactory.swagger.configuration.JacksonScalaSupport;
-import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
-import com.mangofactory.swagger.configuration.SpringSwaggerModelConfig;
-import com.mangofactory.swagger.configuration.SwaggerGlobalSettings;
-import com.mangofactory.swagger.core.SwaggerApiResourceListing;
-import com.mangofactory.swagger.scanners.ApiListingReferenceScanner;
-import com.wordnik.swagger.model.ApiInfo;
-import com.wordnik.swagger.model.AuthorizationType;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
-
+import org.springframework.context.annotation.PropertySource;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@PropertySource({"classpath:swagger.properties"})
@Configuration
-@ComponentScan(basePackages = "com.mangofactory.swagger")
+@EnableSwagger2
@SuppressWarnings("unused")
public class SwaggerConfig {
- protected static final List<String> DEFAULT_INCLUDE_PATTERNS = Arrays.asList("/.*");
-
- protected static final String SWAGGER_GROUP = "gemfireApi";
-
- @Autowired
- private SpringSwaggerConfig springSwaggerConfig;
-
- @Autowired
- private SpringSwaggerModelConfig springSwaggerModelConfig;
-
- @Value("${app.docs}")
- private String docsLocation;
-
- /**
- * API Info as it appears on the Swagger-UI page
- */
- private ApiInfo apiInfo() {
- return new ApiInfo(LocalizedStrings.SwaggerConfig_VENDOR_PRODUCT_LINE.toLocalizedString(),
- LocalizedStrings.SwaggerConfig_DESCRIPTOR.toLocalizedString(),
- LocalizedStrings.SwaggerConfig_EULA_LINK.toLocalizedString(),
- LocalizedStrings.SwaggerConfig_SUPPORT_LINK.toLocalizedString(),
- LocalizedStrings.SwaggerConfig_DOC_TITLE.toLocalizedString(),
- LocalizedStrings.SwaggerConfig_DOC_LINK.toLocalizedString());
- }
-
- /**
- * Adds the Jackson Scala module to the MappingJackson2HttpMessageConverter registered with
- * Spring. Swagger core models are Scala so we need to be able to convert to JSON. Also registers
- * some custom serializers needed to transform Swagger models to Swagger-UI required JSON format.
- */
- @Bean
- public JacksonScalaSupport jacksonScalaSupport() {
- JacksonScalaSupport jacksonScalaSupport = new JacksonScalaSupport();
- // set to false to disable
- jacksonScalaSupport.setRegisterScalaModule(true);
- return jacksonScalaSupport;
- }
-
- /**
- * Configure a SwaggerApiResourceListing for each Swagger instance within your app. e.g. 1.
- * private 2. external APIs 3. ..., required to be a Spring bean as Spring will call the
- * postConstruct method to bootstrap Swagger scanning.
- */
- @Bean
- public SwaggerApiResourceListing swaggerApiResourceListing() {
- // The group name is important and should match the group set on
- // ApiListingReferenceScanner
- // Note that swaggerCache() is by DefaultSwaggerController to serve the
- // Swagger JSON
- SwaggerApiResourceListing swaggerApiResourceListing =
- new SwaggerApiResourceListing(springSwaggerConfig.swaggerCache(), SWAGGER_GROUP);
-
- // set required Swagger settings
- swaggerApiResourceListing.setSwaggerGlobalSettings(swaggerGlobalSettings());
-
- // use a custom path provider or
- // springSwaggerConfig.defaultSwaggerPathProvider()
- swaggerApiResourceListing.setSwaggerPathProvider(apiPathProvider());
-
- // supply the API Info as it should appear on Swagger-UI web page
- swaggerApiResourceListing.setApiInfo(apiInfo());
-
- // every SwaggerApiResourceListing needs an ApiListingReferenceScanner to
- // scan the Spring RequestMappings
- swaggerApiResourceListing.setApiListingReferenceScanner(apiListingReferenceScanner());
-
- // global authorization - see the Swagger documentation
- swaggerApiResourceListing.setAuthorizationTypes(Collections.<AuthorizationType>emptyList());
-
- return swaggerApiResourceListing;
- }
-
- /**
- * Global Swagger configuration settings
- */
- @Bean
- public SwaggerGlobalSettings swaggerGlobalSettings() {
- SwaggerGlobalSettings swaggerGlobalSettings = new SwaggerGlobalSettings();
- swaggerGlobalSettings.setGlobalResponseMessages(springSwaggerConfig.defaultResponseMessages());
- swaggerGlobalSettings
- .setIgnorableParameterTypes(springSwaggerConfig.defaultIgnorableParameterTypes());
- swaggerGlobalSettings
- .setParameterDataTypes(springSwaggerModelConfig.defaultParameterDataTypes());
- return swaggerGlobalSettings;
- }
-
- /**
- * The ApiListingReferenceScanner does most of the work. It scans the appropriate Spring
- * RequestMappingHandlerMappings, applies the correct absolute paths to the generated Swagger
- * resources, and so on.
- */
@Bean
- public ApiListingReferenceScanner apiListingReferenceScanner() {
- ApiListingReferenceScanner apiListingReferenceScanner = new ApiListingReferenceScanner();
-
- // Picks up all of the registered Spring RequestMappingHandlerMappings
- // during scanning...
- apiListingReferenceScanner.setRequestMappingHandlerMapping(
- springSwaggerConfig.swaggerRequestMappingHandlerMappings());
-
- // Excludes any Controllers with the supplied Annotations...
- apiListingReferenceScanner
- .setExcludeAnnotations(springSwaggerConfig.defaultExcludeAnnotations());
-
- // Only include paths that match the supplied Regular Expressions...
- apiListingReferenceScanner.setIncludePatterns(DEFAULT_INCLUDE_PATTERNS);
-
- //
- apiListingReferenceScanner
- .setResourceGroupingStrategy(springSwaggerConfig.defaultResourceGroupingStrategy());
-
- // PathProvider used to generate the appropriate uri's
- apiListingReferenceScanner.setSwaggerPathProvider(apiPathProvider());
-
- // Must match the Swagger group set on the SwaggerApiResourceListing...
- apiListingReferenceScanner.setSwaggerGroup(SWAGGER_GROUP);
-
- return apiListingReferenceScanner;
+ public Docket api() {
+ return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any())
+ .paths(PathSelectors.any()).build().apiInfo(apiInfo());
}
/**
- * Example of a custom path provider
+ * API Info as it appears on the Swagger-UI page
*/
- @Bean
- public RestApiPathProvider apiPathProvider() {
- RestApiPathProvider apiPathProvider = new RestApiPathProvider(docsLocation);
- apiPathProvider.setDefaultPathProvider(springSwaggerConfig.defaultSwaggerPathProvider());
- return apiPathProvider;
+ private ApiInfo apiInfo() {
+ return new ApiInfoBuilder()
+ .title(LocalizedStrings.SwaggerConfig_VENDOR_PRODUCT_LINE.toLocalizedString())
+ .description(LocalizedStrings.SwaggerConfig_DESCRIPTOR.toLocalizedString()).version("1.0")
+ .termsOfServiceUrl(LocalizedStrings.SwaggerConfig_EULA_LINK.toLocalizedString())
+ .license("Apache License, version 2.0")
+ .licenseUrl(LocalizedStrings.SwaggerConfig_EULA_LINK.toLocalizedString())
+ .contact(new Contact("the Apache Geode Community",
+ LocalizedStrings.SwaggerConfig_PRODUCT_LINK.toLocalizedString(),
+ LocalizedStrings.SwaggerConfig_DEVELOPER_EMAIL.toLocalizedString()))
+ .build();
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/resources/swagger.properties
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/resources/swagger.properties b/geode-web-api/src/main/resources/swagger.properties
new file mode 100644
index 0000000..5042b2c
--- /dev/null
+++ b/geode-web-api/src/main/resources/swagger.properties
@@ -0,0 +1,2 @@
+springfox.documentation.swagger.v2.path=/v2/api-docs
+springfox.documentation.swagger.v1.path=/v1/api-docs
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/webapp/WEB-INF/web.xml b/geode-web-api/src/main/webapp/WEB-INF/web.xml
index f1f93c7..c241178 100644
--- a/geode-web-api/src/main/webapp/WEB-INF/web.xml
+++ b/geode-web-api/src/main/webapp/WEB-INF/web.xml
@@ -23,7 +23,7 @@ limitations under the License.
<display-name>GemFire Developer REST API</display-name>
<description>
- Web deployment descriptor declaring the developer REST API for GemFire.
+ Web deployment descriptor declaring the developer REST API for Geode.
</description>
<filter>
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/892d6d33/geode-web-api/src/main/webapp/docs/css/reset.css
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/webapp/docs/css/reset.css b/geode-web-api/src/main/webapp/docs/css/reset.css
deleted file mode 100644
index 84ef0e6..0000000
--- a/geode-web-api/src/main/webapp/docs/css/reset.css
+++ /dev/null
@@ -1,125 +0,0 @@
-/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */
-html,
-body,
-div,
-span,
-applet,
-object,
-iframe,
-h1,
-h2,
-h3,
-h4,
-h5,
-h6,
-p,
-blockquote,
-pre,
-a,
-abbr,
-acronym,
-address,
-big,
-cite,
-code,
-del,
-dfn,
-em,
-img,
-ins,
-kbd,
-q,
-s,
-samp,
-small,
-strike,
-strong,
-sub,
-sup,
-tt,
-var,
-b,
-u,
-i,
-center,
-dl,
-dt,
-dd,
-ol,
-ul,
-li,
-fieldset,
-form,
-label,
-legend,
-table,
-caption,
-tbody,
-tfoot,
-thead,
-tr,
-th,
-td,
-article,
-aside,
-canvas,
-details,
-embed,
-figure,
-figcaption,
-footer,
-header,
-hgroup,
-menu,
-nav,
-output,
-ruby,
-section,
-summary,
-time,
-mark,
-audio,
-video {
- margin: 0;
- padding: 0;
- border: 0;
- font-size: 100%;
- font: inherit;
- vertical-align: baseline;
-}
-/* HTML5 display-role reset for older browsers */
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-menu,
-nav,
-section {
- display: block;
-}
-body {
- line-height: 1;
-}
-ol,
-ul {
- list-style: none;
-}
-blockquote,
-q {
- quotes: none;
-}
-blockquote:before,
-blockquote:after,
-q:before,
-q:after {
- content: '';
- content: none;
-}
-table {
- border-collapse: collapse;
- border-spacing: 0;
-}