[BROOKLYN-183] REST API using CXF JAX-RS 2.0 implementation

Changes:

* Replace Jersey dependency (JAX-RS 1.1) implementation with CXF (JAX-RS 2.0)
* Use relative paths for REST resource paths

Move the context root at /v1, and use paths relative to that in resource
annotations.

* Add CXF REST resources to karaf features
* Remove /v1 prefix from brooklyn-rest-api resources
* Move CXF servlet context to /v1

In order to preserve compatibility with the existing brooklyn REST API
we need to expose resources at path /v1 instead of /cxf/v1.

For now move the whole CXF servlet at /v1, and with resources mounted at
/ we get the historical path /v1/ for the REST API. We'll need to make
the JSGUI configurable with the base REST API path in the future though.

Also add appropriate providers to the OSGi CXF service blueprint.

* Use relative paths when referring REST resources

Don't use absolute paths based on the assumption that the REST API is
deployed at /v1.

Instead use an UriBuilder provided by JAX-RS as a context-injected
UriInfo object, which should work with any root context path.

Also drop the /v1 prefix from REST API tests and test fixtures.

* Fix usage of resources in CXF unit tests

Use HTTP transport instead of local transport so we can have a ServletContext 
to get/setAttribute.
Allow CXF to use BrooklynJacksonJsonProvider for message formatting and parsing.
Inject the ManagementContext in resources and providers.
Add request/response logging during tests.

* Pull up common implementation of configureCXF

All tests ended up using the same configuration of the REST API, so it
makes sense to move that into the base class

This had the side effect of worsening the interleaving of test methods
by testng, so each resource test was separated into its own suite.

* Fix DeployBlueprintTest

Also change getEndpointAddress() to use template method instead of
setter/getter.

* Wait for CXF resources to start in karaf itest

* Remove CatalogApi's multipart/form-data create method

There is no standard JAX-RS way to process multipart/form-data contents,
so this service was removed from the API for the purpose of unifying the
CXF and Jersey API.

* Adjust OSGi package import directives to allow a version range of 1.1 to
2.0 of JAX-RS directives.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/6f624c78
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/6f624c78
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/6f624c78

Branch: refs/heads/master
Commit: 6f624c78b1e7fe72c6df1ecd297b922721b2c023
Parents: 495b1d3
Author: Ciprian Ciubotariu <cheepe...@gmx.net>
Authored: Tue Feb 9 19:23:20 2016 +0200
Committer: Svetoslav Neykov <svetoslav.ney...@cloudsoftcorp.com>
Committed: Mon Feb 15 16:43:57 2016 +0200

----------------------------------------------------------------------
 camp/camp-server/pom.xml                        |  21 +-
 .../brooklyn/camp/server/CampRestApp.java       |  36 +
 .../brooklyn/camp/server/RestApiSetup.java      |  43 ++
 .../brooklyn/camp/server/rest/CampServer.java   |  32 +-
 karaf/apache-brooklyn/pom.xml                   |   2 +-
 .../main/resources/etc/org.apache.cxf.osgi.cfg  |  20 +
 karaf/features/src/main/feature/feature.xml     |  30 +-
 karaf/itest/pom.xml                             |  13 +
 .../java/org/apache/brooklyn/AssemblyTest.java  |   4 +-
 launcher/pom.xml                                |  19 +-
 .../org/apache/brooklyn/launcher/Activator.java |   2 +
 .../brooklyn/launcher/BrooklynWebServer.java    |  99 +--
 .../camp/BrooklynCampPlatformLauncher.java      |   1 +
 .../jsgui/BrooklynJavascriptGuiLauncher.java    |   2 +-
 .../BrooklynJavascriptGuiLauncherTest.java      |  18 +-
 locations/jclouds/pom.xml                       |  12 +
 parent/pom.xml                                  | 182 +++--
 pom.xml                                         |   7 +-
 rest/rest-api/pom.xml                           |  21 +-
 .../org/apache/brooklyn/rest/api/AccessApi.java |   2 +-
 .../apache/brooklyn/rest/api/ActivityApi.java   |   2 +-
 .../brooklyn/rest/api/ApplicationApi.java       |   2 +-
 .../apache/brooklyn/rest/api/CatalogApi.java    |  28 +-
 .../apache/brooklyn/rest/api/EffectorApi.java   |   2 +-
 .../org/apache/brooklyn/rest/api/EntityApi.java |   4 +-
 .../brooklyn/rest/api/EntityConfigApi.java      |   4 +-
 .../apache/brooklyn/rest/api/LocationApi.java   |   2 +-
 .../org/apache/brooklyn/rest/api/PolicyApi.java |   2 +-
 .../brooklyn/rest/api/PolicyConfigApi.java      |   2 +-
 .../org/apache/brooklyn/rest/api/ScriptApi.java |   2 +-
 .../org/apache/brooklyn/rest/api/SensorApi.java |   5 +-
 .../org/apache/brooklyn/rest/api/ServerApi.java |   2 +-
 .../org/apache/brooklyn/rest/api/UsageApi.java  |   2 +-
 .../apache/brooklyn/rest/api/VersionApi.java    |   4 +-
 rest/rest-api/src/main/webapp/WEB-INF/web.xml   | 121 ----
 .../rest/domain/ApplicationSpecTest.java        |   2 +-
 .../rest/domain/EffectorSummaryTest.java        |   2 +-
 .../brooklyn/rest/domain/EntitySummaryTest.java |   8 +-
 .../rest/domain/LocationSummaryTest.java        |   2 +-
 .../resources/fixtures/application-list.json    |   8 +-
 .../resources/fixtures/application-spec.json    |   2 +-
 .../test/resources/fixtures/application.json    |   4 +-
 .../fixtures/effector-summary-list.json         |  18 +-
 .../resources/fixtures/effector-summary.json    |   2 +-
 .../resources/fixtures/entity-summary-list.json |   8 +-
 .../test/resources/fixtures/entity-summary.json |   8 +-
 .../test/resources/fixtures/location-list.json  |   2 +-
 .../resources/fixtures/location-summary.json    |   2 +-
 .../resources/fixtures/sensor-summary-list.json |  16 +-
 .../test/resources/fixtures/sensor-summary.json |   2 +-
 rest/rest-client/pom.xml                        |   7 +
 .../rest/client/BrooklynApiRestClientTest.java  |   3 +-
 rest/rest-resources/pom.xml                     | 220 ++++++
 .../apache/brooklyn/rest/BrooklynRestApi.java   |  91 +++
 .../apache/brooklyn/rest/BrooklynRestApp.java   |  56 ++
 .../apache/brooklyn/rest/BrooklynWebConfig.java | 164 +++++
 .../rest/filter/HaHotCheckResourceFilter.java   | 159 +++++
 .../rest/filter/HaHotStateRequired.java         |  38 +
 .../brooklyn/rest/filter/NoCacheFilter.java     |  40 ++
 .../resources/AbstractBrooklynRestResource.java | 156 +++++
 .../brooklyn/rest/resources/AccessResource.java |  46 ++
 .../rest/resources/ActivityResource.java        |  99 +++
 .../brooklyn/rest/resources/ApidocResource.java |  35 +
 .../rest/resources/ApplicationResource.java     | 451 ++++++++++++
 .../rest/resources/CatalogResource.java         | 509 ++++++++++++++
 .../rest/resources/EffectorResource.java        | 114 +++
 .../rest/resources/EntityConfigResource.java    | 206 ++++++
 .../brooklyn/rest/resources/EntityResource.java | 223 ++++++
 .../rest/resources/LocationResource.java        | 186 +++++
 .../rest/resources/PolicyConfigResource.java    | 108 +++
 .../brooklyn/rest/resources/PolicyResource.java | 135 ++++
 .../brooklyn/rest/resources/ScriptResource.java | 102 +++
 .../brooklyn/rest/resources/SensorResource.java | 184 +++++
 .../brooklyn/rest/resources/ServerResource.java | 497 +++++++++++++
 .../brooklyn/rest/resources/UsageResource.java  | 256 +++++++
 .../rest/resources/VersionResource.java         |  32 +
 .../brooklyn/rest/security/PasswordHasher.java  |  32 +
 .../provider/AbstractSecurityProvider.java      |  56 ++
 .../provider/AnyoneSecurityProvider.java        |  40 ++
 .../provider/BlackholeSecurityProvider.java     |  40 ++
 ...nUserWithRandomPasswordSecurityProvider.java |  73 ++
 .../provider/DelegatingSecurityProvider.java    | 165 +++++
 .../provider/ExplicitUsersSecurityProvider.java | 117 ++++
 .../security/provider/LdapSecurityProvider.java | 132 ++++
 .../security/provider/SecurityProvider.java     |  35 +
 .../rest/transform/AccessTransformer.java       |  42 ++
 .../rest/transform/ApplicationTransformer.java  | 125 ++++
 .../transform/BrooklynFeatureTransformer.java   |  45 ++
 .../rest/transform/CatalogTransformer.java      | 188 +++++
 .../rest/transform/EffectorTransformer.java     |  91 +++
 .../rest/transform/EntityTransformer.java       | 182 +++++
 .../transform/HighAvailabilityTransformer.java  |  50 ++
 .../rest/transform/LocationTransformer.java     | 202 ++++++
 .../rest/transform/PolicyTransformer.java       |  97 +++
 .../rest/transform/SensorTransformer.java       |  88 +++
 .../rest/transform/TaskTransformer.java         | 153 ++++
 .../rest/util/BrooklynRestResourceUtils.java    | 609 ++++++++++++++++
 .../rest/util/DefaultExceptionMapper.java       | 111 +++
 .../brooklyn/rest/util/EntityLocationUtils.java |  85 +++
 .../brooklyn/rest/util/FormMapProvider.java     |  86 +++
 .../rest/util/ManagementContextProvider.java    |  41 ++
 .../apache/brooklyn/rest/util/OsgiCompat.java   |  40 ++
 .../brooklyn/rest/util/ShutdownHandler.java     |  23 +
 .../rest/util/ShutdownHandlerProvider.java      |  41 ++
 .../brooklyn/rest/util/URLParamEncoder.java     |  27 +
 .../brooklyn/rest/util/WebResourceUtils.java    | 197 ++++++
 .../rest/util/json/BidiSerialization.java       | 173 +++++
 .../util/json/BrooklynJacksonJsonProvider.java  | 177 +++++
 .../json/ConfigurableSerializerProvider.java    |  90 +++
 .../ErrorAndToStringUnknownTypeSerializer.java  | 123 ++++
 .../rest/util/json/MultimapSerializer.java      |  64 ++
 ...StrictPreferringFieldsVisibilityChecker.java | 108 +++
 .../resources/OSGI-INF/blueprint/service.xml    | 112 +++
 .../main/resources/build-metadata.properties    |  18 +
 .../src/main/resources/not-a-jar-file.txt       |  18 +
 .../src/main/resources/reset-catalog.xml        |  37 +
 .../brooklyn/rest/domain/ApplicationTest.java   |  86 +++
 .../brooklyn/rest/domain/SensorSummaryTest.java | 102 +++
 .../brooklyn/rest/filter/HaHotCheckTest.java    | 120 ++++
 .../rest/resources/AccessResourceTest.java      |  67 ++
 .../rest/resources/ApidocResourceTest.java      | 135 ++++
 .../ApplicationResourceIntegrationTest.java     | 132 ++++
 .../rest/resources/ApplicationResourceTest.java | 697 ++++++++++++++++++
 .../rest/resources/CatalogResetTest.java        | 118 ++++
 .../rest/resources/CatalogResourceTest.java     | 510 ++++++++++++++
 .../rest/resources/DelegatingPrintStream.java   | 183 +++++
 .../rest/resources/DescendantsTest.java         | 128 ++++
 .../resources/EntityConfigResourceTest.java     | 171 +++++
 .../rest/resources/EntityResourceTest.java      | 188 +++++
 .../rest/resources/ErrorResponseTest.java       |  98 +++
 .../rest/resources/LocationResourceTest.java    | 190 +++++
 .../rest/resources/PolicyResourceTest.java      | 143 ++++
 .../rest/resources/ScriptResourceTest.java      |  56 ++
 .../SensorResourceIntegrationTest.java          |  74 ++
 .../rest/resources/SensorResourceTest.java      | 267 +++++++
 .../rest/resources/ServerResourceTest.java      | 168 +++++
 .../rest/resources/ServerShutdownTest.java      | 164 +++++
 .../rest/resources/UsageResourceTest.java       | 444 ++++++++++++
 .../rest/resources/VersionResourceTest.java     |  46 ++
 .../rest/security/PasswordHasherTest.java       |  37 +
 .../test/config/render/TestRendererHints.java   |  36 +
 .../brooklynnode/DeployBlueprintTest.java       |  97 +++
 .../rest/testing/BrooklynRestApiTest.java       | 223 ++++++
 .../rest/testing/BrooklynRestResourceTest.java  | 212 ++++++
 .../rest/testing/mocks/CapitalizePolicy.java    |  33 +
 .../rest/testing/mocks/EverythingGroup.java     |  27 +
 .../rest/testing/mocks/EverythingGroupImpl.java |  32 +
 .../rest/testing/mocks/NameMatcherGroup.java    |  30 +
 .../testing/mocks/NameMatcherGroupImpl.java     |  33 +
 .../rest/testing/mocks/RestMockApp.java         |  24 +
 .../rest/testing/mocks/RestMockAppBuilder.java  |  39 ++
 .../testing/mocks/RestMockSimpleEntity.java     | 103 +++
 .../testing/mocks/RestMockSimplePolicy.java     |  64 ++
 .../util/BrooklynRestResourceUtilsTest.java     | 213 ++++++
 .../rest/util/EntityLocationUtilsTest.java      |  72 ++
 .../rest/util/HaHotStateCheckClassResource.java |  38 +
 .../rest/util/HaHotStateCheckResource.java      |  44 ++
 .../brooklyn/rest/util/TestShutdownHandler.java |  37 +
 .../json/BrooklynJacksonSerializerTest.java     | 264 +++++++
 .../META-INF/cxf/org.apache.cxf.Logger          |  18 +
 .../resources/brooklyn/scanning.catalog.bom     |  19 +
 rest/rest-server/pom.xml                        |  76 +-
 .../apache/brooklyn/rest/BrooklynRestApi.java   |  89 ---
 .../apache/brooklyn/rest/BrooklynWebConfig.java | 158 -----
 .../org/apache/brooklyn/rest/RestApiSetup.java  |  68 ++
 .../BrooklynPropertiesSecurityFilter.java       |  19 +-
 .../rest/filter/HaHotCheckResourceFilter.java   | 150 ----
 .../rest/filter/HaHotStateRequired.java         |  36 -
 .../rest/filter/HaMasterCheckFilter.java        |  18 +-
 .../brooklyn/rest/filter/LoggingFilter.java     |   2 +
 .../brooklyn/rest/filter/NoCacheFilter.java     |  40 --
 .../rest/filter/RequestTaggingFilter.java       |   1 +
 .../brooklyn/rest/filter/SwaggerFilter.java     |  76 --
 .../resources/AbstractBrooklynRestResource.java | 152 ----
 .../brooklyn/rest/resources/AccessResource.java |  46 --
 .../rest/resources/ActivityResource.java        |  99 ---
 .../brooklyn/rest/resources/ApidocResource.java |  31 -
 .../rest/resources/ApplicationResource.java     | 449 ------------
 .../rest/resources/CatalogResource.java         | 521 --------------
 .../rest/resources/EffectorResource.java        | 114 ---
 .../rest/resources/EntityConfigResource.java    | 206 ------
 .../brooklyn/rest/resources/EntityResource.java | 223 ------
 .../rest/resources/LocationResource.java        | 184 -----
 .../rest/resources/PolicyConfigResource.java    | 108 ---
 .../brooklyn/rest/resources/PolicyResource.java | 131 ----
 .../brooklyn/rest/resources/ScriptResource.java | 102 ---
 .../brooklyn/rest/resources/SensorResource.java | 184 -----
 .../brooklyn/rest/resources/ServerResource.java | 495 -------------
 .../brooklyn/rest/resources/UsageResource.java  | 256 -------
 .../rest/resources/VersionResource.java         |  32 -
 .../brooklyn/rest/security/PasswordHasher.java  |  32 -
 .../provider/AbstractSecurityProvider.java      |  56 --
 .../provider/AnyoneSecurityProvider.java        |  40 --
 .../provider/BlackholeSecurityProvider.java     |  40 --
 ...nUserWithRandomPasswordSecurityProvider.java |  73 --
 .../provider/DelegatingSecurityProvider.java    | 166 -----
 .../provider/ExplicitUsersSecurityProvider.java | 118 ----
 .../security/provider/LdapSecurityProvider.java | 132 ----
 .../security/provider/SecurityProvider.java     |  35 -
 .../rest/transform/AccessTransformer.java       |  39 --
 .../rest/transform/ApplicationTransformer.java  | 116 ---
 .../transform/BrooklynFeatureTransformer.java   |  45 --
 .../rest/transform/CatalogTransformer.java      | 192 -----
 .../rest/transform/EffectorTransformer.java     |  85 ---
 .../rest/transform/EntityTransformer.java       | 165 -----
 .../transform/HighAvailabilityTransformer.java  |  50 --
 .../rest/transform/LocationTransformer.java     | 193 -----
 .../rest/transform/PolicyTransformer.java       |  83 ---
 .../rest/transform/SensorTransformer.java       |  84 ---
 .../rest/transform/TaskTransformer.java         | 146 ----
 .../rest/util/BrooklynRestResourceUtils.java    | 608 ----------------
 .../rest/util/DefaultExceptionMapper.java       | 104 ---
 .../brooklyn/rest/util/EntityLocationUtils.java |  85 ---
 .../brooklyn/rest/util/FormMapProvider.java     |  81 ---
 .../rest/util/ManagementContextProvider.java    |  33 -
 .../apache/brooklyn/rest/util/OsgiCompat.java   |  46 --
 .../brooklyn/rest/util/ShutdownHandler.java     |  23 -
 .../rest/util/ShutdownHandlerProvider.java      |  30 -
 .../brooklyn/rest/util/URLParamEncoder.java     |  27 -
 .../brooklyn/rest/util/WebResourceUtils.java    | 161 -----
 .../rest/util/json/BidiSerialization.java       | 173 -----
 .../util/json/BrooklynJacksonJsonProvider.java  | 165 -----
 .../json/ConfigurableSerializerProvider.java    |  89 ---
 .../ErrorAndToStringUnknownTypeSerializer.java  | 123 ----
 .../rest/util/json/MultimapSerializer.java      |  62 --
 ...StrictPreferringFieldsVisibilityChecker.java | 108 ---
 .../rest-server/src/main/webapp/WEB-INF/web.xml |  96 +--
 .../BrooklynPropertiesSecurityFilterTest.java   |   6 +-
 .../brooklyn/rest/BrooklynRestApiLauncher.java  |  56 +-
 .../rest/BrooklynRestApiLauncherTest.java       |   6 -
 .../BrooklynRestApiLauncherTestFixture.java     |  22 +-
 .../apache/brooklyn/rest/HaHotCheckTest.java    | 129 ----
 .../brooklyn/rest/HaMasterCheckFilterTest.java  |   2 +-
 .../brooklyn/rest/domain/ApplicationTest.java   |  87 ---
 .../brooklyn/rest/domain/SensorSummaryTest.java | 101 ---
 .../rest/resources/AccessResourceTest.java      |  68 --
 .../rest/resources/ApidocResourceTest.java      | 177 -----
 .../ApplicationResourceIntegrationTest.java     | 133 ----
 .../rest/resources/ApplicationResourceTest.java | 701 -------------------
 .../rest/resources/CatalogResetTest.java        | 113 ---
 .../rest/resources/CatalogResourceTest.java     | 512 --------------
 .../rest/resources/DelegatingPrintStream.java   | 183 -----
 .../rest/resources/DescendantsTest.java         | 130 ----
 .../resources/EntityConfigResourceTest.java     | 172 -----
 .../rest/resources/EntityResourceTest.java      | 189 -----
 .../rest/resources/ErrorResponseTest.java       |  98 ---
 .../rest/resources/LocationResourceTest.java    | 189 -----
 .../rest/resources/PolicyResourceTest.java      | 145 ----
 .../rest/resources/ScriptResourceTest.java      |  54 --
 .../SensorResourceIntegrationTest.java          |  82 ---
 .../rest/resources/SensorResourceTest.java      | 271 -------
 .../ServerResourceIntegrationTest.java          |  12 +-
 .../rest/resources/ServerResourceTest.java      | 168 -----
 .../rest/resources/ServerShutdownTest.java      | 185 -----
 .../rest/resources/UsageResourceTest.java       | 443 ------------
 .../rest/resources/VersionResourceTest.java     |  52 --
 .../rest/security/PasswordHasherTest.java       |  37 -
 .../brooklynnode/DeployBlueprintTest.java       |  89 ---
 .../rest/testing/BrooklynRestApiTest.java       | 204 ------
 .../rest/testing/BrooklynRestResourceTest.java  | 154 ----
 .../rest/testing/mocks/CapitalizePolicy.java    |  33 -
 .../rest/testing/mocks/EverythingGroup.java     |  27 -
 .../rest/testing/mocks/EverythingGroupImpl.java |  32 -
 .../rest/testing/mocks/NameMatcherGroup.java    |  30 -
 .../testing/mocks/NameMatcherGroupImpl.java     |  33 -
 .../rest/testing/mocks/RestMockApp.java         |  24 -
 .../rest/testing/mocks/RestMockAppBuilder.java  |  39 --
 .../testing/mocks/RestMockSimpleEntity.java     | 103 ---
 .../testing/mocks/RestMockSimplePolicy.java     |  64 --
 .../util/BrooklynRestResourceUtilsTest.java     | 213 ------
 .../rest/util/EntityLocationUtilsTest.java      |  72 --
 .../rest/util/HaHotStateCheckClassResource.java |  38 -
 .../rest/util/HaHotStateCheckResource.java      |  44 --
 .../util/NullHttpServletRequestProvider.java    |  46 --
 .../rest/util/NullServletConfigProvider.java    |  51 --
 ...rooklynJacksonSerializerIntegrationTest.java | 173 +++++
 .../json/BrooklynJacksonSerializerTest.java     | 399 -----------
 .../resources/brooklyn/scanning.catalog.bom     |  19 -
 utils/rest-swagger/pom.xml                      |  28 +-
 .../rest/apidoc/ApiListingResource.java         | 242 +------
 .../rest/apidoc/RestApiResourceScanner.java     |  23 +-
 281 files changed, 15076 insertions(+), 14665 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/camp/camp-server/pom.xml
----------------------------------------------------------------------
diff --git a/camp/camp-server/pom.xml b/camp/camp-server/pom.xml
index 534a6cb..642474b 100644
--- a/camp/camp-server/pom.xml
+++ b/camp/camp-server/pom.xml
@@ -73,23 +73,6 @@
         </dependency>
         
         <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-servlet</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey.contribs</groupId>
-            <artifactId>jersey-multipart</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-core</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>javax.validation</groupId>
             <artifactId>validation-api</artifactId>
         </dependency>
@@ -136,6 +119,10 @@
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+        </dependency>
         
         <!-- TODO have a camp.log / logging module -->
         <dependency>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/CampRestApp.java
----------------------------------------------------------------------
diff --git 
a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/CampRestApp.java
 
b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/CampRestApp.java
new file mode 100644
index 0000000..7a12936
--- /dev/null
+++ 
b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/CampRestApp.java
@@ -0,0 +1,36 @@
+/*
+ * 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.brooklyn.camp.server;
+
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+import org.apache.brooklyn.camp.server.rest.CampRestResources;
+
+import com.google.common.collect.Sets;
+
+public class CampRestApp extends Application {
+
+    @Override
+    public Set<Object> getSingletons() {
+        return Sets.newHashSet(CampRestResources.getAllResources());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/RestApiSetup.java
----------------------------------------------------------------------
diff --git 
a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/RestApiSetup.java
 
b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/RestApiSetup.java
new file mode 100644
index 0000000..127b5bd
--- /dev/null
+++ 
b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/RestApiSetup.java
@@ -0,0 +1,43 @@
+/*
+ * 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.brooklyn.camp.server;
+
+import org.apache.brooklyn.rest.apidoc.RestApiResourceScanner;
+import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+
+import io.swagger.config.ScannerFactory;
+
+public class RestApiSetup {
+
+    public static ContextHandler installRestServlet(ServletContextHandler 
context) {
+        ScannerFactory.setScanner(new RestApiResourceScanner());
+
+        CampRestApp app = new CampRestApp();
+
+        CXFNonSpringJaxrsServlet servlet = new CXFNonSpringJaxrsServlet(app);
+        final ServletHolder servletHolder = new ServletHolder(servlet);
+
+        context.addServlet(servletHolder, "/*");
+        return context;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
----------------------------------------------------------------------
diff --git 
a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
 
b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
index 0ad6bc2..1274494 100644
--- 
a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
+++ 
b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/CampServer.java
@@ -20,18 +20,17 @@ package org.apache.brooklyn.camp.server.rest;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.EnumSet;
-
-import javax.servlet.DispatcherType;
 
 import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.server.RestApiSetup;
 import org.apache.brooklyn.camp.server.rest.resource.PlatformRestResource;
 import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.net.Networking;
+import org.eclipse.jetty.server.NetworkConnector;
 import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.eclipse.jetty.webapp.WebAppContext;
@@ -40,11 +39,6 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Charsets;
 import com.google.common.io.Files;
-import com.sun.jersey.api.core.DefaultResourceConfig;
-import com.sun.jersey.api.core.ResourceConfig;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
-import org.eclipse.jetty.server.NetworkConnector;
-import org.eclipse.jetty.server.ServerConnector;
 
 public class CampServer {
 
@@ -127,25 +121,7 @@ public class CampServer {
     public static class CampServerUtils {
 
         public static void installAsServletFilter(ServletContextHandler 
context) {
-            // TODO security
-            //        installBrooklynPropertiesSecurityFilter(context);
-
-            // now set up the REST servlet resources
-            ResourceConfig config = new DefaultResourceConfig();
-            // load all our REST API modules, JSON, and Swagger
-            for (Object r: CampRestResources.getAllResources())
-                config.getSingletons().add(r);
-
-            // configure to match empty path, or any thing which looks like a 
file path with /assets/ and extension html, css, js, or png
-            // and treat that as static content
-            
config.getProperties().put(ServletContainer.PROPERTY_WEB_PAGE_CONTENT_REGEX, 
"(/?|[^?]*/assets/[^?]+\\.[A-Za-z0-9_]+)");
-
-            // and anything which is not matched as a servlet also falls 
through (but more expensive than a regex check?)
-            
config.getFeatures().put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, true);
-
-            // finally create this as a _filter_ which falls through to a web 
app or something (optionally)
-            FilterHolder filterHolder = new FilterHolder(new 
ServletContainer(config));
-            context.addFilter(filterHolder, "/*", 
EnumSet.allOf(DispatcherType.class));
+            RestApiSetup.installRestServlet(context);
         }
 
         public static Server startServer(ContextHandler context, String 
summary) {

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/karaf/apache-brooklyn/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/pom.xml b/karaf/apache-brooklyn/pom.xml
index 89ab390..6ccd8f9 100755
--- a/karaf/apache-brooklyn/pom.xml
+++ b/karaf/apache-brooklyn/pom.xml
@@ -115,8 +115,8 @@
             <bootFeature>system</bootFeature>
             <bootFeature>wrap</bootFeature>
             <!-- brooklyn features -->
-            <bootFeature>brooklyn-rest-server</bootFeature>
             <bootFeature>brooklyn-jsgui</bootFeature>
+            <bootFeature>brooklyn-rest-resources</bootFeature>
           </bootFeatures>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/karaf/apache-brooklyn/src/main/resources/etc/org.apache.cxf.osgi.cfg
----------------------------------------------------------------------
diff --git 
a/karaf/apache-brooklyn/src/main/resources/etc/org.apache.cxf.osgi.cfg 
b/karaf/apache-brooklyn/src/main/resources/etc/org.apache.cxf.osgi.cfg
new file mode 100644
index 0000000..e82b1d0
--- /dev/null
+++ b/karaf/apache-brooklyn/src/main/resources/etc/org.apache.cxf.osgi.cfg
@@ -0,0 +1,20 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+
+org.apache.cxf.servlet.context = /v1

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/karaf/features/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/feature/feature.xml 
b/karaf/features/src/main/feature/feature.xml
index 0b22046..c590469 100644
--- a/karaf/features/src/main/feature/feature.xml
+++ b/karaf/features/src/main/feature/feature.xml
@@ -22,10 +22,7 @@
     
<repository>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</repository>
     
<repository>mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features</repository>
 
-    <!-- all these are about jax-rs, and will need some love later on -->
-    <!--<bundle 
dependency="true">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr339-api-2.0/2.4.0</bundle>-->
-    <!--<bundle 
dependency="true">mvn:javax.ws.rs/jsr311-api/${jsr311-api.version}</bundle>-->
-    <!--<bundle 
dependency="true">mvn:javax.ws.rs/javax.ws.rs-api/${javax.ws.rs-api}</bundle>-->
+    
<repository>mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features</repository>
 
     <!-- temporary feature until we migrate to swagger-1.5.4, which is 
properly bundled -->
     <feature name="swagger-crippled" version="${swagger.version}" 
description="Swagger Annotations+Core+JAXRS+Models">
@@ -79,7 +76,11 @@
         <bundle 
dependency="true">mvn:org.apache.commons/commons-lang3/${commons-lang3.version}</bundle>
 
         <bundle 
dependency="true">mvn:javax.servlet/javax.servlet-api/${javax-servlet.version}</bundle>
-        <bundle 
dependency="true">mvn:javax.ws.rs/jsr311-api/${jsr311-api.version}</bundle>
+        <bundle 
dependency="true">mvn:javax.ws.rs/javax.ws.rs-api/${jax-rs-api.version}</bundle>
+
+        <!-- TODO: version 1.1.0.Final has OSGi manifest; check if upgrade 
doesn't get rid of wrap -->
+        <bundle 
dependency="true">wrap:mvn:javax.validation/validation-api/${validation-api.version}</bundle>
+        <bundle 
dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections/${reflections.bundle.version}</bundle>
     </feature>
 
     <feature name="brooklyn-rest-api" version="${project.version}" 
description="Brooklyn REST API">
@@ -102,7 +103,6 @@
         <bundle 
dependency="true">mvn:com.fasterxml.jackson.core/jackson-annotations/${fasterxml.jackson.version}</bundle>
         <bundle 
dependency="true">mvn:com.fasterxml.jackson.core/jackson-databind/${fasterxml.jackson.version}</bundle>
 
-        <!--<bundle 
dependency="true">mvn:javax.ws.rs/jsr311-api/${jsr311-api.version}</bundle>-->
         <bundle 
dependency="true">mvn:javax.servlet/javax.servlet-api/${javax-servlet.version}</bundle>
     </feature>
 
@@ -139,7 +139,7 @@
         <bundle 
dependency="true">wrap:mvn:com.maxmind.geoip2/geoip2/${maxmind.version}</bundle>
 <!-- from geoip2 -->
         <bundle dependency="true">wrap:mvn:xpp3/xpp3_min/1.1.4c</bundle> <!-- 
from com.thoughtworks.xstream/xstream -->
 
-        
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections/${reflections.bundle.version}</bundle>
+        <bundle 
dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections/${reflections.bundle.version}</bundle>
     </feature>
 
     <feature name="brooklyn-camp-brooklyn" version="${project.version}" 
description="Brooklyn CAMP REST API">
@@ -168,20 +168,20 @@
         <feature>jetty</feature> <!-- TODO: pax-jetty??? -->
     </feature>
 
-    <feature name="brooklyn-rest-server" version="${project.version}" 
description="Brooklyn REST Server">
-        
<bundle>mvn:org.apache.brooklyn/brooklyn-rest-server/${project.version}</bundle>
+    <feature name="brooklyn-rest-resources" version="${project.version}" 
description="Brooklyn REST Resources">
+        
<bundle>mvn:org.apache.brooklyn/brooklyn-rest-resources/${project.version}</bundle>
+        <feature>brooklyn-core</feature>
         <feature>brooklyn-rest-api</feature>
         <feature>brooklyn-camp-brooklyn</feature>
         <feature>brooklyn-camp-base</feature>
 
-        <feature>war</feature>
-
-        <!--<feature>jersey</feature>-->
-        <bundle 
dependency="true">mvn:com.sun.jersey/jersey-server/${jersey.version}</bundle>
-        <bundle 
dependency="true">mvn:com.sun.jersey/jersey-core/${jersey.version}</bundle>
-        <bundle 
dependency="true">mvn:com.sun.jersey/jersey-servlet/${jersey.version}</bundle>
+        <feature>cxf-jaxrs</feature>
 
         <bundle 
dependency="true">mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${fasterxml.jackson.version}</bundle>
+
+        <!-- should be deps of jax-rs-2.0 rest-api project -->
+        <bundle 
dependency="true">mvn:javax.servlet/javax.servlet-api/${javax-servlet.version}</bundle>
+        <bundle 
dependency="true">mvn:javax.ws.rs/javax.ws.rs-api/${jax-rs-api.version}</bundle>
     </feature>
 
     <feature name="brooklyn-jsgui" version="${project.version}" 
description="Brooklyn REST JavaScript Web GUI">

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/karaf/itest/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/itest/pom.xml b/karaf/itest/pom.xml
index 0b016a3..a09503b 100644
--- a/karaf/itest/pom.xml
+++ b/karaf/itest/pom.xml
@@ -167,6 +167,19 @@
             <version>${geronimo-jta_1.1_spec.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>brooklyn-rest-resources</artifactId>
+            <version>${project.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>brooklyn-utils-common</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java
----------------------------------------------------------------------
diff --git a/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java 
b/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java
index 49f9ea6..dc7a58b 100644
--- a/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java
+++ b/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java
@@ -82,7 +82,7 @@ public class AssemblyTest {
         };
     }
 
-    private static MavenArtifactUrlReference brooklynKarafDist() {
+    public static MavenArtifactUrlReference brooklynKarafDist() {
         return maven()
                 .groupId("org.apache.brooklyn")
                 .artifactId("apache-brooklyn")
@@ -90,7 +90,7 @@ public class AssemblyTest {
                 .version(asInProject());
     }
 
-    private static MavenUrlReference karafStandardFeaturesRepository() {
+    public static MavenUrlReference karafStandardFeaturesRepository() {
         return maven()
                 .groupId("org.apache.karaf.features")
                 .artifactId("standard")

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/launcher/pom.xml
----------------------------------------------------------------------
diff --git a/launcher/pom.xml b/launcher/pom.xml
index 8d847cd..a10af41 100644
--- a/launcher/pom.xml
+++ b/launcher/pom.xml
@@ -93,14 +93,6 @@
             <artifactId>concurrentlinkedhashmap-lru</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-servlet</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-server</artifactId>
         </dependency>
@@ -140,6 +132,10 @@
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.brooklyn</groupId>
@@ -190,6 +186,13 @@
         </dependency>
         <dependency>
             <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-rest-resources</artifactId>
+            <version>${project.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
             <artifactId>brooklyn-rest-server</artifactId>
             <version>${project.version}</version>
             <classifier>tests</classifier>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/launcher/src/main/java/org/apache/brooklyn/launcher/Activator.java
----------------------------------------------------------------------
diff --git a/launcher/src/main/java/org/apache/brooklyn/launcher/Activator.java 
b/launcher/src/main/java/org/apache/brooklyn/launcher/Activator.java
index 6215cc7..935b6bf 100644
--- a/launcher/src/main/java/org/apache/brooklyn/launcher/Activator.java
+++ b/launcher/src/main/java/org/apache/brooklyn/launcher/Activator.java
@@ -27,12 +27,14 @@ public class Activator implements BundleActivator {
 
     public static final Logger log = LoggerFactory.getLogger(Activator.class);
 
+    @Override
     public void start(BundleContext context) throws Exception {
         //does nothing on startup, just makes resources available
         //TODO maybe it wants to register a service that others could use?
         log.info("Starting brooklyn-launcher OSGi bundle");
     }
 
+    @Override
     public void stop(BundleContext context) throws Exception {
         log.info("Stopping brooklyn-launcher OSGi bundle");
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynWebServer.java
----------------------------------------------------------------------
diff --git 
a/launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynWebServer.java 
b/launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynWebServer.java
index 0365c14..f2760f2 100644
--- a/launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynWebServer.java
+++ b/launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynWebServer.java
@@ -29,34 +29,11 @@ import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.EnumSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
 import javax.annotation.Nullable;
-import javax.servlet.DispatcherType;
-
-import org.apache.brooklyn.rest.filter.SwaggerFilter;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Splitter;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Maps;
-import com.sun.jersey.api.container.filter.GZIPContentEncodingFilter;
-import com.sun.jersey.api.core.DefaultResourceConfig;
-import com.sun.jersey.api.core.ResourceConfig;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
 
 import org.apache.brooklyn.api.location.PortRange;
 import org.apache.brooklyn.api.mgmt.ManagementContext;
@@ -69,8 +46,8 @@ import org.apache.brooklyn.core.server.BrooklynServerPaths;
 import org.apache.brooklyn.core.server.BrooklynServiceAttributes;
 import org.apache.brooklyn.launcher.config.CustomResourceLocator;
 import 
org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
-import org.apache.brooklyn.rest.BrooklynRestApi;
 import org.apache.brooklyn.rest.BrooklynWebConfig;
+import org.apache.brooklyn.rest.RestApiSetup;
 import org.apache.brooklyn.rest.filter.BrooklynPropertiesSecurityFilter;
 import org.apache.brooklyn.rest.filter.HaHotCheckResourceFilter;
 import org.apache.brooklyn.rest.filter.HaMasterCheckFilter;
@@ -97,11 +74,25 @@ import org.apache.brooklyn.util.stream.Streams;
 import org.apache.brooklyn.util.text.Identifiers;
 import org.apache.brooklyn.util.text.Strings;
 import org.apache.brooklyn.util.web.ContextHandlerCollectionHotSwappable;
+import org.apache.cxf.transport.common.gzip.GZIPInInterceptor;
+import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
 import org.eclipse.jetty.http.HttpVersion;
+import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.HttpConfiguration;
 import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.server.SslConnectionFactory;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Splitter;
+import com.google.common.base.Throwables;
+import com.google.common.collect.Maps;
 
 /**
  * Starts the web-app running, connected to the given management context
@@ -113,8 +104,8 @@ public class BrooklynWebServer {
     static {
         // support loading the WAR in dev mode from an alternate location 
         CustomResourceLocator.registerAlternateLocator(new 
CustomResourceLocator.SearchingClassPathInDevMode(
-                BROOKLYN_WAR_URL, "/usage/launcher/target", 
-                
"/usage/jsgui/target/brooklyn-jsgui-"+BrooklynVersion.get()+".war"));
+                BROOKLYN_WAR_URL, "/brooklyn-server/launcher/target", 
+                
"/brooklyn-ui/target/brooklyn-jsgui-"+BrooklynVersion.get()+".war"));
     }
     
     static {
@@ -346,33 +337,6 @@ public class BrooklynWebServer {
         return this;
     }
 
-    public void installAsServletFilter(ServletContextHandler context) {
-        ResourceConfig config = new DefaultResourceConfig();
-        // load all our REST API modules, JSON, and Swagger
-        for (Object r: BrooklynRestApi.getAllResources())
-            config.getSingletons().add(r);
-
-        // Accept gzipped requests and responses, disable caching for dynamic 
content
-        
config.getProperties().put(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, 
GZIPContentEncodingFilter.class.getName());
-        
config.getProperties().put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS, 
ImmutableList.of(GZIPContentEncodingFilter.class, NoCacheFilter.class));
-        // Checks if appropriate request given HA status
-        
config.getProperties().put(ResourceConfig.PROPERTY_RESOURCE_FILTER_FACTORIES, 
HaHotCheckResourceFilter.class.getName());
-        // configure to match empty path, or any thing which looks like a file 
path with /assets/ and extension html, css, js, or png
-        // and treat that as static content
-        
config.getProperties().put(ServletContainer.PROPERTY_WEB_PAGE_CONTENT_REGEX, 
"(/?|[^?]*/assets/[^?]+\\.[A-Za-z0-9_]+)");
-        // and anything which is not matched as a servlet also falls through 
(but more expensive than a regex check?)
-        
config.getFeatures().put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, true);
-        // finally create this as a _filter_ which falls through to a web app 
or something (optionally)
-        FilterHolder filterHolder = new FilterHolder(new 
ServletContainer(config));
-
-        context.addFilter(filterHolder, "/*", 
EnumSet.allOf(DispatcherType.class));
-
-        ManagementContext mgmt = (ManagementContext) 
context.getAttribute(BrooklynServiceAttributes.BROOKLYN_MANAGEMENT_CONTEXT);
-        config.getSingletons().add(new ManagementContextProvider(mgmt));
-
-        config.getSingletons().add(new 
ShutdownHandlerProvider(shutdownHandler));
-    }
-
     ContextHandlerCollectionHotSwappable handlers = new 
ContextHandlerCollectionHotSwappable();
     
     /**
@@ -439,18 +403,11 @@ public class BrooklynWebServer {
             WebAppContext webapp = deploy(contextProvider);
             webapp.setTempDirectory(Os.mkdirs(new File(webappTempDir, 
newTimestampedDirName("war", 8))));
         }
+
         rootContext = deploy(rootWar);
+        deployRestApi(rootContext);
         rootContext.setTempDirectory(Os.mkdirs(new File(webappTempDir, 
"war-root")));
 
-        rootContext.addFilter(RequestTaggingFilter.class, "/*", 
EnumSet.allOf(DispatcherType.class));
-        if (securityFilterClazz != null) {
-            rootContext.addFilter(securityFilterClazz, "/*", 
EnumSet.allOf(DispatcherType.class));
-        }
-        rootContext.addFilter(LoggingFilter.class, "/*", 
EnumSet.allOf(DispatcherType.class));
-        rootContext.addFilter(HaMasterCheckFilter.class, "/*", 
EnumSet.allOf(DispatcherType.class));
-        rootContext.addFilter(SwaggerFilter.class, "/*", 
EnumSet.allOf(DispatcherType.class));
-        installAsServletFilter(rootContext);
-
         server.setHandler(handlers);
         server.start();
         //reinit required because some webapps (eg grails) might wipe our 
language extension bindings
@@ -463,6 +420,24 @@ public class BrooklynWebServer {
         log.info("Started Brooklyn console at "+getRootUrl()+", running " + 
rootWar + (allWars!=null && !allWars.isEmpty() ? " and " + wars.values() : ""));
     }
 
+    private WebAppContext deployRestApi(WebAppContext context) {
+        RestApiSetup.installRestServlet(context,
+                new ManagementContextProvider(managementContext),
+                new ShutdownHandlerProvider(shutdownHandler),
+                new NoCacheFilter(),
+                new HaHotCheckResourceFilter(),
+                new GZIPInInterceptor(),
+                new GZIPOutInterceptor());
+        RestApiSetup.installServletFilters(context,
+                RequestTaggingFilter.class,
+                LoggingFilter.class,
+                HaMasterCheckFilter.class);
+        if (securityFilterClazz != null) {
+            RestApiSetup.installServletFilters(context, securityFilterClazz);
+        }
+        return context;
+    }
+
     private SslContextFactory createContextFactory() throws KeyStoreException {
         SslContextFactory sslContextFactory = new SslContextFactory();
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/launcher/src/main/java/org/apache/brooklyn/launcher/camp/BrooklynCampPlatformLauncher.java
----------------------------------------------------------------------
diff --git 
a/launcher/src/main/java/org/apache/brooklyn/launcher/camp/BrooklynCampPlatformLauncher.java
 
b/launcher/src/main/java/org/apache/brooklyn/launcher/camp/BrooklynCampPlatformLauncher.java
index ff9ab16..9c50562 100644
--- 
a/launcher/src/main/java/org/apache/brooklyn/launcher/camp/BrooklynCampPlatformLauncher.java
+++ 
b/launcher/src/main/java/org/apache/brooklyn/launcher/camp/BrooklynCampPlatformLauncher.java
@@ -63,6 +63,7 @@ public class BrooklynCampPlatformLauncher extends 
BrooklynCampPlatformLauncherAb
         new BrooklynCampPlatformLauncher().launch();
     }
 
+    @Override
     public void stopServers() throws Exception {
         brooklynLauncher.getServerDetails().getWebServer().stop();
         campServer.stop();

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
----------------------------------------------------------------------
diff --git 
a/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
 
b/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
index 02387c8..ced98db 100644
--- 
a/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
+++ 
b/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncher.java
@@ -64,7 +64,7 @@ public class BrooklynJavascriptGuiLauncher {
     
     /** due to the relative path search in {@link BrooklynRestApiLauncher} we 
can just call that method */ 
     public static Server startJavascriptAndRest() throws Exception {
-        return BrooklynRestApiLauncher.startRestResourcesViaFilter();
+        return BrooklynRestApiLauncher.startRestResourcesViaServlet();
     }
 
     /** not much fun without a REST server. 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
----------------------------------------------------------------------
diff --git 
a/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
 
b/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
index e03652d..2896239 100644
--- 
a/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
+++ 
b/launcher/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
@@ -20,8 +20,9 @@ package org.apache.brooklyn.rest.jsgui;
 
 import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.core.entity.Entities;
+import org.apache.brooklyn.core.server.BrooklynServiceAttributes;
 import org.apache.brooklyn.rest.BrooklynRestApiLauncherTestFixture;
-import org.apache.brooklyn.rest.util.OsgiCompat;
+import org.apache.brooklyn.util.core.osgi.Compat;
 import org.apache.brooklyn.util.http.HttpAsserts;
 import org.eclipse.jetty.server.NetworkConnector;
 import org.eclipse.jetty.server.Server;
@@ -75,7 +76,20 @@ public class BrooklynJavascriptGuiLauncherTest {
     }
 
     private ManagementContext 
getManagementContextFromJettyServerAttributes(Server server) {
-        return OsgiCompat.getManagementContext((ContextHandler) 
server.getHandler());
+        return getManagementContext((ContextHandler) server.getHandler());
+    }
+
+    /**
+     * Compatibility methods between karaf launcher and monolithic launcher.
+     *
+     * @todo Remove after transition to karaf launcher.
+     */
+    private static ManagementContext getManagementContext(ContextHandler 
jettyServerHandler) {
+        ManagementContext managementContext = 
Compat.getInstance().getManagementContext();
+        if (managementContext == null && jettyServerHandler != null) {
+            managementContext = (ManagementContext) 
jettyServerHandler.getAttribute(BrooklynServiceAttributes.BROOKLYN_MANAGEMENT_CONTEXT);
+        }
+        return managementContext;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/locations/jclouds/pom.xml
----------------------------------------------------------------------
diff --git a/locations/jclouds/pom.xml b/locations/jclouds/pom.xml
index 3338893..5db6ce7 100644
--- a/locations/jclouds/pom.xml
+++ b/locations/jclouds/pom.xml
@@ -98,6 +98,18 @@
         </dependency>
 
         <dependency>
+            <groupId>${jclouds.groupId}</groupId>
+            <artifactId>jclouds-core</artifactId>
+            <version>${jclouds.version}</version>
+            <exclusions>
+                <exclusion>
+                    <!-- Conflicts with javax.ws.rs-api -->
+                    <groupId>javax.ws.rs</groupId>
+                    <artifactId>jsr311-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
             <groupId>${jclouds.groupId}.driver</groupId>
             <artifactId>jclouds-slf4j</artifactId>
             <version>${jclouds.version}</version>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 2b1f4a5..d87baae 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -127,26 +127,14 @@
                 <version>${slf4j.version}</version>
             </dependency>
             <dependency>
-                <groupId>com.sun.jersey</groupId>
-                <artifactId>jersey-server</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>com.sun.jersey.contribs</groupId>
-                <artifactId>jersey-multipart</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>com.sun.jersey.jersey-test-framework</groupId>
-                <artifactId>jersey-test-framework-inmemory</artifactId>
-                <version>${jersey.version}</version>
-                <scope>test</scope>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-http</artifactId>
+                <version>${jetty.version}</version>
             </dependency>
             <dependency>
-                <groupId>com.sun.jersey.jersey-test-framework</groupId>
-                <artifactId>jersey-test-framework-grizzly2</artifactId>
-                <version>${jersey.version}</version>
-                <scope>test</scope>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-io</artifactId>
+                <version>${jetty.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.commons</groupId>
@@ -169,6 +157,26 @@
                 <version>${jetty.version}</version>
             </dependency>
             <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-security</artifactId>
+                <version>${jetty.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-webapp</artifactId>
+                <version>${jetty.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-io</artifactId>
+                <version>${jetty.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-http</artifactId>
+                <version>${jetty.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>org.eclipse.jetty.toolchain</groupId>
                 <artifactId>jetty-schemas</artifactId>
                 <version>${jetty-schemas.version}</version>
@@ -230,16 +238,6 @@
                 <version>${javax-servlet.version}</version>
             </dependency>
             <dependency>
-                <groupId>org.eclipse.jetty</groupId>
-                <artifactId>jetty-security</artifactId>
-                <version>${jetty.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>com.sun.jersey</groupId>
-                <artifactId>jersey-core</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-            <dependency>
                 <groupId>com.beust</groupId>
                 <artifactId>jcommander</artifactId>
                 <version>${jcommander.version}</version>
@@ -341,31 +339,11 @@
                 <version>${reflections.version}</version>
             </dependency>
             <dependency>
-                <groupId>com.sun.jersey</groupId>
-                <artifactId>jersey-client</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.eclipse.jetty</groupId>
-                <artifactId>jetty-webapp</artifactId>
-                <version>${jetty.version}</version>
-            </dependency>
-            <dependency>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>org.apache.felix.framework</artifactId>
                 <version>${felix.framework.version}</version>
             </dependency>
             <dependency>
-                <groupId>com.sun.jersey</groupId>
-                <artifactId>jersey-servlet</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>javax.ws.rs</groupId>
-                <artifactId>jsr311-api</artifactId>
-                <version>${jsr311-api.version}</version>
-            </dependency>
-            <dependency>
                 <groupId>org.glassfish.external</groupId>
                 <artifactId>opendmk_jmxremote_optional_jar</artifactId>
                 <version>${opendmk_jmxremote_optional_jar.version}</version>
@@ -376,26 +354,6 @@
                 <version>${slf4j.version}</version>
             </dependency>
             <dependency>
-                <groupId>com.sun.jersey</groupId>
-                <artifactId>jersey-json</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.jboss.resteasy</groupId>
-                <artifactId>resteasy-jaxrs</artifactId>
-                <version>${resteasy.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.jboss.resteasy</groupId>
-                <artifactId>resteasy-jackson2-provider</artifactId>
-                <version>${resteasy.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.jboss.resteasy</groupId>
-                <artifactId>jaxrs-api</artifactId>
-                <version>${resteasy.version}</version>
-            </dependency>
-            <dependency>
                 <groupId>javax.validation</groupId>
                 <artifactId>validation-api</artifactId>
                 <version>${validation-api.version}</version>
@@ -510,6 +468,94 @@
                 <artifactId>asm</artifactId>
                 <version>${minidev.asm.version}</version>
             </dependency>
+
+            <!-- JAX-RS dependencies-->
+            <!--  JAX-RS 1.1 API -->
+            <dependency>
+                <groupId>javax.ws.rs</groupId>
+                <artifactId>jsr311-api</artifactId>
+                <version>${jsr311-api.version}</version>
+            </dependency>
+            <!--  JAX-RS 2.0 API -->
+            <dependency>
+                <groupId>javax.ws.rs</groupId>
+                <artifactId>javax.ws.rs-api</artifactId>
+                <version>${jax-rs-api.version}</version>
+            </dependency>
+            <!--  JAX-RS 2.0 Apache CXF Implementation -->
+            <dependency>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+                <version>${cxf.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-rt-transports-local</artifactId>
+                <version>${cxf.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-rt-transports-http-jetty</artifactId>
+                <version>${cxf.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-rt-rs-client</artifactId>
+                <version>${cxf.version}</version>
+            </dependency>
+            <!--  JAX-RS 1.1 Jersey Implementation -->
+            <dependency>
+                <groupId>com.sun.jersey</groupId>
+                <artifactId>jersey-core</artifactId>
+                <version>${jersey.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.jersey</groupId>
+                <artifactId>jersey-client</artifactId>
+                <version>${jersey.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.jersey</groupId>
+                <artifactId>jersey-server</artifactId>
+                <version>${jersey.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.jersey</groupId>
+                <artifactId>jersey-servlet</artifactId>
+                <version>${jersey.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.jersey</groupId>
+                <artifactId>jersey-json</artifactId>
+                <version>${jersey.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.jersey.jersey-test-framework</groupId>
+                <artifactId>jersey-test-framework-inmemory</artifactId>
+                <version>${jersey.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.jersey.jersey-test-framework</groupId>
+                <artifactId>jersey-test-framework-grizzly2</artifactId>
+                <version>${jersey.version}</version>
+            </dependency>
+            <!--  JAX-RS 2.0 RESTEasy Implementation -->
+            <dependency>
+                <groupId>org.jboss.resteasy</groupId>
+                <artifactId>resteasy-jaxrs</artifactId>
+                <version>${resteasy.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jboss.resteasy</groupId>
+                <artifactId>resteasy-jackson2-provider</artifactId>
+                <version>${resteasy.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jboss.resteasy</groupId>
+                <artifactId>jaxrs-api</artifactId>
+                <version>${resteasy.version}</version>
+            </dependency>
+            <!-- / JAX-RS -->
         </dependencies>
     </dependencyManagement>
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5bfe68a..588198a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
     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/xsd/maven-4.0.0.xsd";>
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
 
     <modelVersion>4.0.0</modelVersion>
     <parent>
@@ -101,6 +101,7 @@
         <fasterxml.jackson.version>2.4.5</fasterxml.jackson.version>
         <resteasy.version>3.0.8.Final</resteasy.version>
         <jersey.version>1.19</jersey.version>
+        <cxf.version>3.1.4</cxf.version>
         <httpclient.version>4.4.1</httpclient.version>
         <commons-lang3.version>3.3.2</commons-lang3.version>
         <groovy.version>2.3.7</groovy.version> <!-- Version supported by 
https://github.com/groovy/groovy-eclipse/wiki/Groovy-Eclipse-2.9.1-Release-Notes
 -->
@@ -136,6 +137,7 @@
         <jopt.version>4.3</jopt.version>
         
<concurrentlinkedhashmap.version>1.0_jdk5</concurrentlinkedhashmap.version>
         <javax-servlet.version>3.1.0</javax-servlet.version>
+        <javax-servlet-jsp.version>2.0</javax-servlet-jsp.version>
         <jcommander.version>1.27</jcommander.version>
         <xml-apis.version>1.0.b2</xml-apis.version>
         <jsr250-api.version>1.0</jsr250-api.version>
@@ -146,6 +148,7 @@
         <commons-lang.version>2.4</commons-lang.version>
         <hamcrest.version>1.1</hamcrest.version>
         <jsr311-api.version>1.1.1</jsr311-api.version>
+        <jax-rs-api.version>2.0.1</jax-rs-api.version>
         <maxmind.version>0.8.1</maxmind.version>
         <jna.version>4.0.0</jna.version>
         <winrm4j.version>0.3.1</winrm4j.version>
@@ -205,10 +208,12 @@
         <module>logging/logback-xml</module>
         <module>rest/rest-api</module>
         <module>rest/rest-client</module>
+       <module>rest/rest-resources</module>
         <module>rest/rest-server</module>
         <module>test-framework</module>
         <module>test-support</module>
 
+
         <module>utils/common</module>
         <module>utils/groovy</module>
         <module>utils/jmx/jmxmp-ssl-agent</module>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/pom.xml
----------------------------------------------------------------------
diff --git a/rest/rest-api/pom.xml b/rest/rest-api/pom.xml
index fc61f97..9f50fee 100644
--- a/rest/rest-api/pom.xml
+++ b/rest/rest-api/pom.xml
@@ -50,10 +50,6 @@
             <version>${fasterxml.jackson.version}</version>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey.contribs</groupId>
-            <artifactId>jersey-multipart</artifactId>
-        </dependency>
-        <dependency>
             <groupId>javax.validation</groupId>
             <artifactId>validation-api</artifactId>
         </dependency>
@@ -74,8 +70,8 @@
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-core</artifactId>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
         </dependency>
 
         <dependency>
@@ -144,6 +140,19 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>
+                            javax.ws.rs;version="[1.1,2.0]",
+                            javax.ws.rs.core;version="[1.1,2.0]",
+                            *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
         </plugins>
         <pluginManagement>
                <plugins>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/AccessApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/AccessApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/AccessApi.java
index b2af640..b0371ca 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/AccessApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/AccessApi.java
@@ -35,7 +35,7 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
 @Beta
-@Path("/v1/access")
+@Path("/access")
 @Api("Access Control")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java
index de93c64..d131606 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java
@@ -31,7 +31,7 @@ import io.swagger.annotations.ApiResponses;
 import javax.ws.rs.*;
 import javax.ws.rs.core.MediaType;
 
-@Path("/v1/activities")
+@Path("/activities")
 @Api("Activities")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java
index cd8f22e..f1e167f 100644
--- 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java
+++ 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java
@@ -45,7 +45,7 @@ import io.swagger.annotations.ApiResponses;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
-@Path("/v1/applications")
+@Path("/applications")
 @Api("Applications")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java
index cf18b89..f561759 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java
@@ -18,7 +18,6 @@
  */
 package org.apache.brooklyn.rest.api;
 
-import java.io.InputStream;
 import java.util.List;
 
 import javax.validation.Valid;
@@ -39,29 +38,18 @@ import org.apache.brooklyn.rest.domain.CatalogItemSummary;
 import org.apache.brooklyn.rest.domain.CatalogLocationSummary;
 import org.apache.brooklyn.rest.domain.CatalogPolicySummary;
 
-import com.sun.jersey.core.header.FormDataContentDisposition;
-import com.sun.jersey.multipart.FormDataParam;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
-@Path("/v1/catalog")
+@Path("/catalog")
 @Api("Catalog")
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 public interface CatalogApi {
 
-    @POST
-    @ApiOperation(value = "Add a catalog item (e.g. new type of entity, policy 
or location) by uploading YAML descriptor from browser using 
multipart/form-data",
-        response = String.class)
-    @Consumes(MediaType.MULTIPART_FORM_DATA)
-    public Response createFromMultipart(
-        @ApiParam(name = "yaml", value = "multipart/form-data file input 
field")
-        @FormDataParam("yaml") InputStream uploadedInputStream,
-        @FormDataParam("yaml") FormDataContentDisposition fileDetail);
-
     @Consumes
     @POST
     @ApiOperation(value = "Add a catalog item (e.g. new type of entity, policy 
or location) by uploading YAML descriptor "
@@ -89,7 +77,7 @@ public interface CatalogApi {
     @ApiResponses(value = {
         @ApiResponse(code = 404, message = "Entity not found")
     })
-    public void deleteEntity(
+    public void deleteEntity_0_7_0(
         @ApiParam(name = "entityId", value = "The ID of the entity or template 
to delete", required = true)
         @PathParam("entityId") String entityId) throws Exception;
 
@@ -181,7 +169,7 @@ public interface CatalogApi {
     @ApiResponses(value = {
         @ApiResponse(code = 404, message = "Entity not found")
     })
-    public CatalogEntitySummary getEntity(
+    public CatalogEntitySummary getEntity_0_7_0(
         @ApiParam(name = "entityId", value = "The ID of the entity or template 
to retrieve", required = true)
         @PathParam("entityId") String entityId) throws Exception;
 
@@ -210,7 +198,7 @@ public interface CatalogApi {
     @ApiResponses(value = {
         @ApiResponse(code = 404, message = "Entity not found")
     })
-    public CatalogEntitySummary getApplication(
+    public CatalogEntitySummary getApplication_0_7_0(
         @ApiParam(name = "applicationId", value = "The ID of the application 
to retrieve", required = true)
         @PathParam("applicationId") String applicationId) throws Exception;
 
@@ -252,7 +240,7 @@ public interface CatalogApi {
     @ApiResponses(value = {
         @ApiResponse(code = 404, message = "Entity not found")
     })
-    public CatalogItemSummary getPolicy(
+    public CatalogItemSummary getPolicy_0_7_0(
         @ApiParam(name = "policyId", value = "The ID of the policy to 
retrieve", required = true)
         @PathParam("policyId") String policyId) throws Exception;
 
@@ -264,7 +252,7 @@ public interface CatalogApi {
     @ApiResponses(value = {
         @ApiResponse(code = 404, message = "Entity not found")
     })
-    public CatalogItemSummary getPolicy(
+    public CatalogPolicySummary getPolicy(
         @ApiParam(name = "policyId", value = "The ID of the policy to 
retrieve", required = true)
         @PathParam("policyId") String policyId,
         @ApiParam(name = "version", value = "The version identifier of the 
application to retrieve", required = true)
@@ -293,7 +281,7 @@ public interface CatalogApi {
     @ApiResponses(value = {
         @ApiResponse(code = 404, message = "Entity not found")
     })
-    public CatalogItemSummary getLocation(
+    public CatalogItemSummary getLocation_0_7_0(
         @ApiParam(name = "locationId", value = "The ID of the location to 
retrieve", required = true)
         @PathParam("locationId") String locationId) throws Exception;
 
@@ -320,7 +308,7 @@ public interface CatalogApi {
             @ApiResponse(code = 404, message = "Item not found")
         })
     @Produces("application/image")
-    public Response getIcon(
+    public Response getIcon_0_7_0(
         @ApiParam(name = "itemId", value = "ID of catalog item (application, 
entity, policy, location)")
         @PathParam("itemId") @DefaultValue("") String itemId);
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EffectorApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EffectorApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EffectorApi.java
index e6fae45..2865223 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EffectorApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EffectorApi.java
@@ -32,7 +32,7 @@ import javax.ws.rs.core.Response;
 import java.util.List;
 import java.util.Map;
 
-@Path("/v1/applications/{application}/entities/{entity}/effectors")
+@Path("/applications/{application}/entities/{entity}/effectors")
 @Api("Entity Effectors")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java
index d081526..e5683ed 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java
@@ -35,7 +35,7 @@ import javax.ws.rs.core.Response;
 import java.util.List;
 import java.util.Map;
 
-@Path("/v1/applications/{application}/entities")
+@Path("/applications/{application}/entities")
 @Api("Entities")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)
@@ -50,7 +50,7 @@ public interface EntityApi {
     })
     public List<EntitySummary> list(
             @ApiParam(value = "Application ID or name", required = true)
-            @PathParam("application") final String application) ;
+            @PathParam("application") final String application);
 
     @GET
     @Path("/{entity}")

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityConfigApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityConfigApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityConfigApi.java
index af68eb3..4a5bbde 100644
--- 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityConfigApi.java
+++ 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityConfigApi.java
@@ -39,7 +39,7 @@ import io.swagger.annotations.ApiResponses;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
-@Path("/v1/applications/{application}/entities/{entity}/config")
+@Path("/applications/{application}/entities/{entity}/config")
 @Api("Entity Config")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)
@@ -96,7 +96,7 @@ public interface EntityConfigApi {
     @ApiResponses(value = {
             @ApiResponse(code = 404, message = "Could not find application, 
entity or config key")
     })
-    @Produces(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN + ";qs=0.9")
     public String getPlain(
             @ApiParam(value = "Application ID or name", required = true)
             @PathParam("application") String application,

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/LocationApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/LocationApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/LocationApi.java
index 5eb25ac..ea632d5 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/LocationApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/LocationApi.java
@@ -42,7 +42,7 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
 @SuppressWarnings("deprecation")
-@Path("/v1/locations")
+@Path("/locations")
 @Api("Locations")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyApi.java
index 983af7d..a698f7d 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyApi.java
@@ -32,7 +32,7 @@ import javax.ws.rs.core.Response;
 import java.util.List;
 import java.util.Map;
 
-@Path("/v1/applications/{application}/entities/{entity}/policies")
+@Path("/applications/{application}/entities/{entity}/policies")
 @Api("Entity Policies")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java
index 223c6ac..6c26228 100644
--- 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java
+++ 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java
@@ -31,7 +31,7 @@ import javax.ws.rs.core.Response;
 import java.util.List;
 import java.util.Map;
 
-@Path("/v1/applications/{application}/entities/{entity}/policies/{policy}/config")
+@Path("/applications/{application}/entities/{entity}/policies/{policy}/config")
 @Api("Entity Policy Config")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ScriptApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ScriptApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ScriptApi.java
index ed90618..72af2c3 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ScriptApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ScriptApi.java
@@ -31,7 +31,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 
-@Path("/v1/script")
+@Path("/script")
 @Api("Scripting")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/SensorApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/SensorApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/SensorApi.java
index 73c37cc..7947a80 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/SensorApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/SensorApi.java
@@ -40,7 +40,7 @@ import io.swagger.annotations.ApiResponses;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
-@Path("/v1/applications/{application}/entities/{entity}/sensors")
+@Path("/applications/{application}/entities/{entity}/sensors")
 @Api("Entity Sensors")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)
@@ -76,6 +76,7 @@ public interface SensorApi {
     @ApiResponses(value = {
             @ApiResponse(code = 404, message = "Could not find application, 
entity or sensor")
     })
+    @Produces({MediaType.APPLICATION_JSON})
     public Object get(
             @ApiParam(value = "Application ID or name", required = true)
             @PathParam("application") final String application,
@@ -93,7 +94,7 @@ public interface SensorApi {
     @ApiResponses(value = {
             @ApiResponse(code = 404, message = "Could not find application, 
entity or sensor")
     })
-    @Produces(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN + ";qs=0.9")
     public String getPlain(
             @ApiParam(value = "Application ID or name", required = true)
             @PathParam("application") final String application,

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ServerApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ServerApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ServerApi.java
index bc38c1f..90a195a 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ServerApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ServerApi.java
@@ -44,7 +44,7 @@ import io.swagger.annotations.ApiResponses;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
-@Path("/v1/server")
+@Path("/server")
 @Api("Server")
 @Produces(MediaType.APPLICATION_JSON)
 @Beta

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/UsageApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/UsageApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/UsageApi.java
index b483cf0..61e4cbf 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/UsageApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/UsageApi.java
@@ -36,7 +36,7 @@ import io.swagger.annotations.ApiResponses;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
-@Path("/v1/usage")
+@Path("/usage")
 @Api("Usage")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6f624c78/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/VersionApi.java
----------------------------------------------------------------------
diff --git 
a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/VersionApi.java 
b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/VersionApi.java
index f1e4601..12dc76e 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/VersionApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/VersionApi.java
@@ -27,11 +27,11 @@ import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 
-@Path("/v1/version")
+@Path("/version")
 @Api("Version")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)
-/** @deprecated since 0.7.0; use /v1/server/version */
+/** @deprecated since 0.7.0; use /server/version */
 @Deprecated
 public interface VersionApi {
 

Reply via email to