felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1815779 - /felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
Date Mon, 20 Nov 2017 09:06:33 GMT
Author: cziegeler
Date: Mon Nov 20 09:06:33 2017
New Revision: 1815779

URL: http://svn.apache.org/viewvc?rev=1815779&view=rev
Log:
FELIX-5296 : Implement Http Whiteboard Service Updates (RFC 223)

Modified:
    felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java

Modified: felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java?rev=1815779&r1=1815778&r2=1815779&view=diff
==============================================================================
--- felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
(original)
+++ felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
Mon Nov 20 09:06:33 2017
@@ -666,32 +666,36 @@ public final class WhiteboardManager
     {
         if ( h.getContextInfo().getServiceId() == HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID
)
         {
-        	if ( info instanceof ResourceInfo )
-        	{
+            // In order to be compatible with the implementation of the http service 1.0
+            // we need still support servlet/resource registrations not using the
+            // 1.1 HTTP_SERVICE_CONTEXT_PROPERTY property. (contains is not the best check
but
+            // it should do the trick)
+          	if ( info instanceof ResourceInfo && info.getContextSelection().contains(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY))
+        	    {
                 this.failureStateHandler.addFailure(info, HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID,
DTOConstants.FAILURE_REASON_VALIDATION_FAILED);
 
                 return DTOConstants.FAILURE_REASON_VALIDATION_FAILED;
             }
-        	else if ( info instanceof ServletInfo )
-        	{
-        		final ServletInfo servletInfo = (ServletInfo)info;
-        		final boolean nameIsEmpty = servletInfo.getName() == null || servletInfo.getName().isEmpty();
-        		final boolean errorPageIsEmpty = servletInfo.getErrorPage() == null || servletInfo.getErrorPage().length
== 0;
-        		final boolean patternIsEmpty = servletInfo.getPatterns() == null || servletInfo.getPatterns().length
== 0;
-        		if ( !nameIsEmpty || !errorPageIsEmpty )
-        		{
-        			if ( patternIsEmpty )
-        			{
-        				// no pattern, so this is valid
-        				return -1;
-        			}
-        		}
+        	    else if ( info instanceof ServletInfo && info.getContextSelection().contains(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY))
+        	    {
+        		    final ServletInfo servletInfo = (ServletInfo)info;
+        		    final boolean nameIsEmpty = servletInfo.getName() == null || servletInfo.getName().isEmpty();
+        		    final boolean errorPageIsEmpty = servletInfo.getErrorPage() == null || servletInfo.getErrorPage().length
== 0;
+        		    final boolean patternIsEmpty = servletInfo.getPatterns() == null || servletInfo.getPatterns().length
== 0;
+        		    if ( !nameIsEmpty || !errorPageIsEmpty )
+        		    {
+        			    if ( patternIsEmpty )
+        			    {
+        				    // no pattern, so this is valid
+        				    return -1;
+        			    }
+        		    }
 
-        		// pattern is invalid, regardless of the other values
-                this.failureStateHandler.addFailure(info, HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID,
DTOConstants.FAILURE_REASON_VALIDATION_FAILED);
+    		        // pattern is invalid, regardless of the other values
+    		        this.failureStateHandler.addFailure(info, HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID,
DTOConstants.FAILURE_REASON_VALIDATION_FAILED);
 
-                return DTOConstants.FAILURE_REASON_VALIDATION_FAILED;
-        	}
+    		        return DTOConstants.FAILURE_REASON_VALIDATION_FAILED;
+        	    }
         }
 
         return -1;



Mime
View raw message