Jerome Louvel <contact <at> noelios.com> writes:
>
>
> FYI, I've just checked in the changes proposed below in SVN.
>
> Thanks,
> Jerome
>
> > -----Message d'origine-----
> > De : Jerome Louvel
> > Envoyé : mardi 14 novembre 2006 20:27
> > À : discuss <at> restlet.tigris.org
> > Objet : RE: Client connectors and Applications
> >
> >
> > Sumit,
> >
> > The Application can declare which client and server protocols
> > it supports/needs via the Application.getConnectorService()
> > and related methods in ConnectorService.
> >
> > When an Application is started by the container, I will also
> > make sure that the necessary connectors are available,
> > otherwise log an error.
> >
> > Best regards,
> > Jerome
> >
Hi Jerome,
You mentioned above "When an Application is started by the container"... This
doesn't happen by default currently as far as I've seen. I have to override the
start() method in the Container to get this behavior. Following is the sample
application you can use to test this.
import java.io.*;
import org.restlet.*;
import org.restlet.data.*;
public class TestContainer {
public static void main(String[] args) throws Exception
{
Container container = new Container();
container.getServers().add(Protocol.HTTP, 8182);
container.getClients().add(Protocol.FILE);
// Create an application
Application application = new Application(container)
{
public Restlet createRoot()
{
Directory directory = new Directory(getContext(),
"file:///");
directory.setNegotiateContent(true);
return directory;
}
};
// Attach the application to the container and start it
container.getDefaultHost().attach("", application);
container.start();
System.out.println(application.isStarted());
}
}
Thanks for getting this checked in though. I really appreciate you being very
open to suggestions.
Sumit