From e4c0edea06c8fee28369f03f393b7d54b2b6235c Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 16 Sep 2016 13:25:06 +0000
Subject: [PATCH] OPENDJ-3246 Return the CREST descriptor over REST for rest2ldap endpoints
---
opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java
index 88ebe1a..9efb145 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java
@@ -42,15 +42,17 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
+import org.forgerock.http.ApiProducer;
+import org.forgerock.http.DescribedHttpApplication;
import org.forgerock.http.Filter;
import org.forgerock.http.Handler;
-import org.forgerock.http.HttpApplication;
import org.forgerock.http.HttpApplicationException;
import org.forgerock.http.handler.Handlers;
import org.forgerock.http.io.Buffer;
import org.forgerock.http.protocol.Request;
import org.forgerock.http.protocol.Response;
import org.forgerock.http.protocol.Status;
+import org.forgerock.http.swagger.SwaggerApiProducer;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
@@ -97,6 +99,8 @@
import org.opends.server.util.SelectableCertificateKeyManager;
import org.opends.server.util.StaticUtils;
+import io.swagger.models.Swagger;
+
/**
* This class defines a connection handler that will be used for communicating
* with clients over HTTP. The connection handler is responsible for
@@ -899,11 +903,11 @@
}
/**
- * This is the root {@link HttpApplication} handling all the requests from the
- * {@link HTTPConnectionHandler}. If accepted, requests are audited and then
- * forwarded to the global {@link ServerContext#getHTTPRouter()}.
+ * This is the root {@link org.forgerock.http.HttpApplication} handling all the requests from the
+ * {@link HTTPConnectionHandler}. If accepted, requests are audited and then forwarded to the
+ * global {@link ServerContext#getHTTPRouter()}.
*/
- private final class RootHttpApplication implements HttpApplication
+ private final class RootHttpApplication implements DescribedHttpApplication
{
@Override
public Handler start() throws HttpApplicationException
@@ -934,6 +938,13 @@
{
return null;
}
+
+ @Override
+ public ApiProducer<Swagger> getApiProducer()
+ {
+ // Needed to enforce generation of CREST APIs
+ return new SwaggerApiProducer(null, null, null);
+ }
}
/** Moves the processing of the request in this Directory Server's worker thread. */
--
Gitblit v1.10.0