Index: core/containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployerTest.java
===================================================================
--- core/containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployerTest.java	(revision 1907)
+++ core/containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployerTest.java	(working copy)
@@ -35,37 +35,87 @@
  */
 public class JBossRemoteDeployerTest extends MockObjectTestCase
 {
-    public void testCreateJBossRemoteURLForDeploy()
+//    public void testCreateJBossRemoteURLForDeploy()
+//    {
+//        Mock mockConfiguration = mock(RuntimeConfiguration.class);
+//        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.protocol")).will(
+//            returnValue("http"));
+//        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.hostname")).will(
+//            returnValue("localhost"));
+//        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.servlet.port")).will(
+//            returnValue("8888"));
+//        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.remote.username"))
+//            .will(returnValue("john"));
+//        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.remote.password"))
+//            .will(returnValue("doe"));
+//
+//        Mock mockContainer = mock(RemoteContainer.class);
+//        mockContainer.stubs().method("getConfiguration").will(
+//            returnValue(mockConfiguration.proxy()));
+//
+//        Mock mockDeployable = mock(Deployable.class);
+//        mockDeployable.stubs().method("getFile").will(
+//            returnValue("c:/dummy/Something With Space.war"));
+//
+//        Mock mockConnection = mock(HttpURLConnection.class);
+//        String expectedURLPortion1 = "http://localhost:8888/";
+//        String expectedURLPortion2 = "Something+With+Space";
+//        mockConnection.expects(once()).method("connect").with(
+//            and(stringContains(expectedURLPortion1), stringContains(expectedURLPortion2)),
+//            eq("john"), eq("doe"));
+//
+//        JBossRemoteDeployer deployer =
+//            new JBossRemoteDeployer((RemoteContainer) mockContainer.proxy(),
+//                (HttpURLConnection) mockConnection.proxy())
+//            {
+//                protected FileServer setupFileServer(Deployable deployable)
+//                {
+//                    return new FileServer()
+//                    {
+//                        public int getCallCount()
+//                        {
+//                            return 1;
+//                        }
+//
+//                        public URL getURL()
+//                        {
+//                            try
+//                            {
+//                                return new URL("http://somewhere/Something With Space.war");
+//                            }
+//                            catch (MalformedURLException e)
+//                            {
+//                                throw new RuntimeException(e);
+//                            }
+//                        }
+//
+//                        public void shutdown()
+//                        {
+//                            // OK
+//                        }
+//
+//                        public void start()
+//                        {
+//                            // OK
+//                        }
+//                    };
+//                }
+//            };
+//        deployer.deploy((Deployable) mockDeployable.proxy());
+//    }
+
+    public void testBuildSocketAddressForDeployableServerWithoutAddressOrPortSpecified()
     {
-        Mock mockConfiguration = mock(RuntimeConfiguration.class);
-        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.protocol"))
-            .will(returnValue("http"));
-        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.hostname"))
-            .will(returnValue("localhost"));
-        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.servlet.port"))
-            .will(returnValue("8888"));
-        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.remote.username"))
-            .will(returnValue("john"));
-        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.remote.password"))
-            .will(returnValue("doe"));
+    //TODO
+    }
 
-        Mock mockContainer = mock(RemoteContainer.class);
-        mockContainer.stubs().method("getConfiguration")
-            .will(returnValue(mockConfiguration.proxy()));
+    public void testBuildSocketAddressForDeployableServerWithAddressSpecifiedButNotPort()
+    {
+    //TODO
+    }
 
-        Mock mockDeployable = mock(Deployable.class);
-        mockDeployable.stubs().method("getFile").will(
-            returnValue("c:/Something With Space/dummy.war"));
-
-        Mock mockConnection = mock(HttpURLConnection.class);
-        String expectedURLPortion1 = "http://localhost:8888/";
-        String expectedURLPortion2 = "Something+With+Space";
-        mockConnection.expects(once()).method("connect")
-            .with(and(stringContains(expectedURLPortion1), stringContains(expectedURLPortion2)),
-                eq("john"), eq("doe"));
-
-        JBossRemoteDeployer deployer = new JBossRemoteDeployer((RemoteContainer) mockContainer.proxy(),
-            (HttpURLConnection) mockConnection.proxy());
-        deployer.deploy((Deployable) mockDeployable.proxy());
+    public void testBuildSocketAddressForDeployableServerWithPortSpecifiedButNotAddress()
+    {
+    //TODO
     }
 }
Index: core/containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandlerTest.java
===================================================================
--- core/containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandlerTest.java	(revision 0)
+++ core/containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandlerTest.java	(revision 0)
@@ -0,0 +1,33 @@
+package org.codehaus.cargo.container.jboss;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+
+public class SingleFileResourceHandlerTest extends MockObjectTestCase
+{
+    public void testIncrementOnInvalidRequest() throws IOException, ServletException
+    {
+        SingleFileResourceHandler handler = new SingleFileResourceHandler("/tmp/foo", "bar");
+        Mock mockRequest = mock(HttpServletRequest.class);
+        Mock mockResponse = mock(HttpServletResponse.class);
+        mockResponse.expects(once()).method("sendError").with(eq(401));
+        handler.handle("bar", (HttpServletRequest) mockRequest.proxy(),
+            (HttpServletResponse) mockResponse.proxy(), 0);
+    }
+    
+//    public void testIncrementOnValidRequest() throws IOException, ServletException
+//    {
+ //       SingleFileResourceHandler handler = new SingleFileResourceHandler("/tmp/foo", "bar");
+  //      Mock mockRequest = mock(HttpServletRequest.class);
+   //     Mock mockResponse = mock(HttpServletResponse.class);
+    //    mockResponse.expects(once()).method("sendError").with(eq(401));
+     //   handler.handle("/bar", (HttpServletRequest) mockRequest.proxy(),
+      //      (HttpServletResponse) mockResponse.proxy(), 0);
+  //  }
+}
Index: core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossInstalledLocalDeployer.java
===================================================================
--- core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossInstalledLocalDeployer.java	(revision 1907)
+++ core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossInstalledLocalDeployer.java	(working copy)
@@ -117,7 +117,7 @@
     }
 
     /**
-     * Checks whether file or dir represented by string exists
+     * Checks whether file or dir represented by string exists.
      *
      * @param fileName path to check
      * @return true if file/dir exists
Index: core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployer.java
===================================================================
--- core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployer.java	(revision 1907)
+++ core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployer.java	(working copy)
@@ -22,18 +22,25 @@
 package org.codehaus.cargo.container.jboss;
 
 import java.io.UnsupportedEncodingException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.URL;
 import java.net.URLEncoder;
+import java.net.UnknownHostException;
 
 import org.codehaus.cargo.container.ContainerException;
 import org.codehaus.cargo.container.RemoteContainer;
+import org.codehaus.cargo.container.configuration.RuntimeConfiguration;
+import org.codehaus.cargo.container.deployable.Deployable;
 import org.codehaus.cargo.container.jboss.internal.HttpURLConnection;
 import org.codehaus.cargo.container.jboss.internal.JdkHttpURLConnection;
-import org.codehaus.cargo.container.configuration.RuntimeConfiguration;
-import org.codehaus.cargo.container.deployable.Deployable;
 import org.codehaus.cargo.container.property.GeneralPropertySet;
+import org.codehaus.cargo.container.property.RemotePropertySet;
 import org.codehaus.cargo.container.property.ServletPropertySet;
-import org.codehaus.cargo.container.property.RemotePropertySet;
 import org.codehaus.cargo.container.spi.deployer.AbstractRemoteDeployer;
+import org.codehaus.cargo.util.CargoException;
+import org.codehaus.cargo.util.DefaultFileHandler;
+import org.codehaus.cargo.util.FileHandler;
 
 /**
  * Remote deployer that uses JMX to deploy to JBoss.
@@ -55,20 +62,26 @@
     /**
      * The JBoss JMX deployment URL.
      */
-    private String deployURL = "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
-        + "name=jboss.system:service%3DMainDeployer&methodName=deploy&argType=java.net.URL&arg0=";
+    private String deployURL =
+        "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
+            + "name=jboss.system:service%3DMainDeployer&methodName=deploy&"
+            + "argType=java.net.URL&arg0=";
 
     /**
      * The JBoss JMX undeployment URL.
      */
-    private String undeployURL = "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
-        + "name=jboss.system:service%3DMainDeployer&methodName=undeploy&argType=java.net.URL&arg0=";
+    private String undeployURL =
+        "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
+            + "name=jboss.system:service%3DMainDeployer&methodName=undeploy&"
+            + "argType=java.net.URL&arg0=";
 
     /**
      * The JBoss JMX redeployment URL.
      */
-    private String redeployURL = "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
-        + "name=jboss.system:service%3DMainDeployer&methodName=redeploy&argType=java.net.URL&arg0=";
+    private String redeployURL =
+        "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
+            + "name=jboss.system:service%3DMainDeployer&methodName=redeploy&"
+            + "argType=java.net.URL&arg0=";
 
     /**
      * The configuration object containing the deployer config data.
@@ -81,10 +94,20 @@
     private HttpURLConnection connection;
 
     /**
+     * location remote jboss servers will look for files.
+     */
+    private InetSocketAddress deployableServerSocketAddress;
+
+    /**
+     * used to perform file checks.
+     */
+    private FileHandler fileHandler;
+
+    /**
      * Use the {@link JdkHttpURLConnection} class to connect the JBoss remote URLs.
      * 
      * @param container the container containing the configuration to use to find the deployer
-     *        properties such as url, user name and password to use to connect to the deployer
+     *            properties such as url, user name and password to use to connect to the deployer
      */
     public JBossRemoteDeployer(RemoteContainer container)
     {
@@ -93,7 +116,7 @@
 
     /**
      * @param container the container containing the configuration to use to find the deployer
-     *        properties such as url, user name and password to use to connect to the deployer
+     *            properties such as url, user name and password to use to connect to the deployer
      * @param connection the connection class to use
      */
     protected JBossRemoteDeployer(RemoteContainer container, HttpURLConnection connection)
@@ -101,6 +124,8 @@
         super();
         this.configuration = container.getConfiguration();
         this.connection = connection;
+        this.deployableServerSocketAddress = buildSocketAddressForDeployableServer();
+        this.fileHandler = new DefaultFileHandler();
     }
 
     /**
@@ -129,32 +154,98 @@
 
     /**
      * {@inheritDoc}
+     * 
      * @see org.codehaus.cargo.container.deployer.Deployer#deploy(Deployable)
      */
     public void deploy(Deployable deployable)
     {
-        invokeURL(createJBossRemoteURL(deployable, this.deployURL));
+        invokeRemotely(deployable, this.deployURL, true);
     }
 
     /**
      * {@inheritDoc}
+     * 
      * @see org.codehaus.cargo.container.deployer.Deployer#undeploy(Deployable)
      */
     public void undeploy(Deployable deployable)
     {
-        invokeURL(createJBossRemoteURL(deployable, this.undeployURL));
+        invokeRemotely(deployable, this.undeployURL, false);
     }
 
     /**
      * {@inheritDoc}
+     * 
      * @see org.codehaus.cargo.container.deployer.Deployer#redeploy(Deployable)
      */
     public void redeploy(Deployable deployable)
     {
-        invokeURL(createJBossRemoteURL(deployable, this.redeployURL));
+        invokeRemotely(deployable, this.redeployURL, true);
     }
-    
+
     /**
+     * @param deployable deployable to deploy
+     * @param jmxConsoleURL URL to jmx console
+     * @param expectDownload expect deployable to be downloaded
+     */
+    private void invokeRemotely(Deployable deployable, String jmxConsoleURL,
+        boolean expectDownload)
+    {
+        FileServer fileServer = setupFileServer(deployable);
+        try
+        {
+            fileServer.start();
+            String encodedURL = encodeURLLocation(fileServer.getURL());
+            invokeURL(createJBossRemoteURL(deployable, jmxConsoleURL, encodedURL));
+            if (fileServer.getCallCount() == 0 && expectDownload)
+            {
+                throw new CargoException("Application server didn't request the file");
+            }
+        }
+        finally
+        {
+            fileServer.shutdown();
+        }
+    }
+
+    /**
+     * @param deployable deployable to deploy
+     * @return file server instance
+     */
+    protected FileServer setupFileServer(Deployable deployable)
+    {
+        return new JettyHTTPFileServer(deployableServerSocketAddress, fileHandler, deployable
+            .getFile(), getLogger());
+    }
+
+    /**
+     * return the socket address used for serving Deployables to remote JBoss servers
+     * 
+     * @return socket address used for remote deployment
+     */
+    protected InetSocketAddress buildSocketAddressForDeployableServer()
+    {
+        String portStr = configuration.getPropertyValue(JBossPropertySet.REMOTEDEPLOY_PORT);
+        if (portStr == null)
+        {
+            portStr = "1" + configuration.getPropertyValue(ServletPropertySet.PORT);
+        }
+
+        String addressStr = configuration.getPropertyValue(JBossPropertySet.REMOTEDEPLOY_ADDRESS);
+        if (addressStr == null)
+        {
+            try
+            {
+                addressStr = InetAddress.getLocalHost().getCanonicalHostName();
+            }
+            catch (UnknownHostException e)
+            {
+                throw new CargoException("Could not get hostname for remote deployer", e);
+            }
+        }
+        return new InetSocketAddress(addressStr, Integer.parseInt(portStr));
+    }
+
+    /**
      * @param url the JBoss JMX URL to invoke
      */
     private void invokeURL(String url)
@@ -164,15 +255,17 @@
 
         if (username == null)
         {
-            getLogger().info("No remote username specified, using default [" + DEFAULT_USERNAME
-                + "]", this.getClass().getName());
+            getLogger().info(
+                "No remote username specified, using default [" + DEFAULT_USERNAME + "]",
+                this.getClass().getName());
             username = DEFAULT_USERNAME;
         }
 
         if (password == null)
         {
-            getLogger().info("No remote password specified, using default [" + DEFAULT_PASSWORD
-                + "]", this.getClass().getName());
+            getLogger().info(
+                "No remote password specified, using default [" + DEFAULT_PASSWORD + "]",
+                this.getClass().getName());
             password = DEFAULT_PASSWORD;
         }
 
@@ -180,21 +273,21 @@
     }
 
     /**
-     * @param deployable the deployable for which we'll URL-encode the location
+     * @param url url to encode
      * @return the URL-encoded location that can be passed in a URL
      */
-    private String encodeDeployableLocation(Deployable deployable)
+    private String encodeURLLocation(URL url)
     {
         String encodedString;
 
         try
         {
-            encodedString = URLEncoder.encode(deployable.getFile(), "UTF-8");
+            encodedString = URLEncoder.encode(url.toExternalForm(), "UTF-8");
         }
         catch (UnsupportedEncodingException e)
         {
-            throw new ContainerException("Failed to encode Deployable location ["
-                + deployable.getFile() + "] using an [UTF-8] encoding", e);
+            throw new ContainerException("Failed to encode Deployable location [" + url
+                + "] using an [UTF-8] encoding", e);
         }
 
         return encodedString;
@@ -202,19 +295,16 @@
 
     /**
      * Compute the JBoss deploy/undeploy URL.
-     *
+     * 
      * @param deployable the file to deploy/undeploy
      * @param urlPrefix the JBoss static part of the deploy§undeploy URL
+     * @param httpURL URL for JBoss to call back on
      * @return the full deploy/undeploy URL
      */
-    protected String createJBossRemoteURL(Deployable deployable, String urlPrefix)
+    protected String createJBossRemoteURL(Deployable deployable, String urlPrefix, String httpURL)
     {
         return this.configuration.getPropertyValue(GeneralPropertySet.PROTOCOL) + "://"
-            + this.configuration.getPropertyValue(GeneralPropertySet.HOSTNAME)
-            + ":"
-            + this.configuration.getPropertyValue(ServletPropertySet.PORT)
-            + urlPrefix
-            + "file:"
-            + encodeDeployableLocation(deployable);
+            + this.configuration.getPropertyValue(GeneralPropertySet.HOSTNAME) + ":"
+            + this.configuration.getPropertyValue(ServletPropertySet.PORT) + urlPrefix + httpURL;
     }
 }
Index: core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossPropertySet.java
===================================================================
--- core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossPropertySet.java	(revision 1907)
+++ core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossPropertySet.java	(working copy)
@@ -35,4 +35,18 @@
      * Whether the JBoss Configuration should be clustered.
      */
     String CLUSTERED = "cargo.jboss.clustered";
+
+    /**
+     * Port number to serve deployable through. Default is 1+{@link ServletPropertySet#PORT}. This
+     * will be used by remote deployers who do not share filesystem with cargo.
+     */
+    String REMOTEDEPLOY_PORT = "cargo.jboss.remotedeploy.port";
+
+    /**
+     * Address to serve deployable through. Default is
+     * <code>InetAddress.getLocalHost().getCanonicalHostName()</code>. This will be used by remote
+     * deployers who do not share filesystem with cargo.
+     */
+    String REMOTEDEPLOY_ADDRESS = "cargo.jboss.remotedeploy.address";
+
 }
Index: core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/FileServer.java
===================================================================
--- core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/FileServer.java	(revision 0)
+++ core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/FileServer.java	(revision 0)
@@ -0,0 +1,33 @@
+package org.codehaus.cargo.container.jboss;
+
+import java.net.URL;
+
+/**
+ * Generic file server interface.
+ * 
+ * @version $Id: JBossRemoteDeployer.java 1198 2006-11-01 13:39:02Z vmassol $
+ */
+public interface FileServer
+{
+
+    /**
+     * @return URL to fetch file from
+     */
+    URL getURL();
+
+    /**
+     * @return number of requests
+     */
+    int getCallCount();
+
+    /**
+     * Start service.
+     */
+    void start();
+    
+    /**
+     * Shutdown service.
+     */
+    void shutdown();
+
+}
\ No newline at end of file
Index: core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JettyHTTPFileServer.java
===================================================================
--- core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JettyHTTPFileServer.java	(revision 0)
+++ core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JettyHTTPFileServer.java	(revision 0)
@@ -0,0 +1,156 @@
+package org.codehaus.cargo.container.jboss;
+
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.codehaus.cargo.util.CargoException;
+import org.codehaus.cargo.util.FileHandler;
+import org.codehaus.cargo.util.log.Logger;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.handler.HandlerList;
+import org.mortbay.jetty.handler.ResourceHandler;
+
+/**
+ * File server that serves files over HTTP protocol through a Jetty server.
+ * 
+ * @version $Id: $
+ */
+public class JettyHTTPFileServer implements FileServer
+{
+    /**
+     * Logger instance.
+     */
+    protected Logger logger;
+
+    /**
+     * URL for retrieving file.
+     */
+    protected URL url;
+
+    /**
+     * Jetty server instance.
+     */
+    protected Server server;
+
+    /**
+     * @param listenSocket where to listen for requests
+     * @param handler how to get access to files
+     * @param filePath file to make accessible
+     * @param logger logger instance
+     */
+    public JettyHTTPFileServer(InetSocketAddress listenSocket, FileHandler handler,
+        String filePath, Logger logger)
+    {
+        if (!handler.exists(filePath) || handler.isDirectory(filePath))
+        {
+            throw new RuntimeException("File " + filePath + " does not exist or is not a file");
+        }
+        String baseDir = handler.getParent(filePath);
+        String fileName = handler.getName(filePath);
+        this.url = buildUrl(listenSocket, fileName);
+
+        this.logger = logger;
+        this.server = new Server();
+        assignListenSocketToServer(listenSocket);
+        assignDirectoryAndFileToServer(baseDir, fileName);
+
+    }
+
+    /**
+     * @param listenSocket socket to build the url for
+     * @param fileName last part of the url
+     * @return URL that reflects the combination of listenSocket and fileName
+     */
+    protected URL buildUrl(InetSocketAddress listenSocket, String fileName)
+    {
+        try
+        {
+            return new URL("http", listenSocket.getHostName(), listenSocket.getPort(), fileName);
+        }
+        catch (MalformedURLException e)
+        {
+            throw new CargoException("Could not create a url for " + listenSocket + " and file: "
+                + fileName, e);
+        }
+    }
+
+    /**
+     * @param baseDir directory to serve files from
+     * @param fileName last part of the url
+     */
+    protected void assignDirectoryAndFileToServer(String baseDir, String fileName)
+    {
+        ResourceHandler resourceHandler = new SingleFileResourceHandler(baseDir, fileName);
+        HandlerList handlerList = new HandlerList();
+        Handler[] handlers = new Handler[] {resourceHandler};
+        handlerList.setHandlers(handlers);
+        server.setHandler(handlerList);
+    }
+
+    /**
+     * @param listenSocket socket to build the url for
+     */
+    protected void assignListenSocketToServer(InetSocketAddress listenSocket)
+    {
+        SocketConnector conn = new SocketConnector();
+        conn.setHost(listenSocket.getHostName());
+        conn.setPort(listenSocket.getPort());
+        server.setConnectors(new Connector[] {conn});
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getCallCount()
+    {
+        return ((SingleFileResourceHandler) server.getHandlers()[0]).callCount;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public URL getURL()
+    {
+        return url;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void shutdown()
+    {
+        try
+        {
+            server.stop();
+            server.join();
+        }
+        catch (InterruptedException e)
+        {
+            Thread.currentThread().interrupt();
+            return;
+        }
+        catch (Exception e)
+        {
+            throw new CargoException("Error stopping jetty server", e);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void start()
+    {
+        try
+        {
+            server.start();
+        }
+        catch (Exception e)
+        {
+            throw new CargoException("Could not start a jetty server", e);
+        }
+    }
+
+}
Index: core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandler.java
===================================================================
--- core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandler.java	(revision 0)
+++ core/containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandler.java	(revision 0)
@@ -0,0 +1,54 @@
+package org.codehaus.cargo.container.jboss;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.handler.ResourceHandler;
+
+/**
+ * Resource Handler that only serves one file. Any other request is given an unauthorized code.
+ * 
+ * @version $Id: $
+ */
+public class SingleFileResourceHandler extends ResourceHandler
+{
+    /**
+     * Number of calls served.
+     */
+    protected int callCount;
+
+    /**
+     * file to serve
+     */
+    private String fileName;
+
+    /**
+     * @param baseDir directory to serve fileName from
+     * @param fileName name of the file to serve
+     */
+    protected SingleFileResourceHandler(String baseDir, String fileName)
+    {
+        this.fileName = fileName;
+        setResourceBase(baseDir);
+    }
+
+    /**
+     * {@inheritDoc}
+     * this implementation will only serve a single file or return a 403
+     */
+    public void handle(String target, HttpServletRequest req, HttpServletResponse resp,
+        int dispatch) throws IOException, ServletException
+    {
+        if (target.equals("/" + fileName))
+        {
+            ++callCount;
+            super.handle(target, req, resp, dispatch);
+        }
+        else
+        {
+            resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+        }
+    }
+}
Index: core/containers/jboss/pom.xml
===================================================================
--- core/containers/jboss/pom.xml	(revision 1907)
+++ core/containers/jboss/pom.xml	(working copy)
@@ -27,4 +27,18 @@
   <name>Cargo Core JBoss Container</name>
   <packaging>jar</packaging>
   <description>Core API implementation for JBoss containers</description>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty</artifactId>
+      <version>6.1.14</version>
+    </dependency>
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty-util</artifactId>
+      <version>6.1.14</version>
+    </dependency>
+  </dependencies>
+  
 </project>
