Index: src/main/java/org/modeshape/web/jcr/rest/client/domain/Server.java =================================================================== --- src/main/java/org/modeshape/web/jcr/rest/client/domain/Server.java (revision 1888) +++ src/main/java/org/modeshape/web/jcr/rest/client/domain/Server.java (working copy) @@ -31,6 +31,18 @@ /** * The Server class is the business object for a server that is hosting one or more ModeShape repositories. + * + *

+ * The server requires a url, user name, and a password in order to connect. + * The {@link #url} that is used has a format of http://hostname:port/context root. + * Where + *

  • hostname is the name of the server
  • + *
  • port is the port to connect to, generally its 8080
  • + *
  • context root is the deployed war context
  • + *

    + * The deployed war context root is based on what the deployed war file is called. + * If the ModeShape deployed war is called resources.war (which is the default build name), then the context root + * would be resources. */ @Immutable public class Server implements IModeShapeObject { @@ -61,7 +73,7 @@ /** * Constructs on new Server. * - * @param url the server URL (never null) + * @param url the server URL, which must contain the deployed war file context (never null) * @param user the server user (may be null) * @param password the server password (may be null) * @throws IllegalArgumentException if the URL or user arguments are null Index: src/main/java/org/modeshape/web/jcr/rest/client/json/IJsonConstants.java =================================================================== --- src/main/java/org/modeshape/web/jcr/rest/client/json/IJsonConstants.java (revision 1888) +++ src/main/java/org/modeshape/web/jcr/rest/client/json/IJsonConstants.java (working copy) @@ -65,11 +65,6 @@ String PROPERTIES_KEY = "properties"; /** - * The server context added to URLs. - */ - String SERVER_CONTEXT = "/resources"; - - /** * The workspace context added to the URLs. */ String WORKSPACE_CONTEXT = "/items"; Index: src/main/java/org/modeshape/web/jcr/rest/client/json/ServerNode.java =================================================================== --- src/main/java/org/modeshape/web/jcr/rest/client/json/ServerNode.java (revision 1888) +++ src/main/java/org/modeshape/web/jcr/rest/client/json/ServerNode.java (working copy) @@ -85,10 +85,6 @@ if (url.lastIndexOf("/") == (url.length() - 1)) { url.delete((url.length() - 1), (url.length() - 1)); } - - // append server context - url.append(IJsonConstants.SERVER_CONTEXT); - return new URL(url.toString()); } Index: src/test/java/org/modeshape/web/jcr/rest/client/json/JsonRestClientTest.java =================================================================== --- src/test/java/org/modeshape/web/jcr/rest/client/json/JsonRestClientTest.java (revision 1888) +++ src/test/java/org/modeshape/web/jcr/rest/client/json/JsonRestClientTest.java (working copy) @@ -55,7 +55,7 @@ private static final String PSWD = "password"; private static final String USER = "dnauser"; - private static final Server SERVER = new Server("http://localhost:8090", USER, PSWD); + private static final Server SERVER = new Server("http://localhost:8090/resources", USER, PSWD); private static final String REPOSITORY_NAME = "mode:repository"; private static final Repository REPOSITORY1 = new Repository(REPOSITORY_NAME, SERVER); private static final String WORKSPACE_NAME = "default"; Index: src/test/java/org/modeshape/web/jcr/rest/client/domain/ServerTest.java =================================================================== --- src/test/java/org/modeshape/web/jcr/rest/client/domain/ServerTest.java (revision 1888) +++ src/test/java/org/modeshape/web/jcr/rest/client/domain/ServerTest.java (working copy) @@ -40,8 +40,8 @@ // Constants // =========================================================================================================================== - private static final String URL1 = "file:/tmp/temp.txt"; - private static final String URL2 = "http:www.redhat.com"; + private static final String URL1 = "file:/tmp/temp.txt/resources"; + private static final String URL2 = "http:www.redhat.com/resources"; private static final String USER1 = "user1"; private static final String USER2 = "user2"; @@ -50,6 +50,7 @@ private static final String PSWD2 = "pwsd2"; private static Server SERVER1 = new Server(URL1, USER1, PSWD1); + private static Server SERVER2 = new Server(URL2, USER2, PSWD2); // =========================================================================================================================== // Tests @@ -58,6 +59,7 @@ @Test public void shouldBeEqualIfHavingSameProperies() { assertThat(SERVER1, equalTo(new Server(SERVER1.getUrl(), SERVER1.getUser(), SERVER1.getPassword()))); + assertThat(SERVER2, equalTo(new Server(SERVER2.getUrl(), SERVER2.getUser(), SERVER2.getPassword()))); } @Test Index: src/test/java/org/modeshape/web/jcr/rest/client/domain/WorkspaceTest.java =================================================================== --- src/test/java/org/modeshape/web/jcr/rest/client/domain/WorkspaceTest.java (revision 1888) +++ src/test/java/org/modeshape/web/jcr/rest/client/domain/WorkspaceTest.java (working copy) @@ -44,9 +44,9 @@ private static final String NAME2 = "name2"; - private static final Server SERVER1 = new Server("file:/tmp/temp.txt", "user", "pswd"); + private static final Server SERVER1 = new Server("file:/tmp/temp.txt/resources", "user", "pswd"); - private static final Server SERVER2 = new Server("http:www.redhat.com", "user", "pswd"); + private static final Server SERVER2 = new Server("http:www.redhat.com/resources", "user", "pswd"); private static final Repository REPOSITORY1 = new Repository(NAME1, SERVER1); Index: src/test/java/org/modeshape/web/jcr/rest/client/domain/RepositoryTest.java =================================================================== --- src/test/java/org/modeshape/web/jcr/rest/client/domain/RepositoryTest.java (revision 1888) +++ src/test/java/org/modeshape/web/jcr/rest/client/domain/RepositoryTest.java (working copy) @@ -44,9 +44,9 @@ private static final String NAME2 = "name2"; - private static final Server SERVER1 = new Server("file:/tmp/temp.txt", "user", "pswd"); + private static final Server SERVER1 = new Server("file:/tmp/temp.txt/resources", "user", "pswd"); - private static final Server SERVER2 = new Server("http:www.redhat.com", "user", "pswd"); + private static final Server SERVER2 = new Server("http:www.redhat.com/resources", "user", "pswd"); private static final Repository REPOSITORY1 = new Repository(NAME1, SERVER1);