Hi all,
I'm noticing odd/broken behaviour with the Directory restlet under 1.1m3 and
the current snapshot build. I'm using the following code:
public static void main(String[] args) throws Exception {
// Create a container
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
// Create an application
Application application = new Application() {
@Override
public Restlet createRoot() {
Directory directory = new Directory(getContext(),
"file:///home/amrk/temp/admin/admin/");
// directory.setNegotiateContent(false);
return directory;
}
};
//application.getTunnelService().setExtensionsTunnel(false);
component.getDefaultHost().attachDefault(application);
// Attach the application to the container and start it
try {
component.start();
} catch (Exception ex) {
System.err.println("Start error " + ex.toString());
ex.printStackTrace();
}
}
>From what I gather, this -should- work. Reading elsewhere in the list
archives [1] I found references to the newly added content negotiation code
which was causing similar issues with Directory, and mentioned in various
posts I've tried both setExtensionsTunnel(false) and also
setNegotiateContent(false) to no success.
>From the logs I see:
INFO: 2008-05-02 12:36:59 127.0.0.1 - 127.0.0.1 8182
GET /index.html - 404 330 - 76 http://localhost:8182
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9pre) Gecko/2008050104
Minefield/3.0pre -
2/05/2008 12:37:01
com.noelios.restlet.application.ApplicationClientDispatcher parentHandle
WARNING: Your Application doesn't have a parent context available. Ensure
that your parent Component has a context available.
2/05/2008 12:37:01
com.noelios.restlet.application.ApplicationClientDispatcher parentHandle
WARNING: Your Application doesn't have a parent context available. Ensure
that your parent Component has a context available.
2/05/2008 12:37:01
com.noelios.restlet.application.ApplicationClientDispatcher parentHandle
WARNING: Your Application doesn't have a parent context available. Ensure
that your parent Component has a context available.
2/05/2008 12:37:01 com.noelios.restlet.local.DirectoryResource getVariants
INFO: Getting variants for : file:///home/amrk/temp/admin/admin/index.html
2/05/2008 12:37:01 com.noelios.restlet.local.DirectoryResource <init>
INFO: Converted target URI: file:///home/amrk/temp/admin/admin/index.html
2/05/2008 12:37:01 com.noelios.restlet.local.DirectoryResource <init>
INFO: Converted base name : index
Am I missing something simple and obvious?
Thanks in advance,
Mark
--
"It is easier to optimize correct code than to correct optimized code." --
Bill Harlan