I'm surprised by some behavior I'm seeing. I ran a slightly modified version of
Part06.java that looks like this:
public class Part06 implements Constants {
public static final String ROOT_URI =
"file:////home/slandis/restlet-1.0rc3/docs/api/";
public static void main(String[] args) throws Exception {
// Create a component
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
component.getClients().add(Protocol.FILE);
// Create an application
Application application = new Application(component.getContext()) {
@Override
public Restlet createRoot() {
return new Directory(getContext(), ROOT_URI);
}
};
// Attach the application to the component and start it
component.getDefaultHost().attach("", application);
component.start();
}
}
And if I use "http://localhost:8182" then the javadoc is correctly displayed.
I modified the last bit to create a virtual host instead using the
default host:
// Attach the application to the component and start it
VirtualHost vh1 = new VirtualHost(component.getContext());
vh1.setHostDomain("localhost");
vh1.attach("/docs/", application);
component.getHosts().add(vh1);
component.start();
And it works fine for "http://localhost:8182/docs/" but does not resolve
"http://localhost:8182/docs" which I would expect.
Next I change the route URI in the attach() like this:
vh1.attach("/docs", application);
and now "http://localhost:8182/docs/" works but "http://localhost:8182/docs"
diplays the frames but within the three frames says:
The server has not found anything matching the request URI
You can get technical details here.
Please continue your visit at our home page.
I flushed my cache before each test ;-)
I would have expected the final case to have "http://localhost:8182/docs"
work and ".../docs/" not work. I'm surprised that the URI is interacting
strangely and I don't know if it's the virtual host or Directory, or both.
Sean