You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/02/08 19:29:52 UTC

[20/32] ISIS-323: lots more refactoring of RO

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/HttpMethodTest_setUp.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/HttpMethodTest_setUp.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/HttpMethodTest_setUp.java
deleted file mode 100644
index a0467c4..0000000
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/HttpMethodTest_setUp.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *  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.isis.viewer.restfulobjects.applib;
-
-import java.io.UnsupportedEncodingException;
-
-import org.jmock.Expectations;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.unittestsupport.jmock.auto.Mock;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.restfulobjects.applib.ClientRequestConfigurer;
-import org.apache.isis.viewer.restfulobjects.applib.HttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
-public class HttpMethodTest_setUp {
-
-    @Rule
-    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
-    @Mock
-    private ClientRequestConfigurer requestConfigurer;
-
-    private JsonRepresentation repr;
-
-    @Before
-    public void setUp() throws Exception {
-        repr = JsonRepresentation.newMap();
-        repr.mapPut("aString", "bar");
-        repr.mapPut("anInt", 3);
-        repr.mapPut("aLong", 31231231L);
-        repr.mapPut("aBoolean", true);
-        repr.mapPut("aStringRequiringEncoding", "http://localhost:8080/somewhere");
-    }
-
-    @Test
-    public void get() throws Exception {
-        setsUpQueryString(HttpMethod.GET);
-    }
-
-    @Test
-    public void delete() throws Exception {
-        setsUpQueryString(HttpMethod.DELETE);
-    }
-
-    @Test
-    public void post() throws Exception {
-        setsUpBody(HttpMethod.POST);
-    }
-
-    @Test
-    public void put() throws Exception {
-        setsUpBody(HttpMethod.PUT);
-    }
-
-    private void setsUpQueryString(final HttpMethod httpMethod) throws UnsupportedEncodingException {
-        context.checking(new Expectations() {
-            {
-                one(requestConfigurer).setHttpMethod(httpMethod);
-                one(requestConfigurer).queryString(repr);
-            }
-        });
-
-        httpMethod.setUpArgs(requestConfigurer, repr);
-    }
-
-    private void setsUpBody(final HttpMethod httpMethod) throws UnsupportedEncodingException {
-        context.checking(new Expectations() {
-            {
-                one(requestConfigurer).setHttpMethod(httpMethod);
-                one(requestConfigurer).body(repr);
-            }
-        });
-
-        httpMethod.setUpArgs(requestConfigurer, repr);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonFixture.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonFixture.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonFixture.java
index 7996ed0..a2b6cca 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonFixture.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonFixture.java
@@ -20,14 +20,13 @@ package org.apache.isis.viewer.restfulobjects.applib;
 
 import java.io.IOException;
 
-import com.google.common.base.Charsets;
-import com.google.common.io.Resources;
-
+import org.apache.isis.viewer.restfulobjects.applib.util.JsonMapper;
 import org.codehaus.jackson.JsonNode;
 import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 
-import org.apache.isis.viewer.restfulobjects.applib.util.JsonMapper;
+import com.google.common.base.Charsets;
+import com.google.common.io.Resources;
 
 class JsonFixture {
 

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_arrayGet_arraySetElementAt.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_arrayGet_arraySetElementAt.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_arrayGet_arraySetElementAt.java
index 732e921..83af6d5 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_arrayGet_arraySetElementAt.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_arrayGet_arraySetElementAt.java
@@ -31,8 +31,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_arrayGet_arraySetElementAt {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_arrayIterator.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_arrayIterator.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_arrayIterator.java
index d29f984..bb64de0 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_arrayIterator.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_arrayIterator.java
@@ -29,8 +29,6 @@ import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_arrayIterator {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_asInputStream.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_asInputStream.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_asInputStream.java
index 33bb592..611fd5f 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_asInputStream.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_asInputStream.java
@@ -28,14 +28,12 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
-import com.google.common.base.Charsets;
-
 import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import com.google.common.base.Charsets;
 
 public class JsonRepresentationTest_asInputStream {
 

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getArray.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getArray.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getArray.java
index 7cbba6a..06718b2 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getArray.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getArray.java
@@ -32,8 +32,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_getArray {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getBigInteger.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getBigInteger.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getBigInteger.java
index 11138d5..e7af049 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getBigInteger.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getBigInteger.java
@@ -32,8 +32,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_getBigInteger {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getBoolean.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getBoolean.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getBoolean.java
index c9a5beb..77fdc46 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getBoolean.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getBoolean.java
@@ -31,8 +31,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_getBoolean {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getDouble.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getDouble.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getDouble.java
index af46c57..4809a6d 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getDouble.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getDouble.java
@@ -31,8 +31,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_getDouble {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getInt.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getInt.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getInt.java
index 24dc331..5fe5894 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getInt.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getInt.java
@@ -31,8 +31,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_getInt {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLink_isLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLink_isLink.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLink_isLink.java
index 7d04103..b7c7058 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLink_isLink.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLink_isLink.java
@@ -26,15 +26,12 @@ import static org.junit.Assert.fail;
 
 import java.io.IOException;
 
+import org.apache.isis.viewer.restfulobjects.applib.links.LinkRepresentation;
 import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.HttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.links.LinkRepresentation;
-
 public class JsonRepresentationTest_getLink_isLink {
 
     private LinkRepresentation link;
@@ -42,7 +39,7 @@ public class JsonRepresentationTest_getLink_isLink {
 
     @Before
     public void setUp() throws Exception {
-        link = new LinkRepresentation().withHref("http://foo/bar").withMethod(HttpMethod.GET);
+        link = new LinkRepresentation().withHref("http://foo/bar").withMethod(RoHttpMethod.GET);
         jsonRepresentation = new JsonRepresentation(readJson("map.json"));
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLong.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLong.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLong.java
index 53fa117..e3ada18 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLong.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLong.java
@@ -31,8 +31,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_getLong {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getNull_isNull.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getNull_isNull.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getNull_isNull.java
index 6eb5f8c..84c32b7 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getNull_isNull.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getNull_isNull.java
@@ -32,8 +32,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_getNull_isNull {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getRepresentation.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getRepresentation.java
index ba9cc90..8a953db 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getRepresentation.java
@@ -30,8 +30,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_getRepresentation {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getString_isString.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getString_isString.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getString_isString.java
index 6e9eeff..3bd627a 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getString_isString.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getString_isString.java
@@ -31,8 +31,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_getString_isString {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_isArray_isMap_isValue.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_isArray_isMap_isValue.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_isArray_isMap_isValue.java
index dc499a1..dffb2f1 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_isArray_isMap_isValue.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_isArray_isMap_isValue.java
@@ -29,8 +29,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_isArray_isMap_isValue {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_mapHas.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_mapHas.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_mapHas.java
index 348ddac..9ce0b9f 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_mapHas.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_mapHas.java
@@ -28,8 +28,6 @@ import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_mapHas {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_mapIterable.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_mapIterable.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_mapIterable.java
index 74421c7..c1db650 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_mapIterable.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_mapIterable.java
@@ -32,8 +32,6 @@ import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_mapIterable {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_newArray.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_newArray.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_newArray.java
index d0a3f5e..910c3d9 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_newArray.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_newArray.java
@@ -23,8 +23,6 @@ import static org.junit.Assert.assertThat;
 
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_newArray {
 
     @Test

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_newObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_newObject.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_newObject.java
index 2f9a9da..e507a85 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_newObject.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_newObject.java
@@ -27,8 +27,6 @@ import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_newObject {
 
     @Test

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_putXxx.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_putXxx.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_putXxx.java
index 76f4c10..6d7ff2f 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_putXxx.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_putXxx.java
@@ -28,8 +28,6 @@ import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_putXxx {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_size.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_size.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_size.java
index f772800..967c6a9 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_size.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_size.java
@@ -28,8 +28,6 @@ import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-
 public class JsonRepresentationTest_size {
 
     private JsonRepresentation jsonRepresentation;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_urlEncoding.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_urlEncoding.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_urlEncoding.java
index e89738b..e1ad36e 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_urlEncoding.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_urlEncoding.java
@@ -24,18 +24,16 @@ import static org.junit.Assert.assertThat;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 
-import com.google.common.base.Charsets;
-
+import org.apache.isis.viewer.restfulobjects.applib.links.LinkRepresentation;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.HttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.links.LinkRepresentation;
+import com.google.common.base.Charsets;
 
 public class JsonRepresentationTest_urlEncoding {
 
     @Test
     public void test() throws UnsupportedEncodingException {
-        final LinkRepresentation l = new LinkRepresentation().withRel("object").withHref("http://localhost:8080/objects/ABC:123").withMethod(HttpMethod.GET);
+        final LinkRepresentation l = new LinkRepresentation().withRel("object").withHref("http://localhost:8080/objects/ABC:123").withMethod(RoHttpMethod.GET);
 
         final String expectedValue = "%7B%22method%22%3A%22GET%22%2C%22rel%22%3A%22object%22%2C%22href%22%3A%22http%3A%2F%2Flocalhost%3A8080%2Fobjects%2FABC%3A123%22%7D";
         @SuppressWarnings("unused")

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
index 17a4375..f917aad 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
@@ -23,11 +23,9 @@ import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertThat;
 
-import javax.ws.rs.core.MediaType;
-
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import com.google.common.net.MediaType;
 
 public class RepresentationTypeTest_getMediaType_lookup {
 
@@ -42,7 +40,7 @@ public class RepresentationTypeTest_getMediaType_lookup {
 
     @Test
     public void whenUnknown() {
-        assertThat(RepresentationType.lookup(MediaType.APPLICATION_ATOM_XML_TYPE), is(RepresentationType.GENERIC));
+        assertThat(RepresentationType.lookup(MediaType.ANY_TEXT_TYPE), is(RepresentationType.GENERIC));
     }
 
     @Test
@@ -52,8 +50,7 @@ public class RepresentationTypeTest_getMediaType_lookup {
 
     @Test
     public void getMediaTypeProfile() {
-        assertThat(RepresentationType.VERSION.getMediaTypeWithProfile(), is("urn:org.restfulobjects/version"));
-        assertThat(RepresentationType.GENERIC.getMediaTypeWithProfile(), is(nullValue()));
+        assertThat(RepresentationType.VERSION.getMediaTypeProfile(), is("urn:org.restfulobjects/version"));
+        assertThat(RepresentationType.GENERIC.getMediaTypeProfile(), is(nullValue()));
     }
-
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName_lookup.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName_lookup.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName_lookup.java
index 46f62cc..75ef1fe 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName_lookup.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName_lookup.java
@@ -24,8 +24,6 @@ import static org.junit.Assert.assertThat;
 
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-
 public class RepresentationTypeTest_getName_lookup {
 
     @Test

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_parser.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_parser.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_parser.java
index fbca997..142dfdd 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_parser.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_parser.java
@@ -20,10 +20,8 @@ package org.apache.isis.viewer.restfulobjects.applib;
 
 import static org.junit.Assert.assertSame;
 
-import org.junit.Test;
-
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
 import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
+import org.junit.Test;
 
 public class RepresentationTypeTest_parser {
 

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulClientTest_follow.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulClientTest_follow.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulClientTest_follow.java
index cdb441c..f5e2e10 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulClientTest_follow.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulClientTest_follow.java
@@ -23,6 +23,10 @@ import java.net.URI;
 import javax.ws.rs.core.MediaType;
 
 import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.isis.core.unittestsupport.jmock.auto.Mock;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+import org.apache.isis.viewer.restfulobjects.applib.links.LinkRepresentation;
 import org.hamcrest.Description;
 import org.hamcrest.Matcher;
 import org.hamcrest.TypeSafeMatcher;
@@ -36,14 +40,6 @@ import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
-import org.apache.isis.core.unittestsupport.jmock.auto.Mock;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.links.LinkRepresentation;
-
 public class RestfulClientTest_follow {
 
     @Rule

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulRequestDomainModelTest_parser.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulRequestDomainModelTest_parser.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulRequestDomainModelTest_parser.java
index e668426..9a93224 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulRequestDomainModelTest_parser.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulRequestDomainModelTest_parser.java
@@ -20,11 +20,9 @@ package org.apache.isis.viewer.restfulobjects.applib;
 
 import static org.junit.Assert.assertSame;
 
-import org.junit.Test;
-
-import org.apache.isis.viewer.restfulobjects.applib.RestfulRequest;
 import org.apache.isis.viewer.restfulobjects.applib.RestfulRequest.DomainModel;
 import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
+import org.junit.Test;
 
 public class RestfulRequestDomainModelTest_parser {
 

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulRequestRequestParameterTest_valueOf.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulRequestRequestParameterTest_valueOf.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulRequestRequestParameterTest_valueOf.java
index 451e7e7..da72aaa 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulRequestRequestParameterTest_valueOf.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulRequestRequestParameterTest_valueOf.java
@@ -23,13 +23,10 @@ import static org.junit.Assert.assertThat;
 
 import java.util.List;
 
+import org.apache.isis.viewer.restfulobjects.applib.RestfulRequest.RequestParameter;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulRequest.RequestParameter;
-
 public class RestfulRequestRequestParameterTest_valueOf {
 
     private final RequestParameter<List<List<String>>> requestParameter = RestfulRequest.RequestParameter.FOLLOW_LINKS;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulResponse_HttpStatusCodeTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulResponse_HttpStatusCodeTest.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulResponse_HttpStatusCodeTest.java
index 07faee1..d3604e2 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulResponse_HttpStatusCodeTest.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RestfulResponse_HttpStatusCodeTest.java
@@ -23,9 +23,8 @@ import static org.junit.Assert.assertThat;
 
 import javax.ws.rs.core.Response.Status.Family;
 
-import org.junit.Test;
-
 import org.apache.isis.viewer.restfulobjects.applib.RestfulResponse.HttpStatusCode;
+import org.junit.Test;
 
 public class RestfulResponse_HttpStatusCodeTest {
 

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RoHttpMethodTest_setUp.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RoHttpMethodTest_setUp.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RoHttpMethodTest_setUp.java
new file mode 100644
index 0000000..903b6ee
--- /dev/null
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RoHttpMethodTest_setUp.java
@@ -0,0 +1,93 @@
+/*
+ *  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.isis.viewer.restfulobjects.applib;
+
+import java.io.UnsupportedEncodingException;
+
+import org.apache.isis.core.unittestsupport.jmock.auto.Mock;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+import org.jmock.Expectations;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class RoHttpMethodTest_setUp {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    @Mock
+    private ClientRequestConfigurer requestConfigurer;
+
+    private JsonRepresentation repr;
+
+    @Before
+    public void setUp() throws Exception {
+        repr = JsonRepresentation.newMap();
+        repr.mapPut("aString", "bar");
+        repr.mapPut("anInt", 3);
+        repr.mapPut("aLong", 31231231L);
+        repr.mapPut("aBoolean", true);
+        repr.mapPut("aStringRequiringEncoding", "http://localhost:8080/somewhere");
+    }
+
+    @Test
+    public void get() throws Exception {
+        setsUpQueryString(RoHttpMethod.GET);
+    }
+
+    @Test
+    public void delete() throws Exception {
+        setsUpQueryString(RoHttpMethod.DELETE);
+    }
+
+    @Test
+    public void post() throws Exception {
+        setsUpBody(RoHttpMethod.POST);
+    }
+
+    @Test
+    public void put() throws Exception {
+        setsUpBody(RoHttpMethod.PUT);
+    }
+
+    private void setsUpQueryString(final RoHttpMethod httpMethod) throws UnsupportedEncodingException {
+        context.checking(new Expectations() {
+            {
+                one(requestConfigurer).setHttpMethod(httpMethod);
+                one(requestConfigurer).queryString(repr);
+            }
+        });
+
+        httpMethod.setUpArgs(requestConfigurer, repr);
+    }
+
+    private void setsUpBody(final RoHttpMethod httpMethod) throws UnsupportedEncodingException {
+        context.checking(new Expectations() {
+            {
+                one(requestConfigurer).setHttpMethod(httpMethod);
+                one(requestConfigurer).body(repr);
+            }
+        });
+
+        httpMethod.setUpArgs(requestConfigurer, repr);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/links/LinkRepresentationTest_equals.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/links/LinkRepresentationTest_equals.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/links/LinkRepresentationTest_equals.java
index 40fdf08..95a0695 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/links/LinkRepresentationTest_equals.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/links/LinkRepresentationTest_equals.java
@@ -25,19 +25,17 @@ import static org.junit.Assert.assertThat;
 
 import java.io.UnsupportedEncodingException;
 
+import org.apache.isis.viewer.restfulobjects.applib.RoHttpMethod;
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.HttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.links.LinkRepresentation;
-
 public class LinkRepresentationTest_equals {
 
     @Test
     public void equalDependsOnMethodAndHref() throws UnsupportedEncodingException {
-        final LinkRepresentation link = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:123").withMethod(HttpMethod.GET);
-        final LinkRepresentation link2 = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:123").withMethod(HttpMethod.GET);
-        final LinkRepresentation link3 = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:123").withMethod(HttpMethod.PUT);
-        final LinkRepresentation link4 = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:456").withMethod(HttpMethod.GET);
+        final LinkRepresentation link = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:123").withMethod(RoHttpMethod.GET);
+        final LinkRepresentation link2 = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:123").withMethod(RoHttpMethod.GET);
+        final LinkRepresentation link3 = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:123").withMethod(RoHttpMethod.PUT);
+        final LinkRepresentation link4 = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:456").withMethod(RoHttpMethod.GET);
 
         assertThat(link, is(equalTo(link2)));
         assertThat(link, is(not(equalTo(link3))));
@@ -46,8 +44,8 @@ public class LinkRepresentationTest_equals {
 
     @Test
     public void equalDoesNotDependsOnMethodAndHref() throws UnsupportedEncodingException {
-        final LinkRepresentation link = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:123").withMethod(HttpMethod.GET).withRel("something");
-        final LinkRepresentation link2 = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:123").withMethod(HttpMethod.GET).withRel("else");
+        final LinkRepresentation link = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:123").withMethod(RoHttpMethod.GET).withRel("something");
+        final LinkRepresentation link2 = new LinkRepresentation().withHref("http://localhost:8080/objects/ABC:123").withMethod(RoHttpMethod.GET).withRel("else");
 
         assertThat(link, is(equalTo(link2)));
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
index 42c2864..986a05f 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
@@ -28,14 +28,13 @@ import java.util.Date;
 import java.util.List;
 
 import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-
-import org.junit.Test;
 
 import org.apache.isis.core.commons.matchers.IsisMatchers;
 import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
 import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
-import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
+import org.junit.Test;
+
+import com.google.common.net.MediaType;
 
 public class ParserTest {
 
@@ -114,8 +113,8 @@ public class ParserTest {
     }
 
     @Test
-    public void forMediaTypes() {
-        final Parser<MediaType> parser = Parser.forMediaType();
+    public void forGuavaMediaTypes() {
+        final Parser<MediaType> parser = Parser.forGuavaMediaType();
         final MediaType mediaType = RepresentationType.DOMAIN_OBJECT.getMediaType();
         final String asString = parser.asString(mediaType);
         final MediaType valueOf = parser.valueOf(asString);
@@ -125,9 +124,9 @@ public class ParserTest {
 
     @Test
     public void forListOfMediaTypes() {
-        final Parser<List<MediaType>> parser = Parser.forListOfMediaTypes();
+        final Parser<List<MediaType>> parser = Parser.forListOfGuavaMediaTypes();
         final MediaType mediaType = RepresentationType.DOMAIN_OBJECT.getMediaType();
-        final List<MediaType> v = Arrays.asList(mediaType, MediaType.APPLICATION_JSON_TYPE);
+        final List<MediaType> v = Arrays.asList(mediaType, MediaType.parse("application/json"));
         final String asString = parser.asString(v);
         final List<MediaType> valueOf = parser.valueOf(asString);
 
@@ -161,12 +160,12 @@ public class ParserTest {
     }
 
     @Test
-    public void forMediaType() {
-        final Parser<MediaType> parser = Parser.forMediaType();
+    public void forJaxRsMediaType() {
+        final Parser<javax.ws.rs.core.MediaType> parser = Parser.forJaxRsMediaType();
 
-        for (final MediaType v : new MediaType[] { MediaType.APPLICATION_ATOM_XML_TYPE, MediaType.APPLICATION_JSON_TYPE, MediaType.APPLICATION_XHTML_XML_TYPE, MediaType.valueOf(RestfulMediaType.APPLICATION_JSON_DOMAIN_OBJECT) }) {
+        for (final javax.ws.rs.core.MediaType v : new javax.ws.rs.core.MediaType[] { javax.ws.rs.core.MediaType.APPLICATION_ATOM_XML_TYPE, javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE, javax.ws.rs.core.MediaType.APPLICATION_XHTML_XML_TYPE, javax.ws.rs.core.MediaType.valueOf(RestfulMediaType.APPLICATION_JSON_DOMAIN_OBJECT) }) {
             final String asString = parser.asString(v);
-            final MediaType valueOf = parser.valueOf(asString);
+            final javax.ws.rs.core.MediaType valueOf = parser.valueOf(asString);
             assertThat(v, is(equalTo(valueOf)));
         }
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
index 9ce3776..8cdc5dd 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
@@ -23,8 +23,6 @@ import static org.junit.Assert.assertFalse;
 
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.util.PathNode;
-
 public class PathNodeTest_equalsHashcode {
 
     @Test

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_parse.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_parse.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_parse.java
index 0702598..86c78d1 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_parse.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_parse.java
@@ -25,8 +25,6 @@ import java.util.Map;
 
 import org.junit.Test;
 
-import org.apache.isis.viewer.restfulobjects.applib.util.PathNode;
-
 public class PathNodeTest_parse {
 
     @Test

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/impl/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/impl/pom.xml b/component/viewer/restfulobjects/impl/pom.xml
deleted file mode 100644
index ffdcffb..0000000
--- a/component/viewer/restfulobjects/impl/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<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/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-
-	<parent>
-		<groupId>org.apache.isis.viewer</groupId>
-		<artifactId>isis-viewer-restfulobjects</artifactId>
-		<version>1.0.1-SNAPSHOT</version>
-	</parent>
-
-	<artifactId>isis-viewer-restfulobjects-impl</artifactId>
-	<name>Isis RestfulObjects Viewer Implementation</name>
-
-	<properties>
-		<siteBaseDir>..</siteBaseDir>
-		<relativeUrl>viewer/</relativeUrl>
-	</properties>
-
-    <!-- used in Site generation for relative references. -->
-    <url>http://isis.apache.org/${relativeUrl}</url>
-
-	<dependencies>
-
-        <dependency>
-            <groupId>org.apache.isis.core</groupId>
-            <artifactId>isis-core-unittestsupport</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-		<dependency>
-			<groupId>org.apache.isis.core</groupId>
-			<artifactId>isis-core-applib</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.isis.core</groupId>
-			<artifactId>isis-core-metamodel</artifactId>
-		</dependency>
-        <dependency>
-            <groupId>org.apache.isis.core</groupId>
-            <artifactId>isis-core-runtime</artifactId>
-        </dependency>
-
-		<dependency>
-			<groupId>org.apache.isis.viewer</groupId>
-			<artifactId>isis-viewer-restfulobjects-applib</artifactId>
-		</dependency>
-
-
-        <!-- the javax:* equivalents of these are excluded in 
-             dependencyManagement of resteasy-jaxrs, so  
-             are required here -->           
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_2.5_spec</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-annotation_1.0_spec</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-activation_1.1_spec</artifactId>
-        </dependency>
-
-	</dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/AbstractJaxRsApplication.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/AbstractJaxRsApplication.java b/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/AbstractJaxRsApplication.java
deleted file mode 100644
index d3fcc98..0000000
--- a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/AbstractJaxRsApplication.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  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.isis.viewer.restfulobjects.viewer;
-
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import javax.ws.rs.core.Application;
-
-public abstract class AbstractJaxRsApplication extends Application {
-
-    private final Set<Object> singletons = new LinkedHashSet<Object>();
-    private final Set<Class<?>> classes = new LinkedHashSet<Class<?>>();
-
-    public AbstractJaxRsApplication() {
-    }
-
-    @Override
-    public Set<Class<?>> getClasses() {
-        return Collections.unmodifiableSet(classes);
-    }
-
-    @Override
-    public Set<Object> getSingletons() {
-        return Collections.unmodifiableSet(singletons);
-    }
-
-    protected boolean addClass(final Class<?> cls) {
-        return classes.add(cls);
-    }
-
-    protected boolean addSingleton(final Object resource) {
-        return singletons.add(resource);
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/Constants.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/Constants.java b/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/Constants.java
deleted file mode 100644
index 0b97bc5..0000000
--- a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/Constants.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  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.isis.viewer.restfulobjects.viewer;
-
-import org.apache.isis.core.runtime.system.SystemConstants;
-
-public final class Constants {
-
-    public static final String VIEWER_PREFIX_KEY = SystemConstants.VIEWER_KEY + ".restful";
-    public static final String JAVASCRIPT_DEBUG_KEY = VIEWER_PREFIX_KEY + ".javascript-debug";
-
-    public static final String ISIS_REST_SUPPORT_JS = "isis-rest-support.js";
-    public static final String JQUERY_SRC_JS = "jquery-1.6.1.js";
-    public static final String JQUERY_MIN_JS = "jquery-1.6.1.min.js";
-    public static final String URL_ENCODING_CHAR_SET = org.apache.isis.viewer.restfulobjects.applib.Constants.URL_ENCODING_CHAR_SET;
-
-    private Constants() {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/HasHttpStatusCode.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/HasHttpStatusCode.java b/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/HasHttpStatusCode.java
deleted file mode 100644
index 89c8e5e..0000000
--- a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/HasHttpStatusCode.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *  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.isis.viewer.restfulobjects.viewer;
-
-import org.apache.isis.viewer.restfulobjects.applib.RestfulResponse.HttpStatusCode;
-
-public interface HasHttpStatusCode {
-
-    HttpStatusCode getHttpStatusCode();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RendererContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RendererContext.java b/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RendererContext.java
deleted file mode 100644
index c413d4a..0000000
--- a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RendererContext.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.viewer;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.profiles.Localization;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-
-public interface RendererContext {
-
-    public String urlFor(final String url);
-
-    public AuthenticationSession getAuthenticationSession();
-    
-    public AdapterManager getAdapterManager();
-
-    public List<List<String>> getFollowLinks();
-    
-    public Where getWhere();
-    
-    public Localization getLocalization();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/ResourceContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/ResourceContext.java b/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/ResourceContext.java
deleted file mode 100644
index df1ab50..0000000
--- a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/ResourceContext.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- *  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.isis.viewer.restfulobjects.viewer;
-
-import java.util.Collections;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.SecurityContext;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.profiles.Localization;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulRequest.RequestParameter;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.viewer.resources.domainobjects.DomainResourceHelper;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-public class ResourceContext implements RendererContext {
-
-    private final HttpHeaders httpHeaders;
-    private final UriInfo uriInfo;
-    private final Request request;
-    private final HttpServletRequest httpServletRequest;
-    private final HttpServletResponse httpServletResponse;
-    private final SecurityContext securityContext;
-    private final Localization localization;
-
-    @SuppressWarnings("unused")
-    private final IsisConfiguration configuration;
-    private final AuthenticationSession authenticationSession;
-    private final PersistenceSession persistenceSession;
-    private final AdapterManager adapterManager;
-    private final SpecificationLoader specificationLookup;
-
-    private List<List<String>> followLinks;
-
-    private final static Predicate<MediaType> MEDIA_TYPE_NOT_GENERIC_APPLICATION_JSON = new Predicate<MediaType>() {
-        @Override
-        public boolean apply(final MediaType mediaType) {
-            return !mediaType.equals(MediaType.APPLICATION_JSON_TYPE);
-        }
-    };
-    private final static Predicate<MediaType> MEDIA_TYPE_CONTAINS_PROFILE = new Predicate<MediaType>() {
-        @Override
-        public boolean apply(final MediaType mediaType) {
-            return mediaType.getParameters().containsKey("profile");
-        }
-    };
-    private final Where where;
-    private JsonRepresentation readQueryStringAsMap;
-
-    public ResourceContext(
-            final RepresentationType representationType, 
-            final HttpHeaders httpHeaders, final UriInfo uriInfo, 
-            final Request request, 
-            final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse, 
-            final SecurityContext securityContext,
-            final Localization localization, 
-            final AuthenticationSession authenticationSession, final PersistenceSession persistenceSession, 
-            final AdapterManager objectAdapterLookup, final SpecificationLoader specificationLookup, final IsisConfiguration configuration, final Where where) {
-
-        this.httpHeaders = httpHeaders;
-        this.uriInfo = uriInfo;
-        this.request = request;
-        this.httpServletRequest = httpServletRequest;
-        this.httpServletResponse = httpServletResponse;
-        this.securityContext = securityContext;
-        this.localization = localization;
-        this.configuration = configuration;
-        this.authenticationSession = authenticationSession;
-        this.persistenceSession = persistenceSession;
-        this.adapterManager = objectAdapterLookup;
-        this.specificationLookup = specificationLookup;
-        this.where = where;
-
-        init(representationType);
-    }
-
-    void init(final RepresentationType representationType) {
-        ensureCompatibleAcceptHeader(representationType);
-        this.followLinks = Collections.unmodifiableList(getArg(RequestParameter.FOLLOW_LINKS));
-    }
-
-    public HttpHeaders getHttpHeaders() {
-        return httpHeaders;
-    }
-
-    public String getQueryString() {
-        return getHttpServletRequest().getQueryString();
-    }
-
-    public JsonRepresentation getQueryStringAsJsonRepr() {
-        if (readQueryStringAsMap == null) {
-            readQueryStringAsMap = DomainResourceHelper.readQueryStringAsMap(getQueryString());
-        }
-        return readQueryStringAsMap;
-    }
-
-    public <Q> Q getArg(final RequestParameter<Q> requestParameter) {
-        final JsonRepresentation queryStringJsonRepr = getQueryStringAsJsonRepr();
-        return requestParameter.valueOf(queryStringJsonRepr);
-    }
-
-    public UriInfo getUriInfo() {
-        return uriInfo;
-    }
-
-    public Request getRequest() {
-        return request;
-    }
-
-    public HttpServletRequest getHttpServletRequest() {
-        return httpServletRequest;
-    }
-
-    public HttpServletResponse getServletResponse() {
-        return httpServletResponse;
-    }
-
-    public SecurityContext getSecurityContext() {
-        return securityContext;
-    }
-
-    private void ensureCompatibleAcceptHeader(final RepresentationType representationType) {
-        if (representationType == null) {
-            return;
-        }
-        final MediaType producedType = representationType.getMediaType();
-        final List<MediaType> acceptableMediaTypes = acceptableMediaTypes();
-        for (final MediaType mediaType : acceptableMediaTypes) {
-            if (compatible(mediaType, representationType)) {
-                return;
-            }
-        }
-        if (!acceptableMediaTypes.contains(producedType)) {
-            throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_ACCEPTABLE, "Resource produces %s media type", representationType.getMediaTypeWithProfile());
-        }
-    }
-
-    /**
-     * If no media type has a profile parameter, then simply return all the
-     * media types.
-     * 
-     * <p>
-     * Otherwise, though, filter out the {@link MediaType#APPLICATION_JSON_TYPE
-     * generic application/json} media type if it is present.
-     */
-    private List<MediaType> acceptableMediaTypes() {
-        final List<MediaType> acceptableMediaTypes = getHttpHeaders().getAcceptableMediaTypes();
-        if (Collections2.filter(acceptableMediaTypes, MEDIA_TYPE_CONTAINS_PROFILE).isEmpty()) {
-            return acceptableMediaTypes;
-        }
-        return Lists.newArrayList(Iterables.filter(acceptableMediaTypes, MEDIA_TYPE_NOT_GENERIC_APPLICATION_JSON));
-    }
-
-    private boolean compatible(final MediaType acceptedMediaType, final RepresentationType representationType) {
-        final MediaType producedMediaType = representationType.getMediaType();
-        final String profile = acceptedMediaType.getParameters().get("profile");
-        return profile == null ? acceptedMediaType.isCompatible(producedMediaType) : acceptedMediaType.equals(producedMediaType);
-    }
-
-    public List<List<String>> getFollowLinks() {
-        return followLinks;
-    }
-
-    public String urlFor(final String url) {
-        return getUriInfo().getBaseUri().toString() + url;
-    }
-
-    public Localization getLocalization() {
-        return localization;
-    }
-
-    public AuthenticationSession getAuthenticationSession() {
-        return authenticationSession;
-    }
-
-    public AdapterManager getAdapterManager() {
-        return adapterManager;
-    }
-
-    public PersistenceSession getPersistenceSession() {
-        return persistenceSession;
-    }
-
-    public List<ObjectAdapter> getServiceAdapters() {
-        return persistenceSession.getServices();
-    }
-
-    public SpecificationLoader getSpecificationLookup() {
-        return specificationLookup;
-    }
-
-    public Where getWhere() {
-        return where;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplication.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplication.java b/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplication.java
deleted file mode 100644
index a20342f..0000000
--- a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplication.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  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.isis.viewer.restfulobjects.viewer;
-
-import org.apache.isis.viewer.restfulobjects.viewer.resources.domainobjects.DomainObjectResourceServerside;
-import org.apache.isis.viewer.restfulobjects.viewer.resources.domainobjects.DomainServiceResourceServerside;
-import org.apache.isis.viewer.restfulobjects.viewer.resources.domaintypes.DomainTypeResourceServerside;
-import org.apache.isis.viewer.restfulobjects.viewer.resources.home.HomePageResourceServerside;
-import org.apache.isis.viewer.restfulobjects.viewer.resources.user.UserResourceServerside;
-import org.apache.isis.viewer.restfulobjects.viewer.resources.version.VersionResourceServerside;
-
-public class RestfulObjectsApplication extends AbstractJaxRsApplication {
-
-    public static final String SPEC_VERSION = "0.52";
-
-    public RestfulObjectsApplication() {
-        addClass(HomePageResourceServerside.class);
-        addClass(DomainTypeResourceServerside.class);
-        addClass(UserResourceServerside.class);
-        addClass(DomainObjectResourceServerside.class);
-        addClass(DomainServiceResourceServerside.class);
-        addClass(VersionResourceServerside.class);
-
-        addSingleton(new RestfulObjectsApplicationExceptionMapper());
-        addSingleton(new RuntimeExceptionMapper());
-
-        // TODO: doesn't get injected
-        // addSingleton(new TypedReprBuilderFactoryRegistry());
-
-        // TODO: idea being to remove the init()
-        // addSingleton(new PreProcessInterceptorForIsisSession());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplicationException.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplicationException.java b/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplicationException.java
deleted file mode 100644
index d34c6df..0000000
--- a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplicationException.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  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.isis.viewer.restfulobjects.viewer;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulResponse.HttpStatusCode;
-
-public class RestfulObjectsApplicationException extends RuntimeException implements HasHttpStatusCode {
-
-    public static final RestfulObjectsApplicationException create(final HttpStatusCode httpStatusCode) {
-        return create(httpStatusCode, null);
-    }
-
-    public static RestfulObjectsApplicationException create(final HttpStatusCode httpStatusCode, final String message, final Object... args) {
-        return create(httpStatusCode, (Exception) null, message, args);
-    }
-
-    public static RestfulObjectsApplicationException create(final HttpStatusCode httpStatusCode, final Exception cause) {
-        return create(httpStatusCode, cause, null);
-    }
-
-    public static RestfulObjectsApplicationException create(final HttpStatusCode httpStatusCode, final Exception cause, final String message, final Object... args) {
-        return new RestfulObjectsApplicationException(httpStatusCode, formatString(message, args), cause, null);
-    }
-
-    public static RestfulObjectsApplicationException create(final HttpStatusCode httpStatusCode, final JsonRepresentation repr, final String message, final Object... args) {
-        return new RestfulObjectsApplicationException(httpStatusCode, formatString(message, args), null, repr);
-    }
-
-    private static String formatString(final String formatStr, final Object... args) {
-        return formatStr != null ? String.format(formatStr, args) : null;
-    }
-
-    private static final long serialVersionUID = 1L;
-    private final HttpStatusCode httpStatusCode;
-    private final JsonRepresentation jsonRepresentation;
-
-    private RestfulObjectsApplicationException(final HttpStatusCode httpStatusCode, final String message, final Throwable ex, final JsonRepresentation jsonRepresentation) {
-        super(message, ex);
-        this.httpStatusCode = httpStatusCode;
-        this.jsonRepresentation = jsonRepresentation;
-    }
-
-    @Override
-    public HttpStatusCode getHttpStatusCode() {
-        return httpStatusCode;
-    }
-
-    public JsonRepresentation getJsonRepresentation() {
-        return jsonRepresentation;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/bb79d33e/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplicationExceptionMapper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplicationExceptionMapper.java b/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplicationExceptionMapper.java
deleted file mode 100644
index 2a5bf23..0000000
--- a/component/viewer/restfulobjects/impl/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/RestfulObjectsApplicationExceptionMapper.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *  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.isis.viewer.restfulobjects.viewer;
-
-import java.util.List;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import com.google.common.collect.Lists;
-
-import org.apache.commons.lang.exception.ExceptionUtils;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.util.JsonMapper;
-
-@Provider
-public class RestfulObjectsApplicationExceptionMapper implements ExceptionMapper<RestfulObjectsApplicationException> {
-
-    @Override
-    public Response toResponse(final RestfulObjectsApplicationException ex) {
-        final ResponseBuilder builder = Response.status(ex.getHttpStatusCode().getJaxrsStatusType()).type(RestfulMediaType.APPLICATION_JSON_ERROR).entity(jsonFor(ex));
-        final String message = ex.getMessage();
-        if (message != null) {
-            builder.header(RestfulResponse.Header.WARNING.getName(), message);
-        }
-        return builder.build();
-    }
-
-    private static class ExceptionPojo {
-
-        public static ExceptionPojo create(final Exception ex) {
-            return new ExceptionPojo(ex);
-        }
-
-        private static String format(final StackTraceElement stackTraceElement) {
-            return stackTraceElement.toString();
-        }
-
-        private final int httpStatusCode;
-        private final String message;
-        private final List<String> stackTrace = Lists.newArrayList();
-        private ExceptionPojo causedBy;
-
-        public ExceptionPojo(final Throwable ex) {
-            httpStatusCode = getHttpStatusCodeIfAny(ex);
-            this.message = ex.getMessage();
-            final StackTraceElement[] stackTraceElements = ex.getStackTrace();
-            for (final StackTraceElement stackTraceElement : stackTraceElements) {
-                this.stackTrace.add(format(stackTraceElement));
-            }
-            final Throwable cause = ex.getCause();
-            if (cause != null && cause != ex) {
-                this.causedBy = new ExceptionPojo(cause);
-            }
-        }
-
-        private int getHttpStatusCodeIfAny(final Throwable ex) {
-            if (!(ex instanceof HasHttpStatusCode)) {
-                return 0;
-            }
-            final HasHttpStatusCode hasHttpStatusCode = (HasHttpStatusCode) ex;
-            return hasHttpStatusCode.getHttpStatusCode().getStatusCode();
-        }
-
-        @SuppressWarnings("unused")
-        public int getHttpStatusCode() {
-            return httpStatusCode;
-        }
-
-        @SuppressWarnings("unused")
-        public String getMessage() {
-            return message;
-        }
-
-        @SuppressWarnings("unused")
-        public List<String> getStackTrace() {
-            return stackTrace;
-        }
-
-        @SuppressWarnings("unused")
-        public ExceptionPojo getCausedBy() {
-            return causedBy;
-        }
-
-    }
-
-    static String jsonFor(final RestfulObjectsApplicationException ex) {
-        final JsonRepresentation jsonRepresentation = ex.getJsonRepresentation();
-        if (jsonRepresentation != null) {
-            return jsonRepresentation.toString();
-        }
-        try {
-            return JsonMapper.instance().write(ExceptionPojo.create(ex));
-        } catch (final Exception e) {
-            // fallback
-            return "{ \"exception\": \"" + ExceptionUtils.getFullStackTrace(ex) + "\" }";
-        }
-    }
-}