Hello John, you can configure the logging (see http://wiki.restlet.org/docs_2.0/101-restlet.html), or you can also inherits your VirtualHost and override the "logRoute(Route route)" method.
best regards, Thierry Boileau > > Hi, Thierry- > > Thanks for taking a look at this. I have taken your sample code, and > I agree, it seems to work fine. I've been adding features to it to > try to get it to fail, but haven't been able to so far. I've also > been trying to disable stuff in my real app, to see if I can get it to > start working like the sample, but haven't gotten that to work, either. > > Is there a way to enable detailed logging in the routing code, so that > I can see which routes are being tested and which ones chosen? Maybe > if I can identify what routes are being tried/rejected, I can figure > out what I'm doing wrong. > > Thanks once again for your help! > > -------------------------------- > John Wismar > Architect - ALLDATA Technology Team > (916) 478-3296 > mailto:[email protected] > "Dedicated to technology leadership and innovation." > > > Thierry Boileau <[email protected]> wrote on 09/11/2009 > 12:40:45 AM: > > > [image removed] > > > > Re: Problem routing using VirtualHosts and differentiating on Port > number > > > > Thierry Boileau > > > > to: > > > > discuss > > > > 09/11/2009 12:40 AM > > > > Please respond to discuss > > > > Hello John, > > > > I send you a sample code that works for me (with current trunk of > > Restlet and HttpClient 3.1). Could you run it, and maybe send a > > reproductible test? > > > > Best regards, > > Thierry Boileau > > ------------------------------------------------------ > > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2393547 > > <http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2393547> > > package virtualHosts; > > > > import org.apache.commons.httpclient.HttpClient; > > import org.apache.commons.httpclient.HttpMethod; > > import org.apache.commons.httpclient.methods.GetMethod; > > import org.restlet.Component; > > import org.restlet.Request; > > import org.restlet.Response; > > import org.restlet.Restlet; > > import org.restlet.data.Protocol; > > import org.restlet.routing.VirtualHost; > > > > public class TestVirtualHostPort { > > public static void main(String[] args) throws Exception { > > Component component = new Component(); > > > > component.getServers().add(Protocol.HTTP, 8182); > > component.getServers().add(Protocol.HTTP, 8183); > > > > // Application A > > Restlet restletA = new Restlet() { > > @Override > > public void handle(Request request, Response response) { > > System.out.println("host A " + > request.getResourceRef()); > > } > > }; > > // Application B > > Restlet restletB = new Restlet() { > > @Override > > public void handle(Request request, Response response) { > > System.out.println("host B " + > request.getResourceRef()); > > } > > }; > > > > // Virtual hosts > > VirtualHost hostA = new VirtualHost(); > > hostA.setHostPort("8182"); > > component.getHosts().add(hostA); > > > > VirtualHost hostB = new VirtualHost(); > > hostB.setHostPort("8183"); > > component.getHosts().add(hostB); > > > > hostA.attachDefault(restletA); > > hostB.attachDefault(restletB); > > > > component.start(); > > > > HttpClient client = new HttpClient(); > > HttpMethod method8182 = new GetMethod("http://localhost:8182/"); > > HttpMethod method8183 = new GetMethod("http://localhost:8183/"); > > > > // Prints on the console : host A http://localhost:8182/ > > client.executeMethod(method8182); > > // Prints on the console : host B http://localhost:8183/ > > client.executeMethod(method8183); > > > > component.stop(); > > } > > } ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2396150

