This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
commit 531c913496d02b27f9c43e4477d4171b02f9b82c Author: Bertrand Delacretaz <[email protected]> AuthorDate: Tue Sep 14 21:06:50 2021 +0200 TestService works, without sling engine bundle for now --- aries-jax-rs-whiteboard/.gitignore | 2 + aries-jax-rs-whiteboard/pom.xml | 18 ++++++++ .../java/org/apache/sling/jaxrs/TestService.java | 48 ++++++++++++++++++++++ .../features/feature-aries-jars-sample.json | 3 +- .../test/resources/features/feature-sling12.json | 2 +- 5 files changed, 71 insertions(+), 2 deletions(-) diff --git a/aries-jax-rs-whiteboard/.gitignore b/aries-jax-rs-whiteboard/.gitignore new file mode 100644 index 0000000..f87a37c --- /dev/null +++ b/aries-jax-rs-whiteboard/.gitignore @@ -0,0 +1,2 @@ +conf/ +launcher/ diff --git a/aries-jax-rs-whiteboard/pom.xml b/aries-jax-rs-whiteboard/pom.xml index 71f7040..36993fc 100644 --- a/aries-jax-rs-whiteboard/pom.xml +++ b/aries-jax-rs-whiteboard/pom.xml @@ -104,6 +104,24 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.apache.aries.spec</groupId> + <artifactId>org.apache.aries.javax.jax.rs-api</artifactId> + <version>1.0.4</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.aries.jax.rs</groupId> + <artifactId>org.apache.aries.jax.rs.whiteboard</artifactId> + <version>2.0.1</version> + <scope>provided</scope> + <exclusions> + <exclusion> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jaxrs_2.1_spec</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.kickstart</artifactId> <version>0.0.2</version> diff --git a/aries-jax-rs-whiteboard/src/main/java/org/apache/sling/jaxrs/TestService.java b/aries-jax-rs-whiteboard/src/main/java/org/apache/sling/jaxrs/TestService.java new file mode 100644 index 0000000..5942ed2 --- /dev/null +++ b/aries-jax-rs-whiteboard/src/main/java/org/apache/sling/jaxrs/TestService.java @@ -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.jaxrs; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.osgi.service.component.annotations.Component; +import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsResource; + +@Path("/jaxrs") +@Produces(MediaType.TEXT_PLAIN) +@Component(service=TestService.class) +@JaxrsResource +public class TestService { + + @GET + @Path("/{one}") + public String getOne(@PathParam("one") String one) { + return String.format("The single input was %s (%d characters)", one, one.length()); + } + + @GET + @Path("/{one}/{two}") + public String getTwo(@PathParam("one") String one, @PathParam("two") String two) { + return String.format("The dual input was %s and %s", one, two); + } + +} \ No newline at end of file diff --git a/aries-jax-rs-whiteboard/src/test/resources/features/feature-aries-jars-sample.json b/aries-jax-rs-whiteboard/src/test/resources/features/feature-aries-jars-sample.json index 9a1e66c..311b92e 100644 --- a/aries-jax-rs-whiteboard/src/test/resources/features/feature-aries-jars-sample.json +++ b/aries-jax-rs-whiteboard/src/test/resources/features/feature-aries-jars-sample.json @@ -6,6 +6,7 @@ "license":"Apache License, Version 2.0", "variables":{}, "bundles":[ + "org.apache.sling:org.apache.sling.experimental.aries.jaxrs.whiteboard:0.0.1-SNAPSHOT", "org.osgi:org.osgi.service.jaxrs:1.0.0", "org.apache.aries.spec:org.apache.aries.javax.jax.rs-api:1.0.4", "org.apache.aries.jax.rs:org.apache.aries.jax.rs.whiteboard:2.0.1", @@ -51,7 +52,7 @@ "org.apache.sling.commons.log.level": "DEBUG", "org.apache.sling.commons.log.names": [ - "org.apache.sling.servlet" + "org.apache.aries" ], "org.apache.sling.commons.log.pattern": "%-5level [%-50logger{50}] %message ## %mdc{sling.InternalRequest} %n" } diff --git a/aries-jax-rs-whiteboard/src/test/resources/features/feature-sling12.json b/aries-jax-rs-whiteboard/src/test/resources/features/feature-sling12.json index 84c82ac..5afede1 100644 --- a/aries-jax-rs-whiteboard/src/test/resources/features/feature-sling12.json +++ b/aries-jax-rs-whiteboard/src/test/resources/features/feature-sling12.json @@ -495,7 +495,7 @@ }, { "id":"org.apache.sling:org.apache.sling.engine:2.7.2", - "start-order":"20", + "start-order":"99", "feature-origins":"org.apache.sling:org.apache.sling.kickstart.conversion:slingfeature:sling:0.0.1-SNAPSHOT" }, {
