All,
I am trying to use the spring configuration to added a ResourceHandler for
static content to jetty.
It does not work when I use the following spring configuration:
========== Spring config ================
<httpj:engine-factory bus="cxf">
<httpj:engine port="9000">
<httpj:handlers>
<bean class="org.mortbay.jetty.handler.ResourceHandler">
<property
name="resourceBase"><value>d:/temp/</value></property>
</bean>
</httpj:handlers>
</httpj:engine>
</httpj:engine-factory>
=========================
But when I use the following java code it does work:
=========== Java code ==========================
Bus bus = (Bus)ctx.getBean("cxf");
ServerRegistry sr= bus.getExtension(ServerRegistry.class);
ServerImpl si = (ServerImpl) sr.getServers().get(0);
JettyHTTPDestination jhd = (JettyHTTPDestination)si.getDestination();
JettyHTTPServerEngine engine = (JettyHTTPServerEngine) jhd.getEngine();
Server server = engine.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();
resourceHandler.setResourceBase("d:/temp/");
========================================
Can you guys help me? I would like to only use spring config and not have to
have the extra java code.
Thanks,
Marcus