[dna-commits] DNA SVN: r1282 - in trunk/web/dna-web-jcr-rest-client/src/main: java/org/jboss/dna/web/jcr/rest/client/http and 2 other directories.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Fri Oct 2 13:05:21 EDT 2009


Author: elvisisking
Date: 2009-10-02 13:05:21 -0400 (Fri, 02 Oct 2009)
New Revision: 1282

Removed:
   trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java
   trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpUrlConnection.java
   trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/IHttpConnection.java
Modified:
   trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java
   trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java
   trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpClientConnection.java
   trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java
   trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
Log:
DNA 532 Delete IHttpConnection Interface Since There Is Only One Implementation That Works Correctly: Deleted IHttpConnection and HttpUrlConnection. Since the Apache HttpClient implementation is the only one that works properly no need to keep the java.net implementation or the interface around.

Modified: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java	2009-10-02 17:03:04 UTC (rev 1281)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java	2009-10-02 17:05:21 UTC (rev 1282)
@@ -71,6 +71,8 @@
     public static I18n serverManagerUnregisteredServer;
 
     public static I18n serverShortDescription;
+    
+    public static I18n unknownHttpRequestMethodMsg;
 
     public static I18n workspaceEmptyNameMsg;
 

Deleted: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java	2009-10-02 17:03:04 UTC (rev 1281)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java	2009-10-02 17:05:21 UTC (rev 1282)
@@ -1,51 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client;
-
-import java.net.Authenticator;
-import java.net.PasswordAuthentication;
-import org.jboss.dna.web.jcr.rest.client.domain.Server;
-
-/**
- * The <code>ServerAuthenticator</code> class provides user names and passwords to the HTTP connection.
- */
-public class ServerAuthenticator extends Authenticator {
-
-    // ===========================================================================================================================
-    // Methods
-    // ===========================================================================================================================
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.net.Authenticator#getPasswordAuthentication()
-     */
-    @Override
-    protected PasswordAuthentication getPasswordAuthentication() {
-        Server server = ServerManager.getCurrentServer();
-        String password = ((server.getPassword() == null) ? "" : server.getPassword()); //$NON-NLS-1$
-        return new PasswordAuthentication(server.getUser(), password.toCharArray());
-    }
-
-}

Modified: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java	2009-10-02 17:03:04 UTC (rev 1281)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java	2009-10-02 17:05:21 UTC (rev 1282)
@@ -98,29 +98,6 @@
     private static final String USER_TAG = "user"; //$NON-NLS-1$
 
     // ===========================================================================================================================
-    // Class Fields
-    // ===========================================================================================================================
-
-    /**
-     * The java.net.Authenticator needs server information to complete the publish, unpublish, getRepositories(), and
-     * getWorkspaces() operations. Setting a thread variable was a way to do that.
-     * 
-     * @see ServerAuthenticator
-     */
-    private static ThreadLocal<Server> currentServer = new ThreadLocal<Server>();
-
-    // ===========================================================================================================================
-    // Class Methods
-    // ===========================================================================================================================
-
-    /**
-     * @return the server set on the current thread or <code>null</code>
-     */
-    public static Server getCurrentServer() {
-        return ServerManager.currentServer.get();
-    }
-
-    // ===========================================================================================================================
     // Fields
     // ===========================================================================================================================
 
@@ -275,7 +252,6 @@
             this.serverLock.readLock().lock();
 
             if (isRegistered(server)) {
-                ServerManager.currentServer.set(server);
                 Collection<Repository> repositories = this.delegate.getRepositories(server);
                 return Collections.unmodifiableCollection(new ArrayList<Repository>(repositories));
             }
@@ -313,7 +289,6 @@
             this.serverLock.readLock().lock();
 
             if (isRegistered(repository.getServer())) {
-                ServerManager.currentServer.set(repository.getServer());
                 Collection<Workspace> workspaces = this.delegate.getWorkspaces(repository);
                 return Collections.unmodifiableCollection(new ArrayList<Workspace>(workspaces));
             }
@@ -482,11 +457,10 @@
         CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
 
         try {
-            ServerManager.currentServer.set(server);
             this.delegate.getRepositories(server);
             return new Status(Severity.OK, RestClientI18n.serverManagerConnectionEstablishedMsg.text(), null);
         } catch (Exception e) {
-            return new Status(Severity.ERROR, RestClientI18n.serverManagerConnectionFailedMsg.text(), null);
+            return new Status(Severity.ERROR, RestClientI18n.serverManagerConnectionFailedMsg.text(e), null);
         }
     }
 
@@ -509,7 +483,6 @@
         Server server = workspace.getServer();
 
         if (isRegistered(server)) {
-            ServerManager.currentServer.set(server);
             return this.delegate.publish(workspace, path, file);
         }
 
@@ -652,7 +625,6 @@
         Server server = workspace.getServer();
 
         if (isRegistered(server)) {
-            ServerManager.currentServer.set(server);
             return this.delegate.unpublish(workspace, path, file);
         }
 

Modified: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpClientConnection.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpClientConnection.java	2009-10-02 17:03:04 UTC (rev 1281)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpClientConnection.java	2009-10-02 17:05:21 UTC (rev 1282)
@@ -23,6 +23,7 @@
  */
 package org.jboss.dna.web.jcr.rest.client.http;
 
+import static org.jboss.dna.web.jcr.rest.client.RestClientI18n.unknownHttpRequestMethodMsg;
 import java.net.URL;
 import javax.ws.rs.core.MediaType;
 import org.apache.http.HttpResponse;
@@ -38,13 +39,14 @@
 import org.apache.http.impl.client.AbstractHttpClient;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.util.EntityUtils;
+import org.jboss.dna.common.util.CheckArg;
 import org.jboss.dna.web.jcr.rest.client.domain.Server;
 import org.jboss.dna.web.jcr.rest.client.json.IJsonConstants.RequestMethod;
 
 /**
- * <code>HttpClientConnection</code> is an <code>Apache HttpClient</code> implementation of <code>IHttpConnection</code>.
+ * <code>HttpClientConnection</code> uses the <code>Apache HttpClient</code>.
  */
-public final class HttpClientConnection implements IHttpConnection {
+public final class HttpClientConnection {
 
     // ===========================================================================================================================
     // Fields
@@ -70,14 +72,18 @@
     // ===========================================================================================================================
 
     /**
-     * @param server the server with the host and port information
-     * @param url the URL that will be used in the request
-     * @param method the HTTP request method
+     * @param server the server with the host and port information (never <code>null</code>)
+     * @param url the URL that will be used in the request (never <code>null</code>)
+     * @param method the HTTP request method (never <code>null</code>)
      * @throws Exception if there is a problem establishing the connection
      */
     public HttpClientConnection( Server server,
                                  URL url,
                                  RequestMethod method ) throws Exception {
+        CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
+        CheckArg.isNotNull(url, "url"); //$NON-NLS-1$
+        CheckArg.isNotNull(method, "method"); //$NON-NLS-1$
+
         this.httpClient = new DefaultHttpClient();
         this.httpClient.getCredentialsProvider().setCredentials(new AuthScope(url.getHost(), url.getPort()),
                                                                 new UsernamePasswordCredentials(server.getUser(),
@@ -92,8 +98,7 @@
         } else if (RequestMethod.PUT == method) {
             this.request = new HttpPut();
         } else {
-            // TODO need exception message
-            throw new RuntimeException();
+            throw new RuntimeException(unknownHttpRequestMethodMsg.text(method));
         }
 
         // set request URI
@@ -105,9 +110,7 @@
     // ===========================================================================================================================
 
     /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#disconnect()
+     * Disconnects this connection.
      */
     public void disconnect() {
         this.httpClient.getConnectionManager().shutdown();
@@ -126,29 +129,28 @@
     }
 
     /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#getResponseCode()
+     * @return the HTTP response code
+     * @throws Exception if there is a problem getting the response code
      */
     public int getResponseCode() throws Exception {
         return getResponse().getStatusLine().getStatusCode();
     }
 
     /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#read()
+     * @return the HTTP response body as a string
+     * @throws Exception if there is a problem reading from the connection
      */
     public String read() throws Exception {
         return EntityUtils.toString(getResponse().getEntity());
     }
 
     /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#write(byte[])
+     * @param bytes the bytes being posted to the HTTP connection (never <code>null</code>)
+     * @throws Exception if there is a problem writing to the connection
      */
     public void write( byte[] bytes ) throws Exception {
+        CheckArg.isNotNull(bytes, "bytes"); //$NON-NLS-1$
+
         ByteArrayEntity entity = new ByteArrayEntity(bytes);
         entity.setContentType(MediaType.APPLICATION_JSON);
 

Deleted: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpUrlConnection.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpUrlConnection.java	2009-10-02 17:03:04 UTC (rev 1281)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/HttpUrlConnection.java	2009-10-02 17:05:21 UTC (rev 1282)
@@ -1,124 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client.http;
-
-import java.net.Authenticator;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import javax.ws.rs.core.MediaType;
-import org.jboss.dna.common.util.Base64;
-import org.jboss.dna.web.jcr.rest.client.ServerAuthenticator;
-import org.jboss.dna.web.jcr.rest.client.domain.Server;
-import org.jboss.dna.web.jcr.rest.client.json.JsonUtils;
-import org.jboss.dna.web.jcr.rest.client.json.IJsonConstants.RequestMethod;
-
-/**
- * <code>HttpUrlConnection</code> is a <code>java.net</code> implementation of <code>IHttpConnection</code>.
- */
-public final class HttpUrlConnection implements IHttpConnection {
-
-    // ===========================================================================================================================
-    // Class Initializer
-    // ===========================================================================================================================
-
-    static {
-        // must be set when using java.net framework but a problem occurs when other subsytems have their own Authenticator and
-        // also call this method
-        Authenticator.setDefault(new ServerAuthenticator());
-    }
-
-    // ===========================================================================================================================
-    // Fields
-    // ===========================================================================================================================
-
-    /**
-     * The HTTP connection that executes the request and obtains the response.
-     */
-    private final HttpURLConnection connection;
-
-    // ===========================================================================================================================
-    // Constructors
-    // ===========================================================================================================================
-
-    /**
-     * @param server the server with the host and port information
-     * @param url the URL that will be used in the request
-     * @param method the HTTP request method
-     * @throws Exception if there is a problem establishing the connection
-     */
-    public HttpUrlConnection( Server server,
-                              URL url,
-                              RequestMethod method ) throws Exception {
-        this.connection = (HttpURLConnection)url.openConnection();
-        this.connection.setDoOutput(true);
-
-        String encoding = Base64.encodeBytes((server.getUser() + ':' + server.getPassword()).getBytes());
-        this.connection.setRequestProperty("Authorization", "Basic " + encoding); //$NON-NLS-1$ //$NON-NLS-2$
-
-        this.connection.setRequestMethod(method.toString());
-        this.connection.setRequestProperty("Content-Type", MediaType.APPLICATION_JSON); //$NON-NLS-1$
-        this.connection.setUseCaches(false);
-    }
-
-    // ===========================================================================================================================
-    // Methods
-    // ===========================================================================================================================
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#disconnect()
-     */
-    public void disconnect() {
-        this.connection.disconnect();
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#getResponseCode()
-     */
-    public int getResponseCode() throws Exception {
-        return this.connection.getResponseCode();
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#read()
-     */
-    public String read() throws Exception {
-        return JsonUtils.readInputStream(this.connection);
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.web.jcr.rest.client.http.IHttpConnection#write(byte[])
-     */
-    public void write( byte[] bytes ) throws Exception {
-        connection.getOutputStream().write(bytes);
-    }
-
-}

Deleted: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/IHttpConnection.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/IHttpConnection.java	2009-10-02 17:03:04 UTC (rev 1281)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/http/IHttpConnection.java	2009-10-02 17:05:21 UTC (rev 1282)
@@ -1,55 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client.http;
-
-/**
- * The <code>IHttpConnection</code> is the contract for all HTTP connection frameworks must implement to work with the DNA REST
- * server.
- */
-public interface IHttpConnection {
-
-    /**
-     * Disconnects this connection.
-     */
-    void disconnect();
-
-    /**
-     * @return the HTTP response code
-     * @throws Exception if there is a problem getting the response code
-     */
-    int getResponseCode() throws Exception;
-
-    /**
-     * @return the HTTP response body as a string
-     * @throws Exception if there is a problem reading from the connection
-     */
-    String read() throws Exception;
-
-    /**
-     * @param bytes the bytes being posted to the HTTP connection
-     * @throws Exception if there is a problem writing to the connection
-     */
-    void write( byte[] bytes ) throws Exception;
-
-}

Modified: trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java	2009-10-02 17:03:04 UTC (rev 1281)
+++ trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java	2009-10-02 17:05:21 UTC (rev 1282)
@@ -37,7 +37,6 @@
 import org.jboss.dna.web.jcr.rest.client.domain.Server;
 import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
 import org.jboss.dna.web.jcr.rest.client.http.HttpClientConnection;
-import org.jboss.dna.web.jcr.rest.client.http.IHttpConnection;
 import org.jboss.dna.web.jcr.rest.client.json.IJsonConstants.RequestMethod;
 
 /**
@@ -66,11 +65,10 @@
      * @return the connection which <strong>MUST</strong> be disconnected
      * @throws Exception if there is a problem establishing the connection
      */
-    private IHttpConnection connect( Server server,
-                                     URL url,
-                                     RequestMethod method ) throws Exception {
+    private HttpClientConnection connect( Server server,
+                                          URL url,
+                                          RequestMethod method ) throws Exception {
         this.logger.trace("connect: url={0}, method={1}", url, method); //$NON-NLS-1$
-        // return new HttpUrlConnection(server, url, method);
         return new HttpClientConnection(server, url, method);
     }
 
@@ -87,7 +85,7 @@
                                  File file ) throws Exception {
         this.logger.trace("createFileNode: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); //$NON-NLS-1$
         FileNode fileNode = new FileNode(workspace, path, file);
-        IHttpConnection connection = connect(workspace.getServer(), fileNode.getUrl(), RequestMethod.POST);
+        HttpClientConnection connection = connect(workspace.getServer(), fileNode.getUrl(), RequestMethod.POST);
 
         try {
             this.logger.trace("createFileNode: create node={0}", fileNode); //$NON-NLS-1$
@@ -122,7 +120,7 @@
                                    String path ) throws Exception {
         this.logger.trace("createFolderNode: workspace={0}, path={1}", workspace.getName(), path); //$NON-NLS-1$
         FolderNode folderNode = new FolderNode(workspace, path);
-        IHttpConnection connection = connect(workspace.getServer(), folderNode.getUrl(), RequestMethod.POST);
+        HttpClientConnection connection = connect(workspace.getServer(), folderNode.getUrl(), RequestMethod.POST);
 
         try {
             this.logger.trace("createFolderNode: create node={0}", folderNode); //$NON-NLS-1$
@@ -194,7 +192,7 @@
         this.logger.trace("getRepositories: server={0}", server); //$NON-NLS-1$
 
         ServerNode serverNode = new ServerNode(server);
-        IHttpConnection connection = connect(server, serverNode.getFindRepositoriesUrl(), RequestMethod.GET);
+        HttpClientConnection connection = connect(server, serverNode.getFindRepositoriesUrl(), RequestMethod.GET);
 
         try {
             if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
@@ -244,7 +242,7 @@
         this.logger.trace("getWorkspaces: repository={0}", repository); //$NON-NLS-1$
 
         RepositoryNode repositoryNode = new RepositoryNode(repository);
-        IHttpConnection connection = connect(repository.getServer(), repositoryNode.getUrl(), RequestMethod.GET);
+        HttpClientConnection connection = connect(repository.getServer(), repositoryNode.getUrl(), RequestMethod.GET);
 
         try {
             if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
@@ -278,7 +276,7 @@
                             String path,
                             File file ) throws Exception {
         FileNode fileNode = new FileNode(workspace, path, file);
-        IHttpConnection connection = connect(workspace.getServer(), fileNode.getFileContentsUrl(), RequestMethod.GET);
+        HttpClientConnection connection = connect(workspace.getServer(), fileNode.getFileContentsUrl(), RequestMethod.GET);
         int responseCode = connection.getResponseCode();
 
         if (responseCode == HttpURLConnection.HTTP_OK) {
@@ -298,7 +296,7 @@
     private boolean pathExists( Server server,
                                 URL url ) throws Exception {
         this.logger.trace("pathExists: url={0}", url); //$NON-NLS-1$
-        IHttpConnection connection = connect(server, url, RequestMethod.GET);
+        HttpClientConnection connection = connect(server, url, RequestMethod.GET);
 
         try {
             int responseCode = connection.getResponseCode();
@@ -373,7 +371,7 @@
         CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
         this.logger.trace("unpublish: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); //$NON-NLS-1$
 
-        IHttpConnection connection = null;
+        HttpClientConnection connection = null;
 
         try {
             FileNode fileNode = new FileNode(workspace, path, file);

Modified: trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
===================================================================
--- trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties	2009-10-02 17:03:04 UTC (rev 1281)
+++ trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties	2009-10-02 17:05:21 UTC (rev 1282)
@@ -38,7 +38,7 @@
 serverShortDescription = DNA Server - URL: {0} User: {1}
 
 serverManagerConnectionEstablishedMsg = Connection established.
-serverManagerConnectionFailedMsg = Connection failed.
+serverManagerConnectionFailedMsg = Connection failed. Error Message: {0}
 serverManagerRegistryAddUnexpectedError = Unexpected error adding server to registry
 serverManagerRegistryListenerError = This error was reported by an IServerRegistryListener
 serverManagerRegistryListenerErrorsOccurred = Errors occurred processing a server registry event. Check error log for more details.
@@ -47,6 +47,8 @@
 serverManagerRegistryUpdateRemoveError = There was an unexpected error updating the server in the registry. The server has not been updated in the server registry. Detail: {0}
 serverManagerUnregisteredServer = Server "{0}" is not registered so it's repositories and workspaces cannot be obtained and it cannot be involved in a publishing operation.
 
+unknownHttpRequestMethodMsg = The "{0}" HTTP request method is not valid.
+
 workspaceEmptyNameMsg = A workspace name cannot be empty
 workspaceNullRepositoryMsg = A workspace repository cannot be null
 workspaceShortDescription = DNA Workspace - Name: {0}, Repository: {1}



More information about the dna-commits mailing list