felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1761524 - in /felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal: DispatcherServlet.java HttpServiceController.java dispatch/DispatcherServlet.java
Date Tue, 20 Sep 2016 06:01:26 GMT
Author: cziegeler
Date: Tue Sep 20 06:01:26 2016
New Revision: 1761524

URL: http://svn.apache.org/viewvc?rev=1761524&view=rev
Log:
Add changes from trunk

Added:
    felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/dispatch/DispatcherServlet.java
  (with props)
Removed:
    felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/DispatcherServlet.java
Modified:
    felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/HttpServiceController.java

Modified: felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/HttpServiceController.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/HttpServiceController.java?rev=1761524&r1=1761523&r2=1761524&view=diff
==============================================================================
--- felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/HttpServiceController.java
(original)
+++ felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/HttpServiceController.java
Tue Sep 20 06:01:26 2016
@@ -19,6 +19,7 @@ package org.apache.felix.http.base.inter
 import java.util.Hashtable;
 
 import javax.annotation.Nonnull;
+import javax.servlet.Servlet;
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpSessionAttributeListener;
 import javax.servlet.http.HttpSessionEvent;
@@ -26,6 +27,7 @@ import javax.servlet.http.HttpSessionIdL
 import javax.servlet.http.HttpSessionListener;
 
 import org.apache.felix.http.base.internal.dispatch.Dispatcher;
+import org.apache.felix.http.base.internal.dispatch.DispatcherServlet;
 import org.apache.felix.http.base.internal.handler.HttpSessionWrapper;
 import org.apache.felix.http.base.internal.registry.HandlerRegistry;
 import org.apache.felix.http.base.internal.service.HttpServiceFactory;
@@ -37,30 +39,17 @@ public final class HttpServiceController
     private final BundleContext bundleContext;
     private final HandlerRegistry registry;
     private final Dispatcher dispatcher;
-    private final DispatcherServlet dispatcherServlet;
     private final EventDispatcher eventDispatcher;
     private final HttpServiceFactory httpServiceFactory;
     private final WhiteboardManager whiteboardManager;
 
     private volatile HttpSessionListener httpSessionListener;
 
-
-    public DispatcherServlet getDispatcherServlet()
-    {
-        return this.dispatcherServlet;
-    }
-
-    public EventDispatcher getEventDispatcher()
-    {
-        return this.eventDispatcher;
-    }
-
     public HttpServiceController(final BundleContext bundleContext)
     {
         this.bundleContext = bundleContext;
         this.registry = new HandlerRegistry();
         this.dispatcher = new Dispatcher(this.registry);
-        this.dispatcherServlet = new DispatcherServlet(this.dispatcher);
         this.eventDispatcher = new EventDispatcher(this);
         this.httpServiceFactory = new HttpServiceFactory(this.bundleContext, this.registry);
         this.whiteboardManager = new WhiteboardManager(bundleContext, this.httpServiceFactory,
this.registry);
@@ -69,12 +58,20 @@ public final class HttpServiceController
     public void stop()
     {
         this.unregister();
-        this.dispatcherServlet.destroy();
     }
 
-    public Dispatcher getDispatcher()
+    /**
+     * Create a new dispatcher servlet
+     * @return The dispatcher servlet.
+     */
+    public @Nonnull Servlet createDispatcherServlet()
     {
-        return this.dispatcher;
+        return new DispatcherServlet(this.dispatcher);
+    }
+
+    public EventDispatcher getEventDispatcher()
+    {
+        return this.eventDispatcher;
     }
 
     HttpSessionListener getSessionListener()

Added: felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/dispatch/DispatcherServlet.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/dispatch/DispatcherServlet.java?rev=1761524&view=auto
==============================================================================
--- felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/dispatch/DispatcherServlet.java
(added)
+++ felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/dispatch/DispatcherServlet.java
Tue Sep 20 06:01:26 2016
@@ -0,0 +1,51 @@
+/*
+ * 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.base.internal.dispatch;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.felix.http.base.internal.HttpServiceController;
+
+/**
+ * The dispatcher servlet is registered in the container.
+ * It is dispatching requests to the http implementation.
+ * It does not start the http service, this needs to be done
+ * through the {@link HttpServiceController}.
+ */
+public class DispatcherServlet extends HttpServlet
+{
+    private static final long serialVersionUID = -7692620012572476116L;
+
+    private final Dispatcher controller;
+
+    public DispatcherServlet(final Dispatcher controller)
+    {
+        this.controller = controller;
+    }
+
+    @Override
+    protected void service(final HttpServletRequest req, final HttpServletResponse res)
+            throws ServletException, IOException
+    {
+        this.controller.dispatch(req, res);
+    }
+}

Propchange: felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/dispatch/DispatcherServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/sandbox/http-base-r7/src/main/java/org/apache/felix/http/base/internal/dispatch/DispatcherServlet.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url



Mime
View raw message