Well, you can ignore the first paragraph. The rest of my analysis turned
out to be correct.
Would anyone care to see the following on a wiki?
EndpointInfo ei = new EndpointInfo();
ei.setAddress(serviceFactory.getAddress());
Destination destination = df.getDestination(ei);
JettyHTTPDestination jettyDestination =
(JettyHTTPDestination) destination;
ServerEngine engine = jettyDestination.getEngine();
Handler handler = engine.getServant(new
URL(serviceFactory.getAddress()));
org.mortbay.jetty.Server server = handler.getServer();
Handler serverHandler = server.getHandler();
ContextHandlerCollection contextHandlerCollection =
(ContextHandlerCollection)serverHandler;
HandlerList handlerList = new HandlerList();
ResourceHandler resourceHandler = new ResourceHandler();
handlerList.addHandler(resourceHandler);
handlerList.addHandler(contextHandlerCollection);
server.setHandler(handlerList);
handlerList.start();
File staticContentFile = new File(staticContentPath);
URL targetURL = new URL("file://" +
staticContentFile.getCanonicalPath());
FileResource fileResource = new FileResource(targetURL);
resourceHandler.setBaseResource(fileResource);
> -----Original Message-----
> From: Benson Margulies [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 16, 2007 8:48 PM
> To: [email protected]
> Subject: RE: Getting the HTTP server off the bus
>
> Dan and Willem,
>
> It looks to me like I'm fairly nearly stuck until you let me fully
> control the server wiring unless I'm willing to do some fairly
extensive
> rewiring of your wiring.
>
> The jetty doc isn't precisely helpful here, but I have reached the
> following tentative view of the situation:
>
> As things are, the org.mortbay.jetty.Server has, as its singular
> handler, a ContextHandlerCollection, which has (at least one)
> ContextHandler. ContextHandlers are all about Servlet contexts, of
> course.
>
> Once a ContextHandlerCollection has at least one ContextHandler, it
> ignores any ordinary handlers that it has when handling any request
that
> begins with '/'.
>
> So, to get a ResourceHandler into the game, I think that I'd have to
> create a HandlerList and have that point off to the
> ContextHandlerCollection as well as the ResourceHandler, and install
it
> as the server's handler.
>
> I have a giant feeling here that there's something basic I'm missing
> about Jetty that is supposed to make this easier, but I'm pretty near
to
> accusing the folks who run the Jetty web site of intentionally making
> the version 6 docs less helpful than the version 5 docs to sell more
> consulting.
>
> Probably just sour grapes on my part.
>
> --benson