You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2023/08/18 04:41:42 UTC
[felix-dev] branch jakarta-servlet-6 updated: No need to fork samples
This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch jakarta-servlet-6
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/jakarta-servlet-6 by this push:
new 2e8f19e006 No need to fork samples
2e8f19e006 is described below
commit 2e8f19e006dc432c7edbdc0917832c04c79fbd79
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Aug 18 06:41:33 2023 +0200
No need to fork samples
---
http/samples/whiteboard/pom.xml | 82 ---------------------
.../felix/http/samples/whiteboard/Activator.java | 86 ----------------------
.../felix/http/samples/whiteboard/TestFilter.java | 54 --------------
.../felix/http/samples/whiteboard/TestServlet.java | 67 -----------------
.../samples/whiteboard/TestServletContext.java | 33 ---------
5 files changed, 322 deletions(-)
diff --git a/http/samples/whiteboard/pom.xml b/http/samples/whiteboard/pom.xml
deleted file mode 100644
index b318389d43..0000000000
--- a/http/samples/whiteboard/pom.xml
+++ /dev/null
@@ -1,82 +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.
--->
-<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.felix</groupId>
- <artifactId>org.apache.felix.http.parent</artifactId>
- <version>16-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
- </parent>
-
- <name>Apache Felix Http Samples - Whiteboard</name>
- <description>This example shows how to register servlets and filters using the Servlet Whiteboard Service.</description>
- <artifactId>org.apache.felix.http.samples.whiteboard</artifactId>
- <version>5.0.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <scm>
- <connection>scm:git:https://github.com/apache/felix-dev.git</connection>
- <developerConnection>scm:git:https://github.com/apache/felix-dev.git</developerConnection>
- <url>https://gitbox.apache.org/repos/asf?p=felix-dev.git</url>
- </scm>
-
- <properties>
- <felix.java.version>17</felix.java.version>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Activator>
- org.apache.felix.http.samples.whiteboard.Activator
- </Bundle-Activator>
- <Export-Package>
- !org.apache.felix.http.samples.whiteboard
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>jakarta.servlet</groupId>
- <artifactId>jakarta.servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.servlet</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/Activator.java b/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/Activator.java
deleted file mode 100644
index 5b92209475..0000000000
--- a/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/Activator.java
+++ /dev/null
@@ -1,86 +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.felix.http.samples.whiteboard;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import jakarta.servlet.Filter;
-import jakarta.servlet.Servlet;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.servlet.context.ServletContextHelper;
-import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants;
-import org.osgi.service.servlet.whiteboard.annotations.RequireHttpWhiteboard;
-
-@RequireHttpWhiteboard
-public final class Activator
- implements BundleActivator
-{
-
- @Override
- public void start(BundleContext context)
- throws Exception
- {
- // create a servlet context
- final TestServletContext servletContext = new TestServletContext(context.getBundle());
-
- // register the servlet context with name "filtersample" at "/filtersample"
- final Dictionary<String, Object> servletContextProps = new Hashtable<>();
- servletContextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "filtersample");
- servletContextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/filtersample");
- context.registerService(ServletContextHelper.class, servletContext, servletContextProps);
-
- // create and register servlets
- final TestServlet servlet1 = new TestServlet("servlet1");
- final Dictionary<String, Object> servlet1Props = new Hashtable<>();
- servlet1Props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/");
- servlet1Props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
- "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=filtersample)");
- context.registerService(Servlet.class, servlet1, servlet1Props);
-
- final TestServlet servlet2 = new TestServlet("servlet2");
- final Dictionary<String, Object> servlet2Props = new Hashtable<>();
- servlet2Props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/other/*");
- servlet2Props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
- "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=filtersample)");
- context.registerService(Servlet.class, servlet2, servlet2Props);
-
- // create and register filters
- final TestFilter filter1 = new TestFilter("filter1");
- final Dictionary<String, Object> filter1Props = new Hashtable<>();
- filter1Props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/*");
- filter1Props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
- "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=filtersample)");
- context.registerService(Filter.class, filter1, filter1Props);
-
- final TestFilter filter2 = new TestFilter("filter2");
- final Dictionary<String, Object> filter2Props = new Hashtable<>();
- filter2Props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/other/*");
- filter2Props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
- "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=filtersample)");
- context.registerService(Filter.class, filter2, filter2Props);
- }
-
- @Override
- public void stop(BundleContext context)
- throws Exception
- {
- // nothing to do, services are unregistered automatically
- }
-}
diff --git a/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/TestFilter.java b/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/TestFilter.java
deleted file mode 100644
index 0d47566a66..0000000000
--- a/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/TestFilter.java
+++ /dev/null
@@ -1,54 +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.felix.http.samples.whiteboard;
-
-import jakarta.servlet.*;
-import java.io.IOException;
-
-public class TestFilter
- implements Filter
-{
- private final String name;
-
- public TestFilter(String name)
- {
- this.name = name;
- }
-
- public void init(FilterConfig config)
- throws ServletException
- {
- doLog("Init with config [" + config + "]");
- }
-
- public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
- throws IOException, ServletException
- {
- doLog("Filter request [" + req + "]");
- chain.doFilter(req, res);
- }
-
- public void destroy()
- {
- doLog("Destroyed filter");
- }
-
- private void doLog(String message)
- {
- System.out.println("## [" + this.name + "] " + message);
- }
-}
diff --git a/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/TestServlet.java b/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/TestServlet.java
deleted file mode 100644
index 01d90c387e..0000000000
--- a/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/TestServlet.java
+++ /dev/null
@@ -1,67 +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.felix.http.samples.whiteboard;
-
-import jakarta.servlet.http.HttpServlet;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-import jakarta.servlet.ServletConfig;
-import jakarta.servlet.ServletException;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-public class TestServlet
- extends HttpServlet
-{
- private final String name;
-
- public TestServlet(String name)
- {
- this.name = name;
- }
-
- @Override
- public void init(ServletConfig config)
- throws ServletException
- {
- doLog("Init with config [" + config + "]");
- super.init(config);
- }
-
- @Override
- public void destroy()
- {
- doLog("Destroyed servlet");
- super.destroy();
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse res)
- throws ServletException, IOException
- {
- res.setContentType("text/plain");
- PrintWriter out = res.getWriter();
-
- out.println("Request = " + req);
- out.println("PathInfo = " + req.getPathInfo());
- }
-
- private void doLog(String message)
- {
- System.out.println("## [" + this.name + "] " + message);
- }
-}
diff --git a/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/TestServletContext.java b/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/TestServletContext.java
deleted file mode 100644
index 79644d4a73..0000000000
--- a/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/TestServletContext.java
+++ /dev/null
@@ -1,33 +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.felix.http.samples.whiteboard;
-
-import org.osgi.framework.Bundle;
-import org.osgi.service.servlet.context.ServletContextHelper;
-
-/**
- * Simple sample servlet context
- */
-public class TestServletContext
- extends ServletContextHelper
-{
-
- public TestServletContext(final Bundle bundle)
- {
- super(bundle);
- }
-}