This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new 5836a61f Add offline context module
5836a61f is described below
commit 5836a61f7fc659d00016aafaa779208509ed0443
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Wed Oct 4 13:41:11 2023 +0200
Add offline context module
---
org.apache.sling.offline/bnd.bnd | 9 +
org.apache.sling.offline/pom.xml | 78 +++++
.../apache/sling/offline/impl/OfflineContext.java | 360 +++++++++++++++++++++
3 files changed, 447 insertions(+)
diff --git a/org.apache.sling.offline/bnd.bnd b/org.apache.sling.offline/bnd.bnd
new file mode 100644
index 00000000..858735f3
--- /dev/null
+++ b/org.apache.sling.offline/bnd.bnd
@@ -0,0 +1,9 @@
+Export-Package=org.osgi.service.http.context, \
+ org.osgi.service.http.runtime, \
+ org.osgi.service.http.runtime.dto, \
+ org.osgi.service.http.whiteboard
+
+Provide-Capability=osgi.implementation;osgi.implementation="osgi.http";version:Version="1.1";
\
+
uses:="javax.servlet,javax.servlet.http,org.osgi.service.http.context,org.osgi.service.http.whiteboard"
+
+Require-Capability=osgi.contract;filter:="(&(osgi.contract=JavaServlet)(version=3.0))"
diff --git a/org.apache.sling.offline/pom.xml b/org.apache.sling.offline/pom.xml
new file mode 100644
index 00000000..5ed4253d
--- /dev/null
+++ b/org.apache.sling.offline/pom.xml
@@ -0,0 +1,78 @@
+<?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-bundle-parent</artifactId>
+ <version>52</version>
+ <relativePath/>
+ </parent>
+
+ <artifactId>org.apache.sling.offline</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <name>Apache Sling Offline Module</name>
+
+ <properties>
+ <sling.java.version>11</sling.java.version>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>biz.aQute.bnd</groupId>
+ <artifactId>bnd-baseline-maven-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.component.annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.metatype.annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.api</artifactId>
+ <version>2.27.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.http.whiteboard</artifactId>
+ <version>1.1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git
a/org.apache.sling.offline/src/main/java/org/apache/sling/offline/impl/OfflineContext.java
b/org.apache.sling.offline/src/main/java/org/apache/sling/offline/impl/OfflineContext.java
new file mode 100644
index 00000000..44f4aa2c
--- /dev/null
+++
b/org.apache.sling.offline/src/main/java/org/apache/sling/offline/impl/OfflineContext.java
@@ -0,0 +1,360 @@
+/*
+ * 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.offline.impl;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
+import javax.servlet.FilterRegistration.Dynamic;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+import javax.servlet.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
+
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
+
+@Component(service = {})
+public class OfflineContext implements ServletContext{
+
+ @Reference(target="(" +
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT+"=\\(" +
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=org.apache.sling\\))")
+ private ServletContextListener listener;
+
+ @Activate
+ protected void activate() {
+ this.listener.contextInitialized(new ServletContextEvent(this));
+ }
+
+ @Deactivate
+ protected void deactivate() {
+ this.listener.contextDestroyed(null);
+ }
+
+ @Override
+ public String getContextPath() {
+ return "";
+ }
+
+ @Override
+ public ServletContext getContext(String uripath) {
+ return this;
+ }
+
+ @Override
+ public int getMajorVersion() {
+ return 3;
+ }
+
+ @Override
+ public int getMinorVersion() {
+ return 1;
+ }
+
+ @Override
+ public int getEffectiveMajorVersion() {
+ return this.getMajorVersion();
+ }
+
+ @Override
+ public int getEffectiveMinorVersion() {
+ return this.getMinorVersion();
+ }
+
+ @Override
+ public String getMimeType(String file) {
+ return null;
+ }
+
+ @Override
+ public Set<String> getResourcePaths(String path) {
+ return null;
+ }
+
+ @Override
+ public String getRealPath(String path) {
+ return path;
+ }
+
+ @Override
+ public String getServerInfo() {
+ return "Apache Sling Offline";
+ }
+
+ @Override
+ public String getInitParameter(String name) {
+ return null;
+ }
+
+ @Override
+ public Enumeration<String> getInitParameterNames() {
+ return Collections.emptyEnumeration();
+ }
+
+ @Override
+ public boolean setInitParameter(String name, String value) {
+ return false;
+ }
+
+ @Override
+ public Object getAttribute(String name) {
+ return null;
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNames() {
+ return Collections.emptyEnumeration();
+ }
+
+ @Override
+ public void setAttribute(String name, Object object) {
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ }
+
+ @Override
+ public String getServletContextName() {
+ return "Apache Sling Offline";
+ }
+
+ @Override
+ public Dynamic addFilter(String filterName, String className) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Dynamic addFilter(String filterName, Filter filter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Dynamic addFilter(String filterName, Class<? extends Filter>
filterClass) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addListener(String className) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public <T extends EventListener> void addListener(T t) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addListener(Class<? extends EventListener> listenerClass) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String
servletName, String className) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String
servletName, Servlet servlet) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String
servletName,
+ Class<? extends Servlet> servletClass) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T extends Filter> T createFilter(Class<T> clazz) throws
ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T extends EventListener> T createListener(Class<T> clazz) throws
ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T extends Servlet> T createServlet(Class<T> clazz) throws
ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void declareRoles(String... roleNames) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ClassLoader getClassLoader() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public FilterRegistration getFilterRegistration(String filterName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public RequestDispatcher getNamedDispatcher(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public URL getResource(String path) throws MalformedURLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getResourceAsStream(String path) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Servlet getServlet(String name) throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration<String> getServletNames() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServletRegistration getServletRegistration(String servletName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, ? extends ServletRegistration>
getServletRegistrations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration<Servlet> getServlets() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SessionCookieConfig getSessionCookieConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getVirtualServerName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void log(String msg) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void log(Exception exception, String msg) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void log(String message, Throwable throwable) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setSessionTrackingModes(Set<SessionTrackingMode>
sessionTrackingModes) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}