| | |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.forgerock.http.grizzly.GrizzlySupport.newGrizzlyHttpHandler; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.InetAddress; |
| | |
| | | import org.forgerock.http.HttpApplicationException; |
| | | import org.forgerock.http.handler.Handlers; |
| | | import org.forgerock.http.io.Buffer; |
| | | import org.forgerock.http.servlet.HttpFrameworkServlet; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | |
| | | import org.glassfish.grizzly.http.server.ServerConfiguration; |
| | | import org.glassfish.grizzly.monitoring.MonitoringConfig; |
| | | import org.glassfish.grizzly.nio.transport.TCPNIOTransport; |
| | | import org.glassfish.grizzly.servlet.WebappContext; |
| | | import org.glassfish.grizzly.ssl.SSLEngineConfigurator; |
| | | import org.glassfish.grizzly.strategies.SameThreadIOStrategy; |
| | | import org.glassfish.grizzly.utils.Charsets; |
| | |
| | | } |
| | | |
| | | this.httpServer = createHttpServer(); |
| | | |
| | | // Register servlet as default servlet and also able to serve REST requests |
| | | createAndRegisterServlet("OpenDJ HTTP servlet", "", "/*"); |
| | | |
| | | this.httpServer.getServerConfiguration().addHttpHandler(newGrizzlyHttpHandler(new RootHttpApplication())); |
| | | logger.trace("Starting HTTP server..."); |
| | | this.httpServer.start(); |
| | | logger.trace("HTTP server started"); |
| | |
| | | return server.getServerConfiguration().getMonitoringConfig().getHttpConfig(); |
| | | } |
| | | |
| | | private void createAndRegisterServlet(final String servletName, final String... urlPatterns) throws Exception |
| | | { |
| | | // Create and deploy the Web app context |
| | | final WebappContext ctx = new WebappContext(servletName); |
| | | ctx.addServlet(servletName, new HttpFrameworkServlet(new RootHttpApplication())).addMapping(urlPatterns); |
| | | ctx.deploy(this.httpServer); |
| | | } |
| | | |
| | | private void stopHttpServer() |
| | | { |
| | | if (this.httpServer != null) |