Author: rombert
Date: Mon Aug  1 12:06:24 2016
New Revision: 1754740

URL: http://svn.apache.org/viewvc?rev=1754740&view=rev
Log:
SLING-5931 - Unable to register a servlet using the R6 Http Service
Whiteboard

Added an ignored test demonstrating the problem.

Added:
    
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/R6WhiteboardServletTest.java
    
sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/R6WhiteboardServlet.java

Added: 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/R6WhiteboardServletTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/R6WhiteboardServletTest.java?rev=1754740&view=auto
==============================================================================
--- 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/R6WhiteboardServletTest.java
 (added)
+++ 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/R6WhiteboardServletTest.java
 Mon Aug  1 12:06:24 2016
@@ -0,0 +1,37 @@
+/*
+ * 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.launchpad.webapp.integrationtest.servlets;
+
+import java.io.IOException;
+
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+import org.junit.Ignore;
+
+/**
+ * Test class which validates that the <tt>R6WhiteboardServlet</tt> is 
registered
+ *
+ */
+public class R6WhiteboardServletTest extends HttpTestBase {
+
+    @Ignore("SLING-5931")
+    public void testGetServletContent() throws IOException {
+        
+        String content = getContent(HTTP_BASE_URL + "/whiteboard_r6", 
CONTENT_TYPE_PLAIN);
+        
+        assertEquals("R6 OK", content);
+    }
+}

Added: 
sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/R6WhiteboardServlet.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/R6WhiteboardServlet.java?rev=1754740&view=auto
==============================================================================
--- 
sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/R6WhiteboardServlet.java
 (added)
+++ 
sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/R6WhiteboardServlet.java
 Mon Aug  1 12:06:24 2016
@@ -0,0 +1,48 @@
+/*
+ * 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.launchpad.testservices.servlets;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
+
+/**
+ * Example Sling servlets registered using the R6 HTTP Whiteboard
+ *
+ */
+@Service(javax.servlet.Servlet.class)
+@Component
+@Property(name="osgi.http.whiteboard.servlet.pattern", value="/whiteboard_r6")
+public class R6WhiteboardServlet extends SlingSafeMethodsServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    protected void doGet(SlingHttpServletRequest request, 
SlingHttpServletResponse response)
+            throws ServletException, IOException {
+
+        response.setContentType("text/plain");
+        response.getWriter().write("R6 OK");
+    }
+}


Reply via email to