I have a restlet application being packaged inside an ear and deployed to 
jboss. I have
some simple resources working fine and printing output over http in a browser.
Now, I'm trying to add a Directory resource to the application as part of my 
testing.
The first time I tried this I got errors like:
WARNING: The protocol used by this request is not declared in the list of client
connectors. (FILE)
I'm not sure how to get to the Component that controls access to the router and application, so I tried adding:

this.getConnectorService().getClientProtocols().add(Protocol.FILE);

In the constructor of my Application, but now I get:

11:36:00,875 ERROR [STDERR] Oct 21, 2008 11:36:00 AM com.noelios.restlet.component.ComponentHelper checkVirtualHost
SEVERE: Unable to start the application "null". Client connector for protocol 
FILE is missing.
11:36:00,875 ERROR [STDERR] Oct 21, 2008 11:36:00 AM 
com.noelios.restlet.ChainHelper handle
SEVERE: The org.restlet.Component class has no Restlet defined to process calls. Maybe it wasn't properly started.

is it possible to browse a file directory with a web browser using this 
configuration?

Here is my test application code:

public class TestApplication extends Application {
        
        public TestApplication(Context context){
                super(context);
                
this.getConnectorService().getClientProtocols().add(Protocol.FILE);
        }
        
    /**
     * Creates a root Restlet that will receive all incoming calls.
     */
    @Override
    public synchronized Restlet createRoot() {
        // Create a router Restlet that routes each call to a
        // new instance of HelloWorldResource.
        Router router = new Router(getContext());
        //System.out.println("Router: " + router.toString());

        // Create an application
        Application application = new Application(getContext()) {
            @Override
            public Restlet createRoot() {
                Directory directory = new Directory(getContext(), 
"file:///c:/");
                directory.setListingAllowed(true);
                //System.out.println("Directory: " + directory.toString());
                return directory;
            }
        };


        // Defines only one route


        router.attach("/policies", InsuredPolicyResource.class);
        router.attach("/vehicles", VehicleResource.class);
        router.attach("/garages", GarageResource.class);
        router.attach("/files", application);

        return router;
    }

}

Thank you all for your time,
Brian Williams

--
Brian E. Williams
Senior Application Developer

The Archer Group
http://www.archer-group.com

Reply via email to