You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by gh...@apache.org on 2019/05/22 22:17:31 UTC
[sling-org-apache-sling-starter-startup] branch master updated:
SLING-8418 marked module as obsolete
This is an automated email from the ASF dual-hosted git repository.
ghenzler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter-startup.git
The following commit(s) were added to refs/heads/master by this push:
new 1481dea SLING-8418 marked module as obsolete
1481dea is described below
commit 1481deafde65aeae0a91f05324854bf350e7b137
Author: georg.henzler <ge...@netcentric.biz>
AuthorDate: Thu May 23 00:17:21 2019 +0200
SLING-8418 marked module as obsolete
---
CODE_OF_CONDUCT.md | 22 --
CONTRIBUTING.md | 24 --
Jenkinsfile | 20 --
LICENSE | 202 ----------------
README.md | 7 +-
pom.xml | 95 --------
.../sling/starter/startup/impl/Activator.java | 154 ------------
.../starter/startup/impl/HttpStartupSetup.java | 120 ----------
.../sling/starter/startup/impl/StartupFilter.java | 95 --------
src/main/resources/index.html | 265 ---------------------
10 files changed, 1 insertion(+), 1003 deletions(-)
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index 0fa18e5..0000000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,22 +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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-Apache Software Foundation Code of Conduct
-====
-
-Being an Apache project, Apache Sling adheres to the Apache Software Foundation's [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index ac82a1a..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,24 +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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-Contributing
-====
-
-Thanks for choosing to contribute!
-
-You will find all the necessary details about how you can do this at https://sling.apache.org/contributing.html.
diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
index f582519..0000000
--- a/Jenkinsfile
+++ /dev/null
@@ -1,20 +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.
- */
-
-slingOsgiBundleBuild()
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
diff --git a/README.md b/README.md
index cdb3f60..0fe121b 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,6 @@
[<img src="https://sling.apache.org/res/logos/sling.png"/>](https://sling.apache.org)
- [![Build Status](https://builds.apache.org/buildStatus/icon?job=Sling/sling-org-apache-sling-starter-startup/master)](https://builds.apache.org/job/Sling/job/sling-org-apache-sling-starter-startup/job/master) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.sling/org.apache.sling.starter.startup/badge.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.sling%22%20a%3A%22org.apache.sling.starter.startup%22) [![JavaDocs](https://www.javadoc.io/ [...]
# Apache Sling Starter Startup Module
-Provides a module providing a nicer user experience during startup of the Sling Starter application.
-
-The content of the starting page may be customized for the purposes of branding or providing more specific site specific information. To provide a custom page you may install a fragment bundle to this host bundle that contains a custom_index.html file in the root of the bundle.
-
-This module is part of the [Apache Sling](https://sling.apache.org) project.
+This module is **obsolete** - use Felix HC [Service Unavailable Filter](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#service-unavailable-filter) as e.g. configured in [Sling Starter](https://github.com/apache/sling-org-apache-sling-starter/blob/a16fb43f1d0333f74b066844e0377d93ca1e1e08/src/main/provisioning/healthcheck.txt#L86) instead.
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index f50b7bd..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
- <!--
- 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.sling</groupId>
- <artifactId>sling</artifactId>
- <version>32</version>
- <relativePath />
- </parent>
-
- <artifactId>org.apache.sling.starter.startup</artifactId>
- <version>1.0.7-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <name>Apache Sling Starter Startup Module</name>
- <description>
- A module for handling the startup of the Apache Sling Starter.
- </description>
-
- <properties>
- <sling.java.version>8</sling.java.version>
- </properties>
-
- <scm>
- <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter-startup.git</connection>
- <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter-startup.git</developerConnection>
- <url>https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-starter-startup.git</url>
- <tag>HEAD</tag>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Activator>
- org.apache.sling.starter.startup.impl.Activator
- </Bundle-Activator>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <excludePackageNames>
- org.apache.sling.starter.startup.impl
- </excludePackageNames>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.http.whiteboard</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.installer.api</artifactId>
- <version>1.0.0</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/src/main/java/org/apache/sling/starter/startup/impl/Activator.java b/src/main/java/org/apache/sling/starter/startup/impl/Activator.java
deleted file mode 100644
index eb968da..0000000
--- a/src/main/java/org/apache/sling/starter/startup/impl/Activator.java
+++ /dev/null
@@ -1,154 +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.sling.starter.startup.impl;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.sling.installer.api.info.InfoProvider;
-import org.apache.sling.installer.api.info.InstallationState;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-public class Activator implements BundleActivator {
-
- private final String[] REQUIRED_SERVICES = new String[] {
- "org.apache.sling.api.auth.Authenticator",
- "org.apache.sling.api.resource.ResourceResolverFactory",
- "org.apache.sling.api.servlets.ServletResolver"
- };
-
- private volatile ServiceTracker<InfoProvider, InfoProvider> infoProviderTracker;
-
- private volatile HttpStartupSetup httpSetup;
-
- private final AtomicBoolean stopped = new AtomicBoolean(false);
-
- @Override
- public void start(final BundleContext context) {
- this.httpSetup = new HttpStartupSetup(context);
- this.httpSetup.start();
-
- this.setupInfoProviderTracker(context);
- }
-
- @Override
- public void stop(final BundleContext context) {
- stopped.set(true);
- this.stopInfoProviderTracker();
-
- if ( this.httpSetup != null ) {
- this.httpSetup.stop();
- this.httpSetup = null;
- }
- }
-
- /**
- * Setup the info provider tracker
- * @param context The bundle context
- */
- private void setupInfoProviderTracker(final BundleContext context) {
- this.infoProviderTracker = new ServiceTracker<>(context, InfoProvider.class, new ServiceTrackerCustomizer<InfoProvider, InfoProvider>() {
-
- private final AtomicInteger counter = new AtomicInteger();
-
- private final Timer timer = new Timer();
-
- @Override
- public InfoProvider addingService(final ServiceReference<InfoProvider> reference) {
- if ( stopped.get() ) {
- return null;
- }
- final InfoProvider service = context.getService(reference);
- if ( counter.incrementAndGet() == 1 ) {
- startCheck(service);
- }
- return service;
- }
-
- @Override
- public void modifiedService(final ServiceReference<InfoProvider> reference, final InfoProvider service) {
- // nothing to do
- }
-
- @Override
- public void removedService(final ServiceReference<InfoProvider> reference, final InfoProvider service) {
- if ( counter.decrementAndGet() == 0 ) {
- stopCheck();
- }
- context.ungetService(reference);
- }
-
- private void startCheck(final InfoProvider service) {
- final TimerTask task = new TimerTask() {
- @Override
- public void run() {
- final InstallationState state = service.getInstallationState();
- if ( state.getActiveResources().isEmpty()
- && state.getUntransformedResources().isEmpty()
- && checkServices(context)) {
-
- httpSetup.stop();
- this.cancel();
- }
- }
- };
- timer.schedule(task, 1000, 1000);
- }
-
- private void stopCheck() {
- timer.cancel();
- if ( !stopped.get() ) {
- httpSetup.start();
- }
- }
-
-
- });
- this.infoProviderTracker.open();
- }
-
- /**
- * Stop the info provider tracker
- */
- private void stopInfoProviderTracker() {
- if ( infoProviderTracker != null ) {
- infoProviderTracker.close();
- infoProviderTracker = null;
- }
- }
-
- private boolean checkServices(final BundleContext context) {
- for(final String name : REQUIRED_SERVICES) {
- final ServiceReference<?> ref = context.getServiceReference(name);
- if ( ref == null ) {
- return false;
- }
- final Object service = context.getService(ref);
- if ( service == null ) {
- return false;
- }
- context.ungetService(ref);
- }
- return true;
- }
-}
diff --git a/src/main/java/org/apache/sling/starter/startup/impl/HttpStartupSetup.java b/src/main/java/org/apache/sling/starter/startup/impl/HttpStartupSetup.java
deleted file mode 100644
index 82083da..0000000
--- a/src/main/java/org/apache/sling/starter/startup/impl/HttpStartupSetup.java
+++ /dev/null
@@ -1,120 +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.sling.starter.startup.impl;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import javax.servlet.Filter;
-import javax.servlet.Servlet;
-import javax.servlet.http.HttpServlet;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.http.context.ServletContextHelper;
-import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
-
-public class HttpStartupSetup {
-
- private static final String CONTEXT_NAME = "internal.sling.setup";
-
- private volatile ServiceRegistration<ServletContextHelper> httpContextRegistration;
-
- private volatile ServiceRegistration<Servlet> defaultServletRegistration;
-
- private volatile ServiceRegistration<Filter> startupFilterRegistration;
-
- private final BundleContext context;
-
- HttpStartupSetup(final BundleContext context) {
- this.context = context;
- }
-
- public void start() {
- this.registerHttpContext();
- this.registerStartupFilter();
- }
-
- public void stop() {
- this.unregisterStartupFilter();
- this.unregisterHttpContext();
- }
-
- /**
- * Register the http context.
- */
- private void registerHttpContext() {
- final Dictionary<String, Object> properties = new Hashtable<>();
- properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, CONTEXT_NAME);
- properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/");
- properties.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
-
- this.httpContextRegistration = context.registerService(ServletContextHelper.class,
- new ServletContextHelper() {
- }, properties);
-
- final Dictionary<String, Object> servletProps = new Hashtable<>();
- servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
- "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=" + CONTEXT_NAME + ")");
- servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/");
-
- this.defaultServletRegistration = context.registerService(Servlet.class, new HttpServlet() {
-
- private static final long serialVersionUID = 1L;
-
- }, servletProps);
- }
-
- /**
- * Unregister the http context
- */
- private void unregisterHttpContext() {
- if ( this.defaultServletRegistration != null ) {
- this.defaultServletRegistration.unregister();
- this.defaultServletRegistration = null;
- }
- if ( this.httpContextRegistration != null ) {
- this.httpContextRegistration.unregister();
- this.httpContextRegistration = null;
- }
- }
-
- /**
- * Register the startup filter
- */
- private void registerStartupFilter() {
- final Dictionary<String, Object> properties = new Hashtable<>();
- properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
- "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=" + CONTEXT_NAME + ")");
- properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/");
- properties.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
-
- this.startupFilterRegistration = context.registerService(Filter.class,
- new StartupFilter(), properties);
- }
-
- /**
- * Unregister the startup filter
- */
- private void unregisterStartupFilter() {
- if ( this.startupFilterRegistration != null ) {
- this.startupFilterRegistration.unregister();
- this.startupFilterRegistration = null;
- }
- }
-}
diff --git a/src/main/java/org/apache/sling/starter/startup/impl/StartupFilter.java b/src/main/java/org/apache/sling/starter/startup/impl/StartupFilter.java
deleted file mode 100644
index d3de5fa..0000000
--- a/src/main/java/org/apache/sling/starter/startup/impl/StartupFilter.java
+++ /dev/null
@@ -1,95 +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.sling.starter.startup.impl;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.nio.charset.StandardCharsets;
-import java.util.stream.Collectors;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class StartupFilter implements Filter {
-
- private static final Logger LOG = LoggerFactory.getLogger(StartupFilter.class);
-
- private String content;
-
- StartupFilter() {
- // try a custom page (provided by a fragment bundle) first.
- InputStream is = StartupFilter.class.getClassLoader().getResourceAsStream("custom_index.html");
- if (is == null) {
- // try the standard page
- is = StartupFilter.class.getClassLoader().getResourceAsStream("index.html");
- }
- if (is != null) {
- BufferedReader buffer = null;
- try {
- buffer = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
- content = buffer.lines().collect(Collectors.joining(System.lineSeparator()));
- } finally {
- if (buffer != null) {
- try {
- buffer.close();
- } catch (IOException e) {
- LOG.error("Unable to release resource.", e);
- }
- }
- }
- }
- if (content == null || "".equals(content)) {
- content = "<html><head><meta http-equiv=\"refresh\" content=\"5\"><title>Apache Sling</title></head><body>" +
- "<h1>Apache Sling is starting up....</h1></body></html>";
- }
- }
-
- @Override
- public void init(final FilterConfig filterConfig) {
- // nothing to do
- }
-
- @Override
- public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException {
-
- HttpServletResponse httpResponse = (HttpServletResponse) response;
- httpResponse.setContentType("text/html");
- httpResponse.setCharacterEncoding("utf-8");
- httpResponse.setHeader("Cache-Control", "no-store");
- httpResponse.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
- if (!"".equals(content) && content != null) {
- final PrintWriter pw = response.getWriter();
- pw.append(content);
- pw.flush();
- }
- }
-
- @Override
- public void destroy() {
- // nothing to do
- }
-}
diff --git a/src/main/resources/index.html b/src/main/resources/index.html
deleted file mode 100644
index 5468e12..0000000
--- a/src/main/resources/index.html
+++ /dev/null
@@ -1,265 +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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>If you start me up</title>
- <style rel="stylesheet">
- body, h1 {
- font-weight: 300
- }
-
- .Home-Grid ul, h2, p {
- line-height: 1.8em
- }
-
- .Grid {
- display: flex;
- flex-wrap: wrap;
- justify-content: center
- }
-
- body, h2 {
- margin: 0
- }
-
- .Grid.Gutter > .Cell {
- padding: 0 1rem
- }
-
- .Grid.Align-Center {
- align-items: center
- }
-
- .Grid .Cell {
- -webkit-box-flex: 0;
- -webkit-flex: 0 0 100%;
- -ms-flex: 0 0 100%;
- flex: 0 0 100%
- }
-
- .Grid .Cell.Align-Center {
- align-self: center
- }
-
- .Grid.Fit-Mobile > .Cell {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- -ms-flex: 1;
- flex: 1
- }
-
- @media (min-width: 34em) {
- .Grid.Fit-Small > .Cell {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- -ms-flex: 1;
- flex: 1
- }
-
- }
-
- @media (min-width: 48em) {
- .Grid.Fit-Medium > .Cell {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- -ms-flex: 1;
- flex: 1
- }
-
- }
-
- @media (min-width: 62em) {
- .Grid .Cell.Large-15 {
- flex: 0 0 15%
- }
-
- .Grid .Cell.Large-25 {
- flex: 0 0 25%
- }
-
- .Grid .Cell.Large-35 {
- flex: 0 0 35%
- }
-
- .Grid .Cell.Large-50 {
- flex: 0 0 50%
- }
-
- .Grid.Fit-Large > .Cell {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- -ms-flex: 1;
- flex: 1
- }
- }
-
- @media (min-width: 75em) {
-
- .Grid.Fit-Extra > .Cell {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- -ms-flex: 1;
- flex: 1
- }
- }
-
- * {
- box-sizing: border-box
- }
-
- body {
- font-family: 'Open Sans', Helvetica, Arial;
- color: gray;
- position: relative;
- height: 100%;
- }
-
- h1 {
- font-size: 2.4em;
- color: #606060
- }
-
- h2 {
- font-weight: 400;
- font-size: 1em
- }
-
- a {
- color: #00678c;
- text-decoration: none
- }
-
- a:hover {
- text-decoration: underline
- }
-
- a img {
- border: none
- }
-
- .Home-Grid {
- min-height: 100%
- }
-
- .Home-Grid .Gradient {
- flex: 0 0 100%;
- height: 16px;
- background: url(data:image/jpeg;base64,/9j/4QPFRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAkAAAAcgEyAAIAAAAUAAAAlodpAAQAAAABAAAArAAAANgACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKE1hY2ludG9zaCkAMjAxNzowNTowMyAxMDozMToyMAAAAAADoAEAAwAAAAEAAQAAoAIABAAAAAEAAAAyoAMABAAAAAEAAAQ4AAAAAAAAAAYBAwADAAAAAQAGAAABGgAFAAAAAQAAASYBGwAFAAAAAQAAAS4BKAADAAAAAQACAAACAQAEAAAAAQAAATYCAgAEAAAAAQAAAocAAAAAAAAASAAAAAEAAABIAAAAAf/Y/+0ADEFkb [...]
- background-size: cover;
- }
-
- .Home-Grid .Logos {
- padding: 10% 20% 2%
- }
-
- .Home-Grid #sling-logo {
- display: block;
- margin-bottom: 32px;
- margin-right: -8%
- }
-
- @media (min-width: 48em) {
- .Home-Grid .Gradient {
- flex: 0 0 16px;
- height: auto
- }
-
- .Home-Grid .Logos {
- padding: 6%
- }
-
- .Home-Grid #sling-logo {
- margin-bottom: 180px
- }
- }
-
- .Home-Grid #asf-logo {
- display: block
- }
-
- .Home-Grid .Main-Content {
- padding: 0 16px
- }
-
- @media (min-width: 48em) {
- .Home-Grid .Main-Content {
- padding: 0 16px 0 0
- }
- }
-
- @media (min-width: 62em) {
- .Home-Grid .Main-Content {
- padding: 0
- }
- }
-
- .Home-Grid ul {
- margin: 0 0 1em;
- padding: 0;
- list-style: none
- }
- </style>
- <meta http-equiv="refresh" content="5">
-</head>
-<body>
-<div class="Grid Fit-Medium Home-Grid">
- <div class="Gradient"></div>
- <header class="Cell Medium-35 Large-25 Align-Center Logos">
- <a href="https://sling.apache.org" target="_blank" rel="noopener" id="sling-logo" title="Visit the Apache Sling website">
- <img src="data:image/svg+xml;base64,PCEtLQogIExpY2Vuc2VkIHRvIHRoZSBBcGFjaGUgU29mdHdhcmUgRm91bmRhdGlvbiAoQVNGKSB1bmRlciBvbmUKICBvciBtb3JlIGNvbnRyaWJ1dG9yIGxpY2Vuc2UgYWdyZWVtZW50cy4gIFNlZSB0aGUgTk9USUNFIGZpbGUKICBkaXN0cmlidXRlZCB3aXRoIHRoaXMgd29yayBmb3IgYWRkaXRpb25hbCBpbmZvcm1hdGlvbgogIHJlZ2FyZGluZyBjb3B5cmlnaHQgb3duZXJzaGlwLiAgVGhlIEFTRiBsaWNlbnNlcyB0aGlzIGZpbGUKICB0byB5b3UgdW5kZXIgdGhlIEFwYWNoZSBMaWNlbnNlLCBWZXJzaW9uIDIuMCAodGhlCiAgIkxpY2Vuc2UiKTsgeW91IG1heSBub3QgdXNlIHRoaXMg [...]
- alt="Apache Sling Logo">
- </a>
- <a href="https://apache.org" target="_blank" rel="noopener" id="asf-logo" title="Visit the Apache Software Foundation website">
- <img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLQogICAgTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZQogICAgb3IgbW9yZSBjb250cmlidXRvciBsaWNlbnNlIGFncmVlbWVudHMuICBTZWUgdGhlIE5PVElDRSBmaWxlCiAgICBkaXN0cmlidXRlZCB3aXRoIHRoaXMgd29yayBmb3IgYWRkaXRpb25hbCBpbmZvcm1hdGlvbgogICAgcmVnYXJkaW5nIGNvcHlyaWdodCBvd25lcnNoaXAuICBUaGUgQVNGIGxpY2Vuc2VzIHRoaXMgZmlsZQogICAgdG8geW91IHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVy [...]
- alt="Apache Software Foundation Logo">
- </a>
- </header>
- <div class="Cell Align-Center Main-Content">
- <div class="Grid">
- <section class="Cell Large-50">
- <h1>Apache Sling is starting up</h1>
- <p>To get started with Sling, see our <a href="https://sling.apache.org/" target="_blank"
- title="Visit the Apache Sling website">website</a>
- or the <a href="https://sling.apache.org/site/discover-sling-in-15-minutes.html" target="_blank">Sling in 15 minutes</a>
- tutorial.</p>
- </section>
- <div class="Cell Large-15"><!--/* Give the columns a bit of space between them. */--></div>
- <section class="Cell Large-35">
- <h1>Resources</h1>
- <h2>Reference</h2>
- <ul>
- <li><a href="https://sling.apache.org/apidocs/sling9/index.html" target="_blank" rel="noopener" title="Vist the Apache Sling Javadocs">API
- Documentation</a></li>
- <li><a href="https://sling.apache.org/project-information.html#mailing-lists" target="_blank" rel="noopener"
- title="View available Apache Sling mailing lists">Mailing Lists</a></li>
- <li><a href="https://sling.apache.org/documentation/tutorials-how-tos.html" target="_blank" rel="noopener"
- title="View Apache Sling Developer Tutorials">Tutorials</a></li>
- <li><a href="https://github.com/apache?utf8=%E2%9C%93&q=sling-&type=source" target="_blank" rel="noopener"
- title="View the Apache Sling source code on Github">Source Code</a></li>
- <li><a href="https://github.com/apache/sling-samples" target="_blank" rel="noopener"
- title="View Apache Sling sample applications on Github">Sample Applications</a></li>
- </ul>
- </section>
- </div>
- </div>
-</div>
-</body>
-</html>