Hello,
I'm a noob and I was able to use VirtualHost objects fine in version 1.1. Now I
started using 2.0 and VirtualHost won't work.
When I don't add a VirtualHost, here's an idea of how a request is handled:
Daemon Thread [Restlet-1638726193] (Suspended (breakpoint at line 77 in
HostRoute))
HostRoute.beforeHandle(Request, Response) line: 77
HostRoute(Filter).handle(Request, Response) line: 201
ServerRouter(Router).doHandle(Restlet, Request, Response) line: 495
ServerRouter(Router).handle(Request, Response) line: 735
StatusFilter(Filter).doHandle(Request, Response) line: 156
StatusFilter.doHandle(Request, Response) line: 154
StatusFilter(Filter).handle(Request, Response) line: 203
LogFilter(Filter).doHandle(Request, Response) line: 156
LogFilter(Filter).handle(Request, Response) line: 203
ComponentHelper(ChainHelper<T>).handle(Request, Response) line: 111
Component.handle(Request, Response) line: 390
Server.handle(Request, Response) line: 474
HttpServerHelper(BaseServerHelper).handle(Request, Response) line: 158
HttpServerHelper(BaseServerHelper).handleInbound(Response) line: 167
HttpServerHelper(BaseHelper<T>).handleNextInbound() line: 418
ServerConnection(Connection<T>).readMessages() line: 705
Controller$2.run() line: 95
ThreadPoolExecutor$Worker.runTask(Runnable) line: 886
ThreadPoolExecutor$Worker.run() line: 908
Thread.run() line: 637
When I add a VirtualHost, here's how a request is handled:
Daemon Thread [Restlet-1448851814] (Suspended)
VirtualHost$1(TemplateRoute).score(Request, Response) line: 243
RouteList.getBest(Request, Response, float) line: 96
VirtualHost(Router).getNext(Request, Response) line: 634
VirtualHost(Router).handle(Request, Response) line: 733
Server.handle(Request, Response) line: 474
HttpServerHelper(BaseServerHelper).handle(Request, Response) line: 158
HttpServerHelper(BaseServerHelper).handleInbound(Response) line: 167
HttpServerHelper(BaseHelper<T>).handleNextInbound() line: 418
ServerConnection(Connection<T>).readMessages() line: 705
Controller$2.run() line: 95
ThreadPoolExecutor$Worker.runTask(Runnable) line: 886
ThreadPoolExecutor$Worker.run() line: 908
Thread.run() line: 637
Note that component.handle() is bypassed when you add a VirtualHost.
I looked at the pattern matcher, and in the latter it was trying to match
"/path" to "http://host.com/path" and failing. I believe that was because
hostRef was empty string.
In the former, it matches "/path" with "/path" just fine.
I feel like the VirtualHost needs to be behind a HostRoute.
Is this a known problem, or am I doing something wrong and adding VirtualHost
instances to the component should work fine?
Thanks,
-Gazi
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2657932